[M3devel] SaveRegsInStack

Tony Hosking hosking at cs.purdue.edu
Sun Nov 22 04:19:12 CET 2009


Are we sure that &jb is a sufficient sp?  What about other registers saved by the "ta 3"?  They don't necessarily end up in jb.

On 21 Nov 2009, at 20:11, Jay K wrote:

> Tony,
> Looking at the disassembly of /usr/lib/libc.so and /usr/lib/sparcv9/libc.so, both longjmps contain ta  3.
> So how about:
> void *RTStack__SaveRegsInStack(void)
> {
>   jmp_buf jb;
>   if (setjmp(jb))
>   {
>     longjmp(jb, 1); /* contains ta 3 */
>     abort(); /* unreachable */
>   }
>   else
>   {
>     return &jb;
>   }
> }
>  
> Too wasteful?
>  
>  - Jay
> 
> 
>  
> From: jay.krell at cornell.edu
> To: hosking at cs.purdue.edu
> Date: Sun, 22 Nov 2009 00:12:44 +0000
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] SaveRegsInStack
> 
> SOLsun doesn't like the current source:
>  
> C compiler failed compiling: ../src/runtime/SOLsun/RTStackC.c
> new source -> compiling ThreadPThreadC.c
> "../src/thread/PTHREAD/ThreadPThreadC.c", line 310: asm statement illegal outside function
> "../src/thread/PTHREAD/ThreadPThreadC.c", line 316: asm statement illegal outside function
> "../src/thread/PTHREAD/ThreadPThreadC.c", line 317: asm statement illegal outside function
> "../src/thread/PTHREAD/ThreadPThreadC.c", line 325: asm statement illegal outside function
> "../src/thread/PTHREAD/ThreadPThreadC.c", line 326: asm statement illegal outside function
> "../src/thread/PTHREAD/ThreadPThreadC.c", line 327: asm statement illegal outside function
> "../src/thread/PTHREAD/ThreadPThreadC.c", line 349: cannot recover from previous
> 
>  - Jay
>  
> From: jay.krell at cornell.edu
> To: hosking at cs.purdue.edu
> CC: m3devel at elegosoft.com
> Subject: RE: [M3devel] SaveRegsInStack
> Date: Sat, 21 Nov 2009 23:45:42 +0000
> 
> (or RTMachineC.c)
>  
>  - Jay
>  
> From: jay.krell at cornell.edu
> To: hosking at cs.purdue.edu
> Date: Sat, 21 Nov 2009 23:40:03 +0000
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] SaveRegsInStack
> 
>  > No, those don't have the desired effect on SPARC.
>  
> ok. I was somewhat guessing.
>  
>  > Why wouldn't SPARC* all have stack walkers?
>  
> Because I'm lazy and doubt anyone cares much about SPARC{32,64}_{LINUX,FREEBSD,NETBSD}, SPARC64_SOLARIS.
> ? But I can maybe try it at some point.
>  
> I also expect the way to go is use libunwind for nearly all targets, even probably SPARC*.
>  
>  > It would be good to have it in one place for *all* SPARC targets.  Where to put it
>  
> How about a new src/runtime/common/RTStackC.c, compiled on all platforms but with #ifdefs (the same #ifdefs as are currently used, but revisiting them at some point, the NETBSD and such seem suspicious).
> I think I'll do that shortly.
>  
> There is also TARGET_ARCH defined in the config files.
> We could do
> if exist(TARGET_ARCH/m3makefile)
>   include_dir(TARGET_ARCH)
> end
>  
> (similarly there is TARGET_OS).
>  
>  - Jay
>  
> From: hosking at cs.purdue.edu
> Date: Sat, 21 Nov 2009 17:02:23 -0500
> To: jay.krell at cornell.edu
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] SaveRegsInStack
> 
> On 21 Nov 2009, at 15:38, Jay K wrote:
> 
> Tony, it bugs me that we have three copies of this code.
> Would it be reasonable and not very inefficient
> and maybe somewhat portable to replace it with
> setjmp or getcontext or alloca(1)?
> 
> No, those don't have the desired effect on SPARC.
> 
>  Or can we go back to having RTStack call RTMachine?
> (Imagine if SPARC* all had stack walkers, though I
> doubt that will happen, other than via libunwind.)
> 
> Why wouldn't SPARC* all have stack walkers?  Their stack frames are trivial to unwind.
> I agree that it is annoying to have multiple copies of this code.  It would be good to have it in one place for *all* SPARC targets.  Where to put it?
> 
>  
> 
>  - Jay
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091121/f500cb90/attachment-0002.html>


More information about the M3devel mailing list