Ruby_init_stack and Init_stack

e$B$J$+$@$G$9!#e(B

e$B$3$NFs$D$N4X?t$O$[$H$s$IF10l$J$N$G$^$H$a$h$&$H;W$$$^$9$,!"$3$l$Ge(B
ia64-freebsde$B$G$NF0:n$OLdBj$J$$$G$7$g$&$+!#e(B

Index: include/ruby/ruby.h

— include/ruby/ruby.h (revision 15984)
+++ include/ruby/ruby.h (working copy)
@@ -824,13 +824,11 @@ VALUE rb_require(const char*);
#ifdef __ia64
void ruby_init_stack(VALUE*, void*);
-#define RUBY_INIT_STACK \

  • VALUE variable_in_this_stack_frame; \
  • ruby_init_stack(&variable_in_this_stack_frame, rb_ia64_bsp());
    +#define ruby_init_stack(addr) ruby_init_stack(addr, rb_ia64_bsp())
    #else
    void ruby_init_stack(VALUE*);
    +#endif
    #define RUBY_INIT_STACK
    VALUE variable_in_this_stack_frame;
    ruby_init_stack(&variable_in_this_stack_frame);
    -#endif
    void ruby_init(void);
    void ruby_options(int, char*);
    Index: gc.c
    ===================================================================
    — gc.c (revision 15984)
    +++ gc.c (working copy)
    @@ -1587,65 +1587,10 @@ void
    Init_stack(VALUE *addr)
    {
    -#ifdef __ia64
  • if (rb_gc_register_stack_start == 0) {
    -# if defined(FreeBSD)
  •    /*
    
  •     * FreeBSD/ia64 currently does not have a way for a process to 
    

get the

  •     * base address for the RSE backing store, so hardcode it.
    
  •     */
    
  •    rb_gc_register_stack_start = (4ULL<<61);
    

-# elif defined(HAVE___LIBC_IA64_REGISTER_BACKING_STORE_BASE)
-# pragma weak __libc_ia64_register_backing_store_base

  •    extern unsigned long __libc_ia64_register_backing_store_base;
    
  •    rb_gc_register_stack_start = 
    

(VALUE*)__libc_ia64_register_backing_store_base;
-# endif

  • }
  • {
  •    VALUE *bsp = (VALUE*)rb_ia64_bsp();
    
  •    if (rb_gc_register_stack_start == 0 ||
    
  •        bsp < rb_gc_register_stack_start) {
    
  •        rb_gc_register_stack_start = bsp;
    
  •    }
    
  • }
    -#endif
    -#if defined(_WIN32) || defined(CYGWIN)
  • MEMORY_BASIC_INFORMATION m;
  • memset(&m, 0, sizeof(m));
  • VirtualQuery(&m, &m, sizeof(m));
  • rb_gc_stack_start =
  • STACK_UPPER((VALUE *)&m, (VALUE *)m.BaseAddress,
  •    (VALUE *)((char *)m.BaseAddress + m.RegionSize) - 1);
    

-#elif defined(STACK_END_ADDRESS)

  • {
  •    extern void *STACK_END_ADDRESS;
    
  •    rb_gc_stack_start = STACK_END_ADDRESS;
    
  • }
    -#else
  • if (!addr) addr = (VALUE *)&addr;
  • STACK_UPPER(&addr, addr, ++addr);
  • if (rb_gc_stack_start) {
  • if (STACK_UPPER(&addr,
  •  rb_gc_stack_start > addr,
    
  •  rb_gc_stack_start < addr))
    
  •  rb_gc_stack_start = addr;
    
  • return;
  • }
  • rb_gc_stack_start = addr;
    -#endif
    -#ifdef HAVE_GETRLIMIT
  • {
  • struct rlimit rlim;
  • if (getrlimit(RLIMIT_STACK, &rlim) == 0) {
  •  unsigned int space = rlim.rlim_cur/5;
    
  •  if (space > 1024*1024) space = 1024*1024;
    
  •  rb_gc_stack_maxsize = rlim.rlim_cur - space;
    
  • }
  • }
    -#endif
  • ruby_init_stack(addr);
    }

-void ruby_init_stack(VALUE *addr
+#undef ruby_init_stack
+void
+ruby_init_stack(VALUE *addr
#ifdef __ia64
, void *bsp