git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-08-31 08:08:39 +00:00
parent 0ccc0fad33
commit c3262595ab
3 changed files with 16 additions and 14 deletions

View File

@ -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. * 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> 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 * parse.y (stmt): allow stmt_rhs to be right hand side of multiple

1
env.h
View File

@ -43,6 +43,7 @@ extern struct SCOPE {
#define SCOPE_ALLOCA 0 #define SCOPE_ALLOCA 0
#define SCOPE_MALLOC 1 #define SCOPE_MALLOC 1
#define SCOPE_NOSTACK 2 #define SCOPE_NOSTACK 2
#define SCOPE_DONT_RECYCLE 4
extern int ruby_in_eval; extern int ruby_in_eval;

23
eval.c
View File

@ -794,10 +794,9 @@ static VALUE ruby_wrapper; /* security wrapper */
typedef struct thread * rb_thread_t; typedef struct thread * rb_thread_t;
static rb_thread_t curr_thread = 0; static rb_thread_t curr_thread = 0;
#define SCOPE_DONT_RECYCLE FL_USER2
#define POP_SCOPE() \ #define POP_SCOPE() \
if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) {\ if (ruby_scope->flag & SCOPE_DONT_RECYCLE) {\
FL_SET(_old, SCOPE_DONT_RECYCLE);\ if (_old) _old->flag |= SCOPE_DONT_RECYCLE;\
} \ } \
else { \ else { \
if (ruby_scope->flag == SCOPE_ALLOCA) {\ if (ruby_scope->flag == SCOPE_ALLOCA) {\
@ -1255,8 +1254,8 @@ rb_eval_cmd(cmd, arg)
val = eval(ruby_top_self, cmd, Qnil, 0, 0); val = eval(ruby_top_self, cmd, Qnil, 0, 0);
} }
if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
FL_SET(saved_scope, SCOPE_DONT_RECYCLE); saved_scope->flag |= SCOPE_DONT_RECYCLE;
ruby_scope = saved_scope; ruby_scope = saved_scope;
ruby_safe_level = safe; ruby_safe_level = safe;
POP_TAG(); POP_TAG();
@ -3488,8 +3487,8 @@ rb_yield_0(val, self, klass, acheck)
POP_VARS(); POP_VARS();
ruby_block = block; ruby_block = block;
ruby_frame = ruby_frame->prev; ruby_frame = ruby_frame->prev;
if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
FL_SET(old_scope, SCOPE_DONT_RECYCLE); old_scope->flag |= SCOPE_DONT_RECYCLE;
ruby_scope = old_scope; ruby_scope = old_scope;
if (state) JUMP_TAG(state); if (state) JUMP_TAG(state);
return result; return result;
@ -4626,8 +4625,8 @@ eval(self, src, scope, file, line)
ruby_in_eval--; ruby_in_eval--;
if (!NIL_P(scope)) { if (!NIL_P(scope)) {
ruby_frame = frame.tmp; ruby_frame = frame.tmp;
if (FL_TEST(ruby_scope, SCOPE_DONT_RECYCLE)) if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
FL_SET(old_scope, SCOPE_DONT_RECYCLE); old_scope->flag |= SCOPE_DONT_RECYCLE;
ruby_scope = old_scope; ruby_scope = old_scope;
ruby_block = old_block; ruby_block = old_block;
ruby_dyna_vars = old_d_vars; ruby_dyna_vars = old_d_vars;
@ -5688,6 +5687,7 @@ scope_dup(scope)
ID *tbl; ID *tbl;
VALUE *vars; VALUE *vars;
scope->flag |= SCOPE_DONT_RECYCLE;
if (scope->flag & SCOPE_MALLOC) return; if (scope->flag & SCOPE_MALLOC) return;
if (scope->local_tbl) { if (scope->local_tbl) {
@ -5698,9 +5698,6 @@ scope_dup(scope)
scope->local_vars = vars; scope->local_vars = vars;
scope->flag = SCOPE_MALLOC; scope->flag = SCOPE_MALLOC;
} }
else {
scope->flag = SCOPE_NOSTACK;
}
} }
static void static void
@ -8146,7 +8143,7 @@ rb_callcc(self)
cont = Data_Wrap_Struct(rb_cCont, thread_mark, cont = Data_Wrap_Struct(rb_cCont, thread_mark,
thread_free, th); thread_free, th);
FL_SET(ruby_scope, SCOPE_DONT_RECYCLE); ruby_scope->flag |= SCOPE_DONT_RECYCLE;
for (tag=prot_tag; tag; tag=tag->prev) { for (tag=prot_tag; tag; tag=tag->prev) {
scope_dup(tag->scope); scope_dup(tag->scope);
} }