> >a) Can I assume the stack always extends into larger-addressed memory, or > >must I handle both cases? > > Both cases. If you want to add configure probing to determine > direction, go ahead.
I'm currently doing it dynamically. Get it working, then someone can do nice configure probing. :) Turns out win32 does it 'backwards', which I found interesting, at least. > >b) What's the largest alignment guaranteed for pointers? Byte-level? > > I think we can safely assume natural alignment, so you can treat the > stack as an array of pointers. If the start and end point are both > pointers you can just iterate that way. Seems to be byte-level, as I've had pointers between two pointers that wasn't pointer-aligned. Not sure what kind of padding msvc is doing, but it seems that from runops to a given DOD call in a string* function, that there's about 1KB of stack. That's 1000 checks to see if any of them are pointers to pmcs/buffers. Luckily, this number shouldn't grow with program size, but it might be a cause for worry. Also, I think I've discovered a situation which might not be resolvable. How do we determine id a given buffer is alive? We walk the stack and check for potential pointers into buffer memory. If the stack contains garbage pointers, we might have bad references into buffer memory. I can check for alignment within the buffer pool, and so it should be safe to set the BUFFER_live_FLAG on them. However, when we perform a collection, that means that we could be taking a garbage pointer in the buffer, and attempting to copy the memory it pointed to, into new memory. This could give us GPFs if we access bad memory, I think. Even if we check to ensure the buffer points into valid collectable memory (making it slower), we still have the issue of buflen being set to MAX_INT or something, and killing the system. :| The same caveats apply to pmc headers which happen to have PMC_buffer_ptr_FLAG set. How should we get around this particular problem, or is it spelling the doom of this particular solution? Thanks, Mike Lambert