On Wed, Jun 25, 2003 at 11:43:34PM +0900, Simon Strandgaard wrote:
> On Wed, 25 Jun 2003 23:48:00 +0900, Mauricio Fern?ndez wrote:
> 
> > On Wed, Jun 25, 2003 at 10:21:37PM +0900, Simon Strandgaard wrote:
> >> On Wed, 25 Jun 2003 22:57:53 +0900, nobu.nokad wrote:
> >> 
> >> >   #3   Init_stack(address)
> >> >        tell GC the machine stack limit.
> >> 
> >> I never heard about this before, what does it do ?
> >> Can you give me a more lengthy description of it :-)
> > 
> > The GC of Ruby is conservative: it will scan the stack to find VALUEs.
> > This means at any moment it can take the stack pointer and scan from
> > there to the beginning of the stack. Init_stack takes the address of one
> > local variable (in the stack) and records it as the bottom of the stack
> > (highest address in x86).
> 
> Sorry I don't understand Nobu's reason to added Init_stack as number 3rd 
> item in the list of possible ways to register an instance.
> 
> Is Init_stack really a 3rd possiblitity to do registring ?

It doesn't register one specific instance, but sets the top of the stack
(which will be scanned afterwards) so that the value can be found later.

You have to call this (directly or via another function) at the
beginning of your program.

Some references:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/66013
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/66025


-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Your job is being a professor and researcher: That's one hell of a good excuse
for some of the brain-damages of minix.
	-- Linus Torvalds to Andrew Tanenbaum