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

ruby-changes:26274

From: nobu <ko1@a...>
Date: Wed, 12 Dec 2012 03:45:54 +0900 (JST)
Subject: [ruby-changes:26274] nobu:r38331 (trunk): vm.c: pass exceptions while handling an exception

nobu	2012-12-12 03:45:43 +0900 (Wed, 12 Dec 2012)

  New Revision: 38331

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38331

  Log:
    vm.c: pass exceptions while handling an exception
    
    * vm.c (vm_exec): pass exceptions while handling an exception.
    * vm_trace.c (rb_threadptr_exec_event_hooks): propagate exceptions.
      revert r38293 partially.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_settracefunc.rb
    trunk/vm.c
    trunk/vm_trace.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38330)
+++ ChangeLog	(revision 38331)
@@ -1,3 +1,10 @@
+Wed Dec 12 03:45:41 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm.c (vm_exec): pass exceptions while handling an exception.
+
+	* vm_trace.c (rb_threadptr_exec_event_hooks): propagate exceptions.
+	  revert r38293 partially.
+
 Wed Dec 12 03:09:05 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* sample/test.rb (Progress#initialize): add --verbose option and show
Index: vm_trace.c
===================================================================
--- vm_trace.c	(revision 38330)
+++ vm_trace.c	(revision 38331)
@@ -309,11 +309,15 @@
 		state = exec_hooks(th, list, targ, !vm_tracing);
 		if (state) goto terminate;
 	    }
+	    th->errinfo = errinfo;
 	}
       terminate:
-	th->errinfo = errinfo;
 	th->trace_running = 0;
 	th->vm->trace_running = vm_tracing;
+
+	if (state) {
+	    TH_JUMP_TAG(th, state);
+	}
 	th->state = outer_state;
     }
 }
Index: vm.c
===================================================================
--- vm.c	(revision 38330)
+++ vm.c	(revision 38331)
@@ -1162,6 +1162,7 @@
     _tag.retval = Qnil;
     if ((state = EXEC_TAG()) == 0) {
       vm_loop_start:
+	_th->tag = &_tag;
 	result = vm_exec_core(th, initial);
 	if ((state = th->state) != 0) {
 	    err = result;
@@ -1180,6 +1181,7 @@
 	err = th->errinfo;
 
       exception_handler:
+	TH_POP_TAG2();
 	cont_pc = cont_sp = catch_iseqval = 0;
 
 	while (th->cfp->pc == 0 || th->cfp->iseq == 0) {
@@ -1373,7 +1375,6 @@
 	    if (VM_FRAME_TYPE_FINISH_P(th->cfp)) {
 		vm_pop_frame(th);
 		th->errinfo = err;
-		TH_POP_TAG2();
 		JUMP_TAG(state);
 	    }
 	    else {
Index: test/ruby/test_settracefunc.rb
===================================================================
--- test/ruby/test_settracefunc.rb	(revision 38330)
+++ test/ruby/test_settracefunc.rb	(revision 38331)
@@ -801,7 +801,7 @@
   end
 
   def test_tracepoint_exception_at_line
-    assert_nothing_raised do
+    assert_raise(RuntimeError) do
       TracePoint.new(:line) {raise}.enable {
         1
       }

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

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