[M3devel] registers and garbage collector?
Tony Hosking
hosking at cs.purdue.edu
Mon Jan 12 01:13:10 CET 2009
Yes, this is safe. Some platforms require that we account for the red-
zone, but generally the registers have been saved on the stack in the
signal handler frame. I do not want to go the global array route that
you suggest -- no need and very slow!
On 12 Jan 2009, at 09:28, Jay wrote:
> 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/20090112/bc7fa148/attachment-0002.html>
More information about the M3devel
mailing list