[M3devel] exception handling and signal mask?
Jay K
jay.krell at cornell.edu
Mon Jan 4 12:50:47 CET 2010
"try" isn't supposed to save the signal mask, right?
I mean..like..finally doesn't restore it, right?
Nor does I suspect raise/except.
Specifically: Darwin.
There should be underscores in Target.m3 there?
Some of this /might/ be might fault.
In particular I was unaware of this signal mask thing and its relationship to setjmp/longjmp.
Furthermore, um... you know (or if you don't, I'll tell you):
Many platforms have two versions of setjmp/longjmp.
One saves/restore the signal mask. One does not.
Sometimes I think it is via some #define to "steer" /usr/include/setjmp.h.
Sometimes, I'm certain, it is setjmp vs. _setjmp, longjmp vs. _longjmp.
And then, furthermore, every system I've looked into recently except for NT
offers sigsetjmp/siglongjmp.
Their semantics when present are consistent.
Albeit less efficient.
sigsetjmp takes an extra integer (boolean) indicating of the signal mask should be saved.
They use sigjmp_buf instead of jmp_buf, which is sometimes identical, sometimes one or two integers larger, or possibly even larger, depending on the size of the signal mask.
So...for the cost of sometimes enlarging the jmpbuf, and for the cost of passing the extra integer 0, maybe we should use sigsetjmp on all Unix systems? I believe the Solaris documentation warns about the "less clearly named functions" (my wording) changing semantic..though I kind of doubt they can do that..
Not saving the signal mask is potentially much faster, as it might require a syscall to get.
(Though I also wonder if it can't be a special thread local, like at a fixed offset from FS or GS as NT does it.)
I'll go ahead and try just the smaller change of having Darwin use _setjmp instead of setjmp.
Not going ahead with sigsetjmp. Just yet.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100104/5ec01fea/attachment-0001.html>
More information about the M3devel
mailing list