From bc667633d0f8f1a3a7f2cee99642e61bd824ac5c Mon Sep 17 00:00:00 2001 From: matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Tue, 27 Jul 2004 08:11:36 +0000 Subject: [PATCH] * 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 13 +++++++++++++ eval.c | 6 +++--- misc/inf-ruby.el | 20 ++++++++++++++++---- object.c | 1 + 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f4321b64f..65489783cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +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] + Mon Jul 26 11:22:55 2004 GOTOU Yuuzou <gotoyuzo@notwork.org> * lib/webrick/httputils.rb (WEBrick::HTTPUtils.escape): should diff --git a/eval.c b/eval.c index eebe1a2c61..a31ddd982f 100644 --- a/eval.c +++ b/eval.c @@ -1246,8 +1246,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); @@ -3392,6 +3390,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; @@ -4954,6 +4953,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; @@ -5617,7 +5617,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) { diff --git a/misc/inf-ruby.el b/misc/inf-ruby.el index 0dda55dfda..0a7eb76bda 100644 --- a/misc/inf-ruby.el +++ b/misc/inf-ruby.el @@ -21,7 +21,7 @@ ;;; (setq interpreter-mode-alist (append '(("ruby" . ruby-mode)) ;;; interpreter-mode-alist)) ;;; -;;; (2) set to road inf-ruby and set inf-ruby key definition in ruby-mode. +;;; (2) set to load inf-ruby and set inf-ruby key definition in ruby-mode. ;;; ;;; (autoload 'run-ruby "inf-ruby" ;;; "Run an inferior Ruby process") @@ -35,16 +35,28 @@ ;;; HISTORY ;;; senda - 8 Apr 1998: Created. ;;; $Log$ +;;; Revision 1.7 2004/07/27 08:11:36 matz +;;; * 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] +;;; ;;; Revision 1.6 2002/09/07 14:35:46 nobu ;;; * misc/inf-ruby.el (inferior-ruby-error-regexp-alist): regexp ;;; alist for error message from ruby. -;;; +;;; ;;; * misc/inf-ruby.el (inferior-ruby-mode): fixed for Emacs. -;;; +;;; ;;; * misc/inf-ruby.el (ruby-send-region): compilation-parse-errors ;;; doesn't parse first line, so insert separators before each ;;; evaluations. -;;; +;;; ;;; Revision 1.5 2002/08/19 10:05:47 nobu ;;; * misc/inf-ruby.el (inf-ruby-keys): ruby-send-definition ;;; conflicted with ruby-insert-end. diff --git a/object.c b/object.c index c3554b38f0..85241f907b 100644 --- a/object.c +++ b/object.c @@ -2611,6 +2611,7 @@ Init_Object() rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0); rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0); rb_define_method(rb_cSymbol, "to_sym", sym_to_sym, 0); + rb_define_method(rb_cSymbol, "===", rb_obj_equal, 1); rb_define_method(rb_cModule, "freeze", rb_mod_freeze, 0); rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);