🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Fiddling about with tuples and structs

Published August 28, 2008
Advertisement
Much to my chagrin, I realized earlier this evening that tuple members are being stored backwards in memory.

This is because of some laziness on my part in the grammar. Function parameters are passed in reverse order (i.e. the first parameter gets pushed onto the stack first, and the last parameter therefore has the lowest stack address). And, since constructing a tuple is handled by a function, it gets its members in backwards order.

I actually ran into the problem earlier, and thought I'd fixed it - but then it occurred to me that my fix had been to read tuple members backwards, rather than to fix the function parameter side of things.

So my project for tonight is to readjust the grammar (or, more likely, just put a hack in the parser) so that it effectively passes parameters in reverse order when a tuple or struct is being constructed. This will ensure that the memory layout of tuple/struct members matches the layout specified in the type definition.


Aside from that, I've implemented equality/inequality checks for tuples/structs, which currently by default does a by-member comparison. I also did some random tinkering about which I can't remember the details of offhand; but rest assured that something got improved [grin]


Status report - 0025 hours
Got the reversed order finished and working nicely. Along the way I squished a nasty bug that was causing weird behaviour with strings; it was vaguely related to undefined/uninitialized values on the stack. The technical details aren't really interesting unless you've been digging real deep into the Fugue code.

This leaves structure support and some error message cleanup as the main things left before Release 4 is ready. I'm going to go ahead and try to fix the error messages tonight before bed, since it should go pretty fast.

With any luck I'll be able to get structs finished this weekend, so expect R4 sometime around Sunday or Monday night.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement