<html><body bgcolor="#FFFFFF"><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="Apple-style-span" style="-webkit-composition-fill-color: rgba(175, 192, 227, 0.231373); -webkit-composition-frame-color: rgba(77, 128, 180, 0.231373); ">)</span></div><div><br>On Nov 26, 2009, at 3:59 PM, Tony Hosking <<a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a>> wrote:<br><br></div><div><span></span></div><blockquote type="cite"><div>Take a look at the latest and see what you think.<br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><span class="Apple-style-span" style="font-size: medium;"><font class="Apple-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="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">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="stopSpelling">Subject: Re: SaveRegsInStack / awkward SignalHandler, etc.<br>From:<span class="Apple-converted-space"> </span><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="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com"><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a></a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu"><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a></a><br><br><div><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><div style="word-wrap: break-word; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal 12px/normal Helvetica; white-space: normal; letter-spacing: normal; color: rgb(0, 0, 0); word-spacing: 0px; "><div><span class="ecxApple-style-span" style="font-size: medium; ">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="ecxApple-interchange-newline"><blockquote><span class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; ">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 class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "> 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 class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "> "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 class="ecxApple-style-span" style="text-transform: none; text-indent: 0px; border-collapse: separate; font: normal normal normal medium/normal Helvetica; white-space: normal; letter-spacing: normal; word-spacing: 0px; "><div class="ecxhmmessage" style="font-family: Verdana; font-size: 10pt; "> <br>?<br> <br> - Jay<br><br> <br>> Date: Thu, 26 Nov 2009 19:44:24 +0000<br>> To:<span class="ecxApple-converted-space"> </span><a href="mailto:m3commit@elegosoft.com"><a href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</a></a><br>> From:<span class="ecxApple-converted-space"> </span><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="ecxApple-converted-space"> </span><br>> CVSROOT: /usr/cvs<br>> Changes by: hosking@birch. 09/11/26 19:44:24<br>><span class="ecxApple-converted-space"> </span><br>> Modified files:<br>> cm3/m3-libs/m3core/src/thread/PTHREAD/: ThreadPThread.i3<span class="ecxApple-converted-space"> </span><br>> ThreadPThread.m3<span class="ecxApple-converted-space"> </span><br>> ThreadPThreadC.c<span class="ecxApple-converted-space"> </span><br>><span class="ecxApple-converted-space"> </span><br>> Log message:<br>> Refactor slightly to avoid need for awkward SignalHandlerC call.<br>><span class="ecxApple-converted-space"> </span><br></div></span></blockquote></div><br></div></span><br class="Apple-interchange-newline"></blockquote></div><br></div></blockquote></body></html>