[M3devel] registers and garbage collector?
Jay
jay.krell at cornell.edu
Sun Jan 11 23:28:08 CET 2009
Is this a safe assumption?
PROCEDURE ProcessOther (act: Activation; p: PROCEDURE (start, stop: ADDRESS)) =...
IF RTMachine.GetState # NIL THEN (* process explicit state *) sp := RTMachine.GetState(act.handle, state); ELSE (* assume registers are saved in suspended thread's stack *) sp := act.sp; END;
As I understand..insert question marks a bunch here:
The threads are all sitting waiting in their signal handler, with a ucontext pointer...which could be in a register and not on the stack..which contains a pointer to the registers...which could be to a thread local..and not on the stack..and not in the Modula-3 heap..would be a simple matter to strengthen this..be sure to store the ucontext in a thread local (no, actually)..or somehow be sure to get it on the stack (might as well skip the ucontext and use the gregs or whatever is in it)?
Storing the ucontext in a thread local doesn't work, because you can't access thread locals that aren't yours. Instead a global array would likely be needed, that the signal handlers would all store into. I'd suggest, like, storing the ucontext/gregs into a local, or maybe a volatile local in C, maybe a struct/record, but I don't think there's any guaranteeing these aren't registers, I think a global array would be the way.
I guess the assumption is fairly safe, but I'm not 100% sure.
No, I'm not suspecting any problem here. I was just remembering that I'd seen platform specific stuff for some platforms (Darwin) that I'd managed to avoid, somehow, and went and looked closer, see if I was legitimately avoiding it. Most platforms do avoid it.
??
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20090111/3adb49ef/attachment-0001.html>
More information about the M3devel
mailing list