ruby-changes:11574
From: nobu <ko1@a...>
Date: Sun, 19 Apr 2009 14:32:18 +0900 (JST)
Subject: [ruby-changes:11574] Ruby:r23209 (ruby_1_8): * eval.c (ruby_cleanup): the order of local variables on stack is
nobu 2009-04-19 14:31:58 +0900 (Sun, 19 Apr 2009) New Revision: 23209 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23209 Log: * eval.c (ruby_cleanup): the order of local variables on stack is undefined. should use outermost VALUE for ruby_init_stack. * gc.c (rb_stack_growup_p): returns stack grows up. * gc.c (Init_stack, ruby_init_stack): allows volatile pointer. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/eval.c branches/ruby_1_8/gc.c branches/ruby_1_8/ruby.h branches/ruby_1_8/version.h Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 23208) +++ ruby_1_8/ChangeLog (revision 23209) @@ -1,3 +1,12 @@ +Sun Apr 19 14:31:57 2009 Nobuyoshi Nakada <nobu@r...> + + * eval.c (ruby_cleanup): the order of local variables on stack is + undefined. should use outermost VALUE for ruby_init_stack. + + * gc.c (rb_stack_growup_p): returns stack grows up. + + * gc.c (Init_stack, ruby_init_stack): allows volatile pointer. + Sat Apr 18 19:44:53 2009 Nobuyoshi Nakada <nobu@r...> * eval.c (safe_mutex_lock): pthread_cleanup_push() must not be Index: ruby_1_8/version.h =================================================================== --- ruby_1_8/version.h (revision 23208) +++ ruby_1_8/version.h (revision 23209) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.8" -#define RUBY_RELEASE_DATE "2009-04-18" +#define RUBY_RELEASE_DATE "2009-04-19" #define RUBY_VERSION_CODE 188 -#define RUBY_RELEASE_CODE 20090418 +#define RUBY_RELEASE_CODE 20090419 #define RUBY_PATCHLEVEL -1 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 8 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 4 -#define RUBY_RELEASE_DAY 18 +#define RUBY_RELEASE_DAY 19 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: ruby_1_8/ruby.h =================================================================== --- ruby_1_8/ruby.h (revision 23208) +++ ruby_1_8/ruby.h (revision 23209) @@ -594,14 +594,14 @@ VALUE rb_require _((const char*)); #ifdef __ia64 -void ruby_init_stack(VALUE*, void*); +void ruby_init_stack(volatile VALUE*, void*); #define ruby_init_stack(addr) ruby_init_stack(addr, rb_ia64_bsp()) #else -void ruby_init_stack(VALUE*); +void ruby_init_stack(volatile VALUE*); #endif #define Init_stack(addr) ruby_init_stack(addr) #define RUBY_INIT_STACK \ - VALUE variable_in_this_stack_frame; \ + volatile VALUE variable_in_this_stack_frame; \ ruby_init_stack(&variable_in_this_stack_frame); void ruby_init _((void)); Index: ruby_1_8/eval.c =================================================================== --- ruby_1_8/eval.c (revision 23208) +++ ruby_1_8/eval.c (revision 23209) @@ -95,6 +95,15 @@ #include "vmsruby_private.h" #endif +#if STACK_GROW_DIRECTION > 0 +# define STACK_UPPER(x, a, b) a +#elif STACK_GROW_DIRECTION < 0 +# define STACK_UPPER(x, a, b) b +#else +int rb_stack_growup_p _((VALUE *addr)); +# define STACK_UPPER(x, a, b) (rb_stack_growup_p(x) ? a : b) +#endif + #ifdef USE_CONTEXT NORETURN(static void rb_jump_context(rb_jmpbuf_t, int)); @@ -1620,7 +1629,7 @@ errs[1] = ruby_errinfo; ruby_safe_level = 0; - ruby_init_stack((void *)&state); + ruby_init_stack(&errs[STACK_UPPER(errs, 0, 1)]); PUSH_THREAD_TAG(); PUSH_ITER(ITER_NOT); if ((state = EXEC_TAG()) == 0) { Index: ruby_1_8/gc.c =================================================================== --- ruby_1_8/gc.c (revision 23208) +++ ruby_1_8/gc.c (revision 23209) @@ -533,7 +533,7 @@ static int grow_direction; static int stack_grow_direction(addr) - VALUE *addr; + volatile VALUE *addr; { SET_STACK_END; @@ -542,6 +542,13 @@ } # define stack_growup_p(x) ((grow_direction ? grow_direction : stack_grow_direction(x)) > 0) # define STACK_UPPER(x, a, b) (stack_growup_p(x) ? a : b) + +int +rb_stack_growup_p(addr) + volatile VALUE *addr; +{ + return stack_growup_p(addr); +} #endif #define GC_WATER_MARK 512 @@ -1570,7 +1577,7 @@ void Init_stack(addr) - VALUE *addr; + volatile VALUE *addr; { ruby_init_stack(addr); } @@ -1583,16 +1590,16 @@ , bsp #endif ) - VALUE *addr; + volatile VALUE *addr; #ifdef __ia64 void *bsp; #endif { if (!rb_gc_stack_start || STACK_UPPER(&addr, - rb_gc_stack_start > addr, + addr && rb_gc_stack_start > addr, rb_gc_stack_start < addr)) { - rb_gc_stack_start = addr; + rb_gc_stack_start = (VALUE *)addr; } #ifdef __ia64 if (!rb_gc_register_stack_start || -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/