summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-26 06:14:44 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-26 06:14:44 +0000
commit931574010102b4bd9db6cfb17b840e28b26030e6 (patch)
tree39b4acd08cfce1f46c50c6d8409c0b22a248f7c0
parent8bfcdf323f1843237140e9f119496b93557eaefd (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--ChangeLog15
-rw-r--r--compile.c3
-rw-r--r--cont.c1
-rw-r--r--eval.c1
-rw-r--r--insns.def14
-rw-r--r--vm.c15
-rw-r--r--vm.h12
-rw-r--r--yarvcore.c1
8 files changed, 29 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index 0879053a4a..0843d2a729 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Tue Jun 26 15:04:06 2007 Koichi Sasada <ko1@atdot.net>
+
+ * 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 <ko1@atdot.net>
* insnhelper.ci (vm_yield_with_cfunc), proc.c: fix Method#to_proc
diff --git a/compile.c b/compile.c
index a56962468b..ab2bbab857 100644
--- a/compile.c
+++ b/compile.c
@@ -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);
diff --git a/cont.c b/cont.c
index f75ddf1602..e06708f9c3 100644
--- a/cont.c
+++ b/cont.c
@@ -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--;
diff --git a/eval.c b/eval.c
index 68c3721a08..48d6449404 100644
--- a/eval.c
+++ b/eval.c
@@ -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;
diff --git a/insns.def b/insns.def
index ea4afc39e9..9e8ceb49cd 100644
--- a/insns.def
+++ b/insns.def
@@ -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.e. Fixnum, true, false, nil, and so on.
diff --git a/vm.c b/vm.c
index 6fe5cdcb8b..378f3ad8b5 100644
--- a/vm.c
+++ b/vm.c
@@ -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);
}
diff --git a/vm.h b/vm.h
index e3e5ddd8c2..b3e311cb0f 100644
--- a/vm.h
+++ b/vm.h
@@ -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--;