diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-26 06:14:44 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-06-26 06:14:44 +0000 |
commit | 931574010102b4bd9db6cfb17b840e28b26030e6 (patch) | |
tree | 39b4acd08cfce1f46c50c6d8409c0b22a248f7c0 | |
parent | 8bfcdf323f1843237140e9f119496b93557eaefd (diff) |
* cont.c (rb_fiber_s_new): revert initializing VM stack.
* yarvcore.c (th_init2): ditto.
* vm.c, vm.h: fix to stop using Qundef on VM stack. According to
this change, VM stack should not include Qundef value.
* insns.def (putundef): removed.
* compile.c (iseq_compile_each): ditto.
* eval.c (eval): fix spacing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | compile.c | 3 | ||||
-rw-r--r-- | cont.c | 1 | ||||
-rw-r--r-- | eval.c | 1 | ||||
-rw-r--r-- | insns.def | 14 | ||||
-rw-r--r-- | vm.c | 15 | ||||
-rw-r--r-- | vm.h | 12 | ||||
-rw-r--r-- | yarvcore.c | 1 |
8 files changed, 29 insertions, 33 deletions
@@ -1,3 +1,18 @@ +Tue Jun 26 15:04:06 2007 Koichi Sasada <[email protected]> + + * cont.c (rb_fiber_s_new): revert initializing VM stack. + + * yarvcore.c (th_init2): ditto. + + * vm.c, vm.h: fix to stop using Qundef on VM stack. According to + this change, VM stack should not include Qundef value. + + * insns.def (putundef): removed. + + * compile.c (iseq_compile_each): ditto. + + * eval.c (eval): fix spacing. + Tue Jun 26 04:03:50 2007 Koichi Sasada <[email protected]> * insnhelper.ci (vm_yield_with_cfunc), proc.c: fix Method#to_proc @@ -2787,7 +2787,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) ADD_LABEL(ret, end_label); if (node->nd_state == Qundef) { - ADD_INSN(ret, nd_line(node), putundef); + /* ADD_INSN(ret, nd_line(node), putundef); */ + rb_bug("unsupported: putundef"); } else { ADD_INSN(ret, nd_line(node), putnil); @@ -474,7 +474,6 @@ rb_fiber_s_new(VALUE self) th->stack = 0; th->stack_size = FIBER_STACK_SIZE; th->stack = ALLOC_N(VALUE, th->stack_size); - MEMZERO(th->stack, VALUE, th->stack_size); th->cfp = (void *)(th->stack + th->stack_size); th->cfp--; @@ -1670,7 +1670,6 @@ eval(VALUE self, VALUE src, VALUE scope, const char *file, int line) VALUE iseqval; if (scope != Qnil) { - if (CLASS_OF(scope) == rb_cBinding) { GetBindingPtr(scope, bind); envval = bind->env; @@ -359,20 +359,6 @@ putself /** @c put - @e put Qundef. DO NOT USE in NORMAL RUBY PROGRAM - @j put Qundef. - */ -DEFINE_INSN -putundef -() -() -(VALUE val) -{ - val = Qundef; -} - -/** - @c put @e put some object. i.e. Fixnum, true, false, nil, and so on. @j �I�u�W�F�N�g��u���Bi.e. Fixnum, true, false, nil, and so on. @@ -190,7 +190,7 @@ vm_make_env_each(rb_thread_t *th, rb_control_frame_t *cfp, VALUE *nenvptr; int i, local_size; - if (ENV_IN_HEAP_P(envptr)) { + if (ENV_IN_HEAP_P(th, envptr)) { return ENV_VAL(envptr); } @@ -198,7 +198,7 @@ vm_make_env_each(rb_thread_t *th, rb_control_frame_t *cfp, VALUE *penvptr = GC_GUARDED_PTR_REF(*envptr); rb_control_frame_t *pcfp = cfp; - if (ENV_IN_HEAP_P(penvptr)) { + if (ENV_IN_HEAP_P(th, penvptr)) { penvval = ENV_VAL(penvptr); } else { @@ -227,7 +227,7 @@ vm_make_env_each(rb_thread_t *th, rb_control_frame_t *cfp, local_size = cfp->iseq->local_size; } - env->env_size = local_size + 1 + 4; + env->env_size = local_size + 1 + 2; env->local_size = local_size; env->env = ALLOC_N(VALUE, env->env_size); env->prev_envval = penvval; @@ -243,10 +243,8 @@ vm_make_env_each(rb_thread_t *th, rb_control_frame_t *cfp, *envptr = envval; /* GC mark */ nenvptr = &env->env[i - 1]; - nenvptr[1] = Qfalse; /* frame is not orphan */ - nenvptr[2] = Qundef; /* frame is in heap */ - nenvptr[3] = envval; /* frame self */ - nenvptr[4] = penvval; /* frame prev env object */ + nenvptr[1] = envval; /* frame self */ + nenvptr[2] = penvval; /* frame prev env object */ /* reset lfp/dfp in cfp */ cfp->dfp = nenvptr; @@ -296,7 +294,7 @@ collect_local_variables_in_env(rb_env_t *env, VALUE ary) int vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE ary) { - if (ENV_IN_HEAP_P(dfp)) { + if (ENV_IN_HEAP_P(th, dfp)) { rb_env_t *env; GetEnvPtr(ENV_VAL(dfp), env); collect_local_variables_in_env(env, ary); @@ -313,6 +311,7 @@ vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp) VALUE envval; envval = vm_make_env_each(th, cfp, cfp->dfp, cfp->lfp); + if (PROCDEBUG) { check_env_value(envval); } @@ -222,16 +222,14 @@ default: \ /* env{ env[0] // special (block or prev env) - env[1] // orphan - env[2] // in heap - env[3] // env object - env[4] // prev env val + env[1] // env object + env[2] // prev env val }; */ -#define ORPHAN_ENV_P(env) ((env)[1] == Qundef) -#define ENV_IN_HEAP_P(env) ((env)[2] == Qundef) -#define ENV_VAL(env) ((env)[3]) +#define ENV_IN_HEAP_P(th, env) \ + (!((th)->stack < (env) && (env) < ((th)->stack + (th)->stack_size))) +#define ENV_VAL(env) ((env)[1]) #define FRAME_MAGIC_METHOD 0xfaffff11 #define FRAME_MAGIC_BLOCK 0xfaffff21 diff --git a/yarvcore.c b/yarvcore.c index f5b3225a2f..2273ef81cb 100644 --- a/yarvcore.c +++ b/yarvcore.c @@ -329,7 +329,6 @@ th_init2(rb_thread_t *th) /* allocate thread stack */ th->stack_size = RUBY_VM_THREAD_STACK_SIZE; th->stack = ALLOC_N(VALUE, th->stack_size); - MEMZERO(th->stack, VALUE, th->stack_size); th->cfp = (void *)(th->stack + th->stack_size); th->cfp--; |