jamoma / JamomaCore

Jamoma Frameworks for Audio and Control Structure
Other
36 stars 14 forks source link

rewrite TTValue to contain TTDictionary & TTMatrix types #274

Closed nwolek closed 8 years ago

nwolek commented 10 years ago

@tap and I had a discussion in the hotel lobby on 8 March Bergen

There are some issues with the way we are currently passing both Dictionaries and Matrices in the Core. Because they are not able to currently be contained in a TTValue, we have developed some risky behaviors in our code. This includes passing generic TTPtrs and "trusting" that it is what you want on the other side.

@tap sketched out a potential solution that would increase the individual size of TTValues to 16 bytes, but allow us to pass Dictionaries and Matrices directly. These classes would be re-written with the "base" pattern so that they are constrained to this size.

It would clean up some of our memory issues and give us certain things for free, like being able to query the type of the Matrices.

These are just quick notes. More fleshing out later...

nwolek commented 10 years ago

Could also be a solution to Graph brokenness

tap commented 10 years ago

It turns out that the solution will lead to a size that is more than 16-bytes because we have 16-bytes for the data but then we also still need to store the type. So maybe we end up at 20-bytes or 24-bytes with the enum type?

If it gives us trouble we could consider overriding the new and free operators so that we align on 16-byte boundaries, effectively making TTElement 32-bytes -- which is probably still acceptable since we typically aren't passing huge numbers of elements in TTValue.