diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-27 08:36:00 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-27 08:36:00 +0000 |
commit | ddc68cfb7157b807f019597d48dfda58eefe00c3 (patch) | |
tree | 6ac691b538b92e722a47f8773dedb4dad6efffca | |
parent | 561a78e54fea5635c933f50a07f098a5feadd959 (diff) |
* eval.c (rb_eval): copy on write for argument local variable
assignment.
* eval.c (assign): ditto.
* eval.c (rb_call0): update ruby_frame->argv with the default
value used for the optional arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | eval.c | 8 |
2 files changed, 12 insertions, 4 deletions
@@ -1,5 +1,13 @@ Tue Jul 27 07:05:04 2004 Yukihiro Matsumoto <matz@ruby-lang.org> + * eval.c (rb_eval): copy on write for argument local variable + assignment. + + * eval.c (assign): ditto. + + * eval.c (rb_call0): update ruby_frame->argv with the default + value used for the optional arguments. + * object.c (Init_Object): "===" calls rb_obj_equal() directly. [ruby-list:39937] @@ -1240,8 +1240,6 @@ ruby_init() Init_stack((void*)&state); Init_heap(); PUSH_SCOPE(); - ruby_scope->local_vars = 0; - ruby_scope->local_tbl = 0; top_scope = ruby_scope; /* default visibility is private at toplevel */ SCOPE_SET(SCOPE_PRIVATE); @@ -3425,6 +3423,7 @@ rb_eval(self, n) if (ruby_scope->local_vars == 0) rb_bug("unexpected local variable assignment"); result = rb_eval(self, node->nd_value); + if (node->nd_cnt < ruby_frame->argc + 2) scope_dup(ruby_scope); ruby_scope->local_vars[node->nd_cnt] = result; break; @@ -4963,6 +4962,7 @@ assign(self, lhs, val, pcall) case NODE_LASGN: if (ruby_scope->local_vars == 0) rb_bug("unexpected local variable assignment"); + if (lhs->nd_cnt < ruby_frame->argc + 2) scope_dup(ruby_scope); ruby_scope->local_vars[lhs->nd_cnt] = val; break; @@ -5630,7 +5630,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper) if (local_vars) { if (i > 0) { /* +2 for $_ and $~ */ - MEMCPY(local_vars+2, argv, VALUE, i); + MEMCPY(local_vars+2, argv, VALUE, ruby_frame->argc); } argv += i; argc -= i; if (node->nd_opt) { @@ -5645,7 +5645,6 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper) rb_eval(recv, opt); } } - local_vars = ruby_scope->local_vars; if ((int)node->nd_rest >= 0) { VALUE v; @@ -5655,6 +5654,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper) v = rb_ary_new2(0); ruby_scope->local_vars[node->nd_rest] = v; } + ruby_frame->argv = ruby_scope->local_vars + 2; } } |