summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-19 05:43:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-19 05:43:20 +0000
commit8c0ea7cda023737eb5a2e76b975b0c7bde70e467 (patch)
tree96f691eaa1d8182de45b06a6ceee5bfc9da5f17b /eval.c
parenta86899236fb1a2fbf92e386402cc882c76b71c72 (diff)
downloadruby-8c0ea7cda023737eb5a2e76b975b0c7bde70e467.tar.gz
ruby-8c0ea7cda023737eb5a2e76b975b0c7bde70e467.tar.xz
ruby-8c0ea7cda023737eb5a2e76b975b0c7bde70e467.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@23210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index 2e66acd62..1d5345f0a 100644
--- a/eval.c
+++ b/eval.c
@@ -13,6 +13,7 @@
#include "eval_intern.h"
#include "iseq.h"
+#include "gc.h"
VALUE proc_invoke(VALUE, VALUE, VALUE, VALUE);
VALUE rb_binding_new(void);
@@ -55,7 +56,7 @@ ruby_init(void)
rb_origenviron = environ;
- Init_stack((void *)&state);
+ ruby_init_stack((void *)&state);
Init_BareVM();
Init_heap();
@@ -79,9 +80,9 @@ void *
ruby_options(int argc, char **argv)
{
int state;
- void *iseq = 0;
+ void *volatile iseq = 0;
- Init_stack((void *)&state);
+ ruby_init_stack((void *)&iseq);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(GET_THREAD(), iseq = ruby_process_options(argc, argv));
@@ -134,7 +135,7 @@ ruby_cleanup(volatile int ex)
errs[1] = th->errinfo;
th->safe_level = 0;
- Init_stack((void *)&state);
+ ruby_init_stack(&errs[STACK_UPPER(errs, 0, 1)]);
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
@@ -228,7 +229,7 @@ ruby_run_node(void *n)
if (FIXNUM_P(v)) {
return FIX2INT(v);
}
- Init_stack((void *)&n);
+ ruby_init_stack((void *)&n);
return ruby_cleanup(ruby_exec_node(n, 0));
}
@@ -629,7 +630,7 @@ rb_rescue(VALUE (* b_proc)(ANYARGS), VALUE data1,
VALUE
rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
{
- VALUE result = Qnil; /* OK */
+ volatile VALUE result = Qnil;
int status;
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;