[前][次][番号順一覧][スレッド一覧]

ruby-changes:3149

From: ko1@a...
Date: 25 Dec 2007 11:15:13 +0900
Subject: [ruby-changes:3149] ko1 - Ruby:r14641 (trunk): * vm.c: check frame is FINAL when creating env.

ko1	2007-12-25 11:14:36 +0900 (Tue, 25 Dec 2007)

  New Revision: 14641

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/test_block.rb
    trunk/vm.c

  Log:
    * vm.c: check frame is FINAL when creating env.
      [ruby-core:14395]
    * bootstraptest/test_block.rb: add a test for above.
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_block.rb?r1=14641&r2=14640
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14641&r2=14640
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm.c?r1=14641&r2=14640

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14640)
+++ ChangeLog	(revision 14641)
@@ -1,3 +1,10 @@
+Tue Dec 25 11:02:10 2007  Koichi Sasada  <ko1@a...>
+
+	* vm.c: check frame is FINAL when creating env.
+	  [ruby-core:14395]
+
+	* bootstraptest/test_block.rb: add a test for above.
+
 Tue Dec 25 09:12:13 2007  Eric Hodel  <drbrain@s...>
 
 	* lib/rdoc/:  Enable RDoc debugging only with $DEBUG_RDOC.
Index: bootstraptest/test_block.rb
===================================================================
--- bootstraptest/test_block.rb	(revision 14640)
+++ bootstraptest/test_block.rb	(revision 14641)
@@ -507,3 +507,43 @@
   end
   foo(&:bar)
 }, '[ruby-core:14279]'
+
+assert_normal_exit %q{
+  class Controller
+    def respond_to(&block)
+      responder = Responder.new
+      block.call(responder)
+      responder.respond
+    end
+    def test_for_bug
+      respond_to{|format|
+        format.js{
+          puts "in test"
+          render{|obj|
+            puts obj
+          }
+        }
+      }
+    end
+    def render(&block)
+      puts "in render"
+    end
+  end
+
+  class Responder
+    def method_missing(symbol, &block)
+      puts "enter method_missing"
+      @response = Proc.new{
+        puts 'in method missing'
+        block.call
+      }
+      puts "leave method_missing"
+    end
+    def respond
+      @response.call
+    end
+  end
+  t = Controller.new
+  t.test_for_bug
+}, '[ruby-core:14395]'
+
Index: vm.c
===================================================================
--- vm.c	(revision 14640)
+++ vm.c	(revision 14641)
@@ -238,7 +238,7 @@
     for (i = 0; i <= local_size; i++) {
 	env->env[i] = envptr[-local_size + i];
 #if 0
-	dp(env->env[i]);
+	fprintf(stderr, "%2d ", &envptr[-local_size + i] - th->stack); dp(env->env[i]);
 	if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) {
 	    /* clear value stack for GC */
 	    envptr[-local_size + i] = 0;
@@ -315,6 +315,11 @@
 {
     VALUE envval;
 
+    if (VM_FRAME_FLAG(cfp->flag) == FRAME_MAGIC_FINISH) {
+	/* for method_missing */
+	cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
+    }
+
     envval = vm_make_env_each(th, cfp, cfp->dfp, cfp->lfp);
 
     if (PROCDEBUG) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]