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

ruby-changes:27256

From: ko1 <ko1@a...>
Date: Tue, 19 Feb 2013 08:53:55 +0900 (JST)
Subject: [ruby-changes:27256] ko1:r39308 (trunk): * vm_eval.c (vm_call0_body): check interrupts after method dispatch

ko1	2013-02-19 08:53:41 +0900 (Tue, 19 Feb 2013)

  New Revision: 39308

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

  Log:
    * vm_eval.c (vm_call0_body): check interrupts after method dispatch
      from C methods. [Bug #7878]

  Modified files:
    trunk/ChangeLog
    trunk/vm_eval.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39307)
+++ ChangeLog	(revision 39308)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Feb 19 08:32:11 2013  Koichi Sasada  <ko1@a...>
+
+	* vm_eval.c (vm_call0_body): check interrupts after method dispatch
+	  from C methods. [Bug #7878]
+
 Tue Feb 19 08:14:40 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/rubygems/installer.rb:  Fixed placement of executables with
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 39307)
+++ vm_eval.c	(revision 39308)
@@ -139,6 +139,8 @@ vm_call0_cfunc(rb_thread_t* th, rb_call_ https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L139
 static VALUE
 vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
 {
+    VALUE ret;
+
     if (!ci->me->def) return Qnil;
 
     if (th->passed_block) {
@@ -165,19 +167,23 @@ vm_call0_body(rb_thread_t* th, rb_call_i https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L167
 
 	    vm_call_iseq_setup(th, reg_cfp, ci);
 	    th->cfp->flag |= VM_FRAME_FLAG_FINISH;
-	    return vm_exec(th);
+	    return vm_exec(th); /* CHECK_INTS in this function */
 	}
       case VM_METHOD_TYPE_NOTIMPLEMENTED:
       case VM_METHOD_TYPE_CFUNC:
-	return vm_call0_cfunc(th, ci, argv);
+	ret = vm_call0_cfunc(th, ci, argv);
+	goto success;
       case VM_METHOD_TYPE_ATTRSET:
 	rb_check_arity(ci->argc, 1, 1);
-	return rb_ivar_set(ci->recv, ci->me->def->body.attr.id, argv[0]);
+	ret = rb_ivar_set(ci->recv, ci->me->def->body.attr.id, argv[0]);
+	goto success;
       case VM_METHOD_TYPE_IVAR:
 	rb_check_arity(ci->argc, 0, 0);
-	return rb_attr_get(ci->recv, ci->me->def->body.attr.id);
+	ret = rb_attr_get(ci->recv, ci->me->def->body.attr.id);
+	goto success;
       case VM_METHOD_TYPE_BMETHOD:
-	return vm_call_bmethod_body(th, ci, argv);
+	ret = vm_call_bmethod_body(th, ci, argv);
+	goto success;
       case VM_METHOD_TYPE_ZSUPER:
       case VM_METHOD_TYPE_REFINED:
 	{
@@ -190,7 +196,8 @@ vm_call0_body(rb_thread_t* th, rb_call_i https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L196
 	    ci->defined_class = RCLASS_SUPER(ci->defined_class);
 
 	    if (!ci->defined_class || !(ci->me = rb_method_entry(ci->defined_class, ci->mid, &ci->defined_class))) {
-		return method_missing(ci->recv, ci->mid, ci->argc, argv, NOEX_SUPER);
+		ret = method_missing(ci->recv, ci->mid, ci->argc, argv, NOEX_SUPER);
+		goto success;
 	    }
 	    RUBY_VM_CHECK_INTS(th);
 	    if (!ci->me->def) return Qnil;
@@ -208,12 +215,14 @@ vm_call0_body(rb_thread_t* th, rb_call_i https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L215
       case VM_METHOD_TYPE_OPTIMIZED:
 	switch (ci->me->def->body.optimize_type) {
 	  case OPTIMIZED_METHOD_TYPE_SEND:
-	    return send_internal(ci->argc, argv, ci->recv, CALL_FCALL);
+	    ret = send_internal(ci->argc, argv, ci->recv, CALL_FCALL);
+	    goto success;
 	  case OPTIMIZED_METHOD_TYPE_CALL:
 	    {
 		rb_proc_t *proc;
 		GetProcPtr(ci->recv, proc);
-		return rb_vm_invoke_proc(th, proc, ci->argc, argv, ci->blockptr);
+		ret = rb_vm_invoke_proc(th, proc, ci->argc, argv, ci->blockptr);
+		goto success;
 	    }
 	  default:
 	    rb_bug("vm_call0: unsupported optimized method type (%d)", ci->me->def->body.optimize_type);
@@ -224,6 +233,10 @@ vm_call0_body(rb_thread_t* th, rb_call_i https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L233
     }
     rb_bug("vm_call0: unsupported method type (%d)", ci->me->def->type);
     return Qundef;
+
+  success:
+    RUBY_VM_CHECK_INTS(th);
+    return ret;
 }
 
 VALUE

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

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