<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Yes thanks that seems better.<BR>
I'm not sure I follow it all yet. So the below questions might be nonsense resulting from misunderstanding.<BR>
<BR>
The setjmp in sigsuspend seems redundant with stashing the context in SignalHandler.<BR>
Doesn't it?<BR>
<BR>
<BR>
That would be to capture the context of the signal handler, not just the interrupted code?<BR>
But we don't care? Except maybe on regwindows? But the setjmp data isn't in the described stack.<BR>
<BR>
<BR>
Interix doesn't have SIGINFO, but I don't test Interix often (months), and I doubt that should veto a reasonable approach for all other platforms. I have to experiment with Interix to see what to do. (what thread/stack signals are delivered on, if registers are available, if "direct suspend" is available, if user threads are viable with get/set/make/swapcontext, if user threads are viable with fibers)<BR>
<BR>
<BR>
If there's any advantage, getcontext can substitute for setjmp on non-registerwindows machines.<BR>
You know that.<BR>
<BR>
<BR>
Btw, I looked into the "jmpbuf obfuscation" in glibc, I was worried it might break some of our usage. But it seems ok. They don't obfuscate everything, just like sp and pc, which, like, obviously, are very useful for typical setjmp/longjmp usage, but not really useful at all for our purposes of looking for more pointers to scan, since pc isn't interesting and sp we endevour to get differently.<BR>
<BR>
<BR>
- Jay<BR><BR> <BR>
<HR id=stopSpelling>
From: jay.krell@cornell.edu<BR>To: jayk123@hotmail.com<BR>Subject: Re: [M3devel] SaveRegsInStack / awkward SignalHandler, etc.<BR>Date: Thu, 26 Nov 2009 20:25:35 -0500<BR>CC: hosking@cs.purdue.edu; jay.krell@cornell.edu; m3devel@elegosoft.com<BR><BR>
<DIV>Oops no i am not up to date yet, later..<BR><BR> - Jay (phone<SPAN class=ecxApple-style-span>)</SPAN></DIV>
<DIV><BR>On Nov 26, 2009, at 7:36 PM, <A href="mailto:jayk123@hotmail.com">jayk123@hotmail.com</A> wrote:<BR><BR></DIV>
<DIV></DIV>
<BLOCKQUOTE>
<DIV>
<DIV>(sorry I know it sounds rude)</DIV>
<DIV>I already had & my comments had it in mind.</DIV>
<DIV><BR> - Jay (phone<SPAN class=ecxApple-style-span>)</SPAN></DIV>
<DIV><BR>On Nov 26, 2009, at 3:59 PM, Tony Hosking <<A href="mailto:hosking@cs.purdue.edu"><A href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</A></A>> wrote:<BR><BR></DIV>
<DIV><SPAN></SPAN></DIV>
<BLOCKQUOTE>
<DIV>Take a look at the latest and see what you think.<BR>
<DIV><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV style="WORD-WRAP: break-word"><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV><SPAN style="FONT-SIZE: medium" class=ecxApple-style-span><FONT class=ecxApple-style-span color=#0000ff face="'Gill Sans'"><BR></FONT></SPAN></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV></SPAN></SPAN></DIV>
<DIV>
<DIV>On 26 Nov 2009, at 15:01, Jay K wrote:</DIV><BR class=ecxApple-interchange-newline>
<BLOCKQUOTE><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" class=ecxhmmessage>Ok I guess. Then the setjmp should be under #ifdef M3_REGISTER_WINDOWS. ?<BR>(In ProcessOther, not ProcessLive.)<BR>Wait...doesn't ProcessLive need a setjmp or getcontext??<BR>I can buy the notion that:<BR> <BR> > The heap references we are interested in will be somewhere on the stack.<BR> <BR> <BR>You are certain?<BR>This is the main difference.<BR> <BR> <BR>Also, if we can be so loose about it, then the extra function call isn't needed either, right?<BR>Just the old ADR(xx) (or ADR(me) or ADR(errno), no need for another variable).<BR> <BR> <BR>My approach as I said was more well defined, but as you say, maybe no need for it.<BR> <BR> <BR>(Itanium looks easy enough; setjmp/longjmp to flush registers, getcontext to get the current bsp, get the current bsp in thread create and then scan between that and whatever getcontext returns later, and __libc_ia64_something_or_other for the first thread, and a hardcoded constant on FreeBSD/IA64 -- this per a quick read of the Ruby code it turns out.. HP-UX and VMS on IA64 TBD..Windows is probably trivial, what with compiler intrinsics...)<BR> <BR> <BR> - Jay<BR> <BR>
<HR id=ecxstopSpelling>
Subject: Re: SaveRegsInStack / awkward SignalHandler, etc.<BR>From:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:hosking@cs.purdue.edu"></A><A href="mailto:hosking@cs.purdue.edu"><A href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</A></A><BR>Date: Thu, 26 Nov 2009 14:21:14 -0500<BR>CC:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:m3devel@elegosoft.com"></A><A href="mailto:m3devel@elegosoft.com"><A href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</A></A><BR>To:<SPAN class=ecxApple-converted-space> </SPAN><A href="mailto:jay.krell@cornell.edu"></A><A href="mailto:jay.krell@cornell.edu"><A href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</A></A><BR><BR>
<DIV><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span>
<DIV style="WORD-WRAP: break-word"><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxecxApple-style-span>
<DIV><SPAN style="FONT-SIZE: medium" class=ecxecxApple-style-span>On 26 Nov 2009, at 14:11, Jay K wrote:</SPAN></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV></SPAN></SPAN></DIV>
<DIV><BR class=ecxecxApple-interchange-newline>
<BLOCKQUOTE><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxecxApple-style-span>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" class=ecxecxhmmessage>Tony I agree my code was "awkward" (what I'd really like is for cm3 to output .h files<BR>so that interop can be "natural", reliable, clear, idiomatic, correct.. but until then..)<BR>(And if such .h files were output, I'd just write the entire signal handler in C.)<BR> <BR>However I found the meaning and correctness of my code clearer.<BR>In particular I was getting the registers into the stack keeping<BR>the stack below their location.<BR> <BR> <BR>In your case, you know, sem_post/sigsuspend will overwrite part of that.<BR></DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>We don't care that it is overwritten. We just need a reasonable approximation of the top of the stack. The heap references we are interested in will be somewhere on the stack.</DIV><BR>
<BLOCKQUOTE><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxecxApple-style-span>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" class=ecxecxhmmessage> Now, I grant, it isn't all clear -- your code has a high chance of being correct.<BR>The (current) registers probably are already higher up the signal call stack.<BR>So the stack pointer for the signal handler itself probably suffices -- what<BR>you were using prior to yesterday.<BR></DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>Right. We just needed to make sure that the Windows were saved on SPARC.</DIV>
<DIV><BR></DIV>
<BLOCKQUOTE><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxecxApple-style-span>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" class=ecxecxhmmessage> "Briefly: I like the way I had it." (except, again, yes the C <=> Modula-3 interop is "awkard").<BR></DIV></SPAN></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>I had problems with the blurring of the ActState enumeration across the C/M3 boundary.</DIV><BR>
<BLOCKQUOTE><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxecxApple-style-span>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" class=ecxecxhmmessage> <BR>?<BR> <BR> - Jay<BR><BR> <BR>> Date: Thu, 26 Nov 2009 19:44:24 +0000<BR>> To:<SPAN class=ecxecxApple-converted-space> </SPAN><A href="mailto:m3commit@elegosoft.com"></A><A href="mailto:m3commit@elegosoft.com"><A href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</A></A><BR>> From:<SPAN class=ecxecxApple-converted-space> </SPAN><A href="mailto:hosking@elego.de"></A><A href="mailto:hosking@elego.de"><A href="mailto:hosking@elego.de">hosking@elego.de</A></A><BR>> Subject: [M3commit] CVS Update: cm3<BR>><SPAN class=ecxecxApple-converted-space> </SPAN><BR>> CVSROOT: /usr/cvs<BR>> Changes by: hosking@birch. 09/11/26 19:44:24<BR>><SPAN class=ecxecxApple-converted-space> </SPAN><BR>> Modified files:<BR>> cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadPThread.i3<SPAN class=ecxecxApple-converted-space> </SPAN><BR>> ThreadPThread.m3<SPAN class=ecxecxApple-converted-space> </SPAN><BR>> ThreadPThreadC.c<SPAN class=ecxecxApple-converted-space> </SPAN><BR>><SPAN class=ecxecxApple-converted-space> </SPAN><BR>> Log message:<BR>> Refactor slightly to avoid need for awkward SignalHandlerC call.<BR>><SPAN class=ecxecxApple-converted-space> </SPAN><BR></DIV></SPAN></BLOCKQUOTE></DIV><BR></DIV></SPAN><BR class=ecxApple-interchange-newline></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE> </body>
</html>