From: Sylvain Joyeux Date: 2009-01-07T18:19:10+09:00 Subject: [ruby-core:21188] Re: [PATCH] Update to MBARI patches on 1.8.7-p72 On Wed, Jan 07, 2009 at 04:35:18PM +0900, Brent Roman wrote: > > Sylvain, > > Man, the PowerPC is a weird beast. > > After spending a couple hours looking over its ABI docs, I've convinced > myself that the stack pointer would be valid for stack clearing if one could > get to at it directly from the C code. MBARI7 introduced a bit of gcc asm > to do this for x86. I've posted an update to the MBARI7 patch on my website > that adds asm cases to get the stack pointer for PPC and ARM processors. I > don't have ready access to a PowerPC machine, so I'll have to rely on others > to test this. > > Oddly enough, there has long been (and still is) code in gc.c that gets the > stack pointer via alloc(0), but it does not crash on PPC because that > pointer is only used to determine the approximate stack depth for catching > infinite recursion in Ruby scripts. You should read commit messages when someone points you to one ;-) That's basically what I said in the message, except that I thought it was also used to delimit the stack in the mark phase. Anyway, it works because * the stack is not modified * there is no ruby variables that can be stored in-between the alloca() space and the stack pointer which is not already somewhere else (in registers, and the register window is also dumped by the GC AFAIK). > P.S. I'll be trying to learn git and github over the coming weeks. Perhaps > we can keep these patches and yours in one place eventually. Well, it will be as simple as cloning my repository in one common place. I already updated my patch to work on top of MBARI7 with ASM as well ... We'll see what to keep I guess. My updated patch is here: http://github.com/doudou/ruby/commit/f02bea5b10fea4dfd5157002fdfc04b03ed26185 Sylvain