summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--env.h1
-rw-r--r--eval.c23
3 files changed, 16 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 655cd44466a..d867fe2f59d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
-Thu Aug 31 14:28:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+Thu Aug 31 17:06:09 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* stable version 1.6.0 released.
+Thu Aug 31 14:28:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (scope_dup): should not make all duped scope orphan.
+
Thu Aug 31 10:11:47 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (stmt): allow stmt_rhs to be right hand side of multiple
diff --git a/env.h b/env.h
index 3669baa33e6..7060fbec8ff 100644
--- a/env.h
+++ b/env.h
@@ -43,6 +43,7 @@ extern struct SCOPE {
#define SCOPE_ALLOCA 0
#define SCOPE_MALLOC 1
#define SCOPE_NOSTACK 2
+#define SCOPE_DONT_RECYCLE 4
extern int ruby_in_eval;
diff --git a/eval.c b/eval.c
index 12cfd734b88..f260bae51cc 100644
--- a/eval.c
+++ b/eval.c
@@ -794,10 +794,9 @@ static VALUE ruby_wrapper; /* security wrapper */
typedef struct thread * rb_thread_t;
static rb_thread_t curr_thread = 0;
-#define SCOPE_DONT_RECYCLE FL_USER2
#define POP_SCOPE() \
- if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) {\
- FL_SET(_old, SCOPE_DONT_RECYCLE);\
+ if (ruby_scope->flag & SCOPE_DONT_RECYCLE) {\
+ if (_old) _old->flag |= SCOPE_DONT_RECYCLE;\
} \
else { \
if (ruby_scope->flag == SCOPE_ALLOCA) {\
@@ -1255,8 +1254,8 @@ rb_eval_cmd(cmd, arg)
val = eval(ruby_top_self, cmd, Qnil, 0, 0);
}
- if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE))
- FL_SET(saved_scope, SCOPE_DONT_RECYCLE);
+ if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
+ saved_scope->flag |= SCOPE_DONT_RECYCLE;
ruby_scope = saved_scope;
ruby_safe_level = safe;
POP_TAG();
@@ -3488,8 +3487,8 @@ rb_yield_0(val, self, klass, acheck)
POP_VARS();
ruby_block = block;
ruby_frame = ruby_frame->prev;
- if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE))
- FL_SET(old_scope, SCOPE_DONT_RECYCLE);
+ if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
+ old_scope->flag |= SCOPE_DONT_RECYCLE;
ruby_scope = old_scope;
if (state) JUMP_TAG(state);
return result;
@@ -4626,8 +4625,8 @@ eval(self, src, scope, file, line)
ruby_in_eval--;
if (!NIL_P(scope)) {
ruby_frame = frame.tmp;
- if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE))
- FL_SET(old_scope, SCOPE_DONT_RECYCLE);
+ if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
+ old_scope->flag |= SCOPE_DONT_RECYCLE;
ruby_scope = old_scope;
ruby_block = old_block;
ruby_dyna_vars = old_d_vars;
@@ -5688,6 +5687,7 @@ scope_dup(scope)
ID *tbl;
VALUE *vars;
+ scope->flag |= SCOPE_DONT_RECYCLE;
if (scope->flag & SCOPE_MALLOC) return;
if (scope->local_tbl) {
@@ -5698,9 +5698,6 @@ scope_dup(scope)
scope->local_vars = vars;
scope->flag = SCOPE_MALLOC;
}
- else {
- scope->flag = SCOPE_NOSTACK;
- }
}
static void
@@ -8146,7 +8143,7 @@ rb_callcc(self)
cont = Data_Wrap_Struct(rb_cCont, thread_mark,
thread_free, th);
- FL_SET(ruby_scope, SCOPE_DONT_RECYCLE);
+ ruby_scope->flag |= SCOPE_DONT_RECYCLE;
for (tag=prot_tag; tag; tag=tag->prev) {
scope_dup(tag->scope);
}