* eval.c (ruby_cleanup): the order of local variables on stack is

undefined.  should use outermost VALUE for ruby_init_stack.

* gc.c (ruby_get_stack_grow_direction, Init_stack): allows volatile
  pointer.

* thread_*.c (ruby_init_stack): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-04-19 05:43:20 +00:00
Родитель 53054c0ff6
Коммит c7853b4344
7 изменённых файлов: 26 добавлений и 15 удалений

Просмотреть файл

@ -1,3 +1,13 @@
Sun Apr 19 14:43:18 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (ruby_cleanup): the order of local variables on stack is
undefined. should use outermost VALUE for ruby_init_stack.
* gc.c (ruby_get_stack_grow_direction, Init_stack): allows volatile
pointer.
* thread_*.c (ruby_init_stack): ditto.
Sun Apr 19 13:17:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Sun Apr 19 13:17:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gem_prelude.rb (Gem::QuickLoader#push_gem_version_on_load_path): * gem_prelude.rb (Gem::QuickLoader#push_gem_version_on_load_path):

Просмотреть файл

@ -499,7 +499,7 @@ error.$(OBJEXT): {$(VPATH)}error.c {$(VPATH)}known_errors.inc $(RUBY_H_INCLUDES)
$(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h $(VM_CORE_H_INCLUDES) {$(VPATH)}debug.h
eval.$(OBJEXT): {$(VPATH)}eval.c {$(VPATH)}eval_intern.h \ eval.$(OBJEXT): {$(VPATH)}eval.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}eval_error.c \ $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) {$(VPATH)}eval_error.c \
{$(VPATH)}eval_jump.c {$(VPATH)}debug.h \ {$(VPATH)}eval_jump.c {$(VPATH)}debug.h {$(VPATH)}gc.h \
{$(VPATH)}iseq.h {$(VPATH)}iseq.h
load.$(OBJEXT): {$(VPATH)}load.c {$(VPATH)}eval_intern.h \ load.$(OBJEXT): {$(VPATH)}load.c {$(VPATH)}eval_intern.h \
{$(VPATH)}util.h $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) \ {$(VPATH)}util.h $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) \

13
eval.c
Просмотреть файл

@ -13,6 +13,7 @@
#include "eval_intern.h" #include "eval_intern.h"
#include "iseq.h" #include "iseq.h"
#include "gc.h"
VALUE proc_invoke(VALUE, VALUE, VALUE, VALUE); VALUE proc_invoke(VALUE, VALUE, VALUE, VALUE);
VALUE rb_binding_new(void); VALUE rb_binding_new(void);
@ -55,7 +56,7 @@ ruby_init(void)
rb_origenviron = environ; rb_origenviron = environ;
Init_stack((void *)&state); ruby_init_stack((void *)&state);
Init_BareVM(); Init_BareVM();
Init_heap(); Init_heap();
@ -79,9 +80,9 @@ void *
ruby_options(int argc, char **argv) ruby_options(int argc, char **argv)
{ {
int state; int state;
void *iseq = 0; void *volatile iseq = 0;
Init_stack((void *)&state); ruby_init_stack((void *)&iseq);
PUSH_TAG(); PUSH_TAG();
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(GET_THREAD(), iseq = ruby_process_options(argc, argv)); SAVE_ROOT_JMPBUF(GET_THREAD(), iseq = ruby_process_options(argc, argv));
@ -134,7 +135,7 @@ ruby_cleanup(volatile int ex)
errs[1] = th->errinfo; errs[1] = th->errinfo;
th->safe_level = 0; th->safe_level = 0;
Init_stack((void *)&state); ruby_init_stack(&errs[STACK_UPPER(errs, 0, 1)]);
PUSH_TAG(); PUSH_TAG();
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
@ -228,7 +229,7 @@ ruby_run_node(void *n)
if (FIXNUM_P(v)) { if (FIXNUM_P(v)) {
return FIX2INT(v); return FIX2INT(v);
} }
Init_stack((void *)&n); ruby_init_stack((void *)&n);
return ruby_cleanup(ruby_exec_node(n, 0)); return ruby_cleanup(ruby_exec_node(n, 0));
} }
@ -629,7 +630,7 @@ rb_rescue(VALUE (* b_proc)(ANYARGS), VALUE data1,
VALUE VALUE
rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state) rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
{ {
VALUE result = Qnil; /* OK */ volatile VALUE result = Qnil;
int status; int status;
rb_thread_t *th = GET_THREAD(); rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp; rb_control_frame_t *cfp = th->cfp;

6
gc.c
Просмотреть файл

@ -653,7 +653,7 @@ vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t size)
if (!ptr) return ruby_xmalloc(size); if (!ptr) return ruby_xmalloc(size);
if (size == 0) size = 1; if (size == 0) size = 1;
if (ruby_gc_stress && !ruby_disable_gc_stress) if (ruby_gc_stress && !ruby_disable_gc_stress)
garbage_collect_with_gvl(objspace); garbage_collect_with_gvl(objspace);
#if CALC_EXACT_MALLOC_SIZE #if CALC_EXACT_MALLOC_SIZE
size += sizeof(size_t); size += sizeof(size_t);
@ -1109,7 +1109,7 @@ rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_F
#if !STACK_GROW_DIRECTION #if !STACK_GROW_DIRECTION
int ruby_stack_grow_direction; int ruby_stack_grow_direction;
int int
ruby_get_stack_grow_direction(VALUE *addr) ruby_get_stack_grow_direction(volatile VALUE *addr)
{ {
VALUE *end; VALUE *end;
SET_MACHINE_STACK_END(&end); SET_MACHINE_STACK_END(&end);
@ -2122,7 +2122,7 @@ rb_gc_start(void)
#undef Init_stack #undef Init_stack
void void
Init_stack(VALUE *addr) Init_stack(volatile VALUE *addr)
{ {
ruby_init_stack(addr); ruby_init_stack(addr);
} }

Просмотреть файл

@ -1021,10 +1021,10 @@ NORETURN(void rb_throw_obj(VALUE,VALUE));
VALUE rb_require(const char*); VALUE rb_require(const char*);
#ifdef __ia64 #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()) #define ruby_init_stack(addr) ruby_init_stack(addr, rb_ia64_bsp())
#else #else
void ruby_init_stack(VALUE*); void ruby_init_stack(volatile VALUE*);
#endif #endif
#define RUBY_INIT_STACK \ #define RUBY_INIT_STACK \
VALUE variable_in_this_stack_frame; \ VALUE variable_in_this_stack_frame; \

Просмотреть файл

@ -264,7 +264,7 @@ extern void *STACK_END_ADDRESS;
#undef ruby_init_stack #undef ruby_init_stack
void void
ruby_init_stack(VALUE *addr ruby_init_stack(volatile VALUE *addr
#ifdef __ia64 #ifdef __ia64
, void *bsp , void *bsp
#endif #endif
@ -278,7 +278,7 @@ ruby_init_stack(VALUE *addr
STACK_UPPER((VALUE *)(void *)&addr, STACK_UPPER((VALUE *)(void *)&addr,
native_main_thread.stack_start > addr, native_main_thread.stack_start > addr,
native_main_thread.stack_start < addr)) { native_main_thread.stack_start < addr)) {
native_main_thread.stack_start = addr; native_main_thread.stack_start = (VALUE *)addr;
} }
#endif #endif
#ifdef __ia64 #ifdef __ia64

Просмотреть файл

@ -417,7 +417,7 @@ native_cond_destroy(rb_thread_cond_t *cond)
} }
void void
ruby_init_stack(VALUE *addr) ruby_init_stack(volatile VALUE *addr)
{ {
} }