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

ruby-changes:46908

From: ko1 <ko1@a...>
Date: Tue, 6 Jun 2017 15:58:59 +0900 (JST)
Subject: [ruby-changes:46908] ko1:r59023 (trunk): revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.

ko1	2017-06-06 15:58:54 +0900 (Tue, 06 Jun 2017)

  New Revision: 59023

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59023

  Log:
    revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.

  Modified files:
    trunk/test/ruby/test_io.rb
    trunk/thread.c
    trunk/vm.c
    trunk/vm_core.h
Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 59022)
+++ test/ruby/test_io.rb	(revision 59023)
@@ -2823,28 +2823,6 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2823
     end;
   end
 
-  def test_single_exception_on_close
-    a = []
-    t = []
-    10.times do
-      r, w = IO.pipe
-      a << [r, w]
-      t << Thread.new do
-        while r.gets
-        end rescue IOError
-        Thread.current.pending_interrupt?
-      end
-    end
-    a.each do |r, w|
-      w.write -"\n"
-      w.close
-      r.close
-    end
-    t.each do |th|
-      assert_equal false, th.value, '[ruby-core:81581] [Bug #13632]'
-    end
-  end
-
   def test_open_mode
     feature4742 = "[ruby-core:36338]"
     bug6055 = '[ruby-dev:45268]'
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 59022)
+++ vm_core.h	(revision 59023)
@@ -1007,6 +1007,7 @@ enum { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1007
     VM_FRAME_FLAG_BMETHOD   = 0x0040,
     VM_FRAME_FLAG_CFRAME    = 0x0080,
     VM_FRAME_FLAG_LAMBDA    = 0x0100,
+    VM_FRAME_FLAG_PROC      = 0x0200,
 
     /* env flag */
     VM_ENV_FLAG_LOCAL       = 0x0002,
Index: thread.c
===================================================================
--- thread.c	(revision 59022)
+++ thread.c	(revision 59023)
@@ -2213,8 +2213,6 @@ rb_notify_fd_close(int fd) https://github.com/ruby/ruby/blob/trunk/thread.c#L2213
 	if (wfd->fd == fd) {
 	    rb_thread_t *th = wfd->th;
 	    VALUE err = th->vm->special_exceptions[ruby_error_stream_closed];
-
-	    wfd->fd = -1; /* ensure we only enqueue once */
 	    rb_threadptr_pending_interrupt_enque(th, err);
 	    rb_threadptr_interrupt(th);
 	    busy = 1;
Index: vm.c
===================================================================
--- vm.c	(revision 59022)
+++ vm.c	(revision 59023)
@@ -1004,11 +1004,11 @@ invoke_bmethod(rb_thread_t *th, const rb https://github.com/ruby/ruby/blob/trunk/vm.c#L1004
 static inline VALUE
 invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captured,
 			 VALUE self, int argc, const VALUE *argv, VALUE passed_block_handler,
-			 const rb_cref_t *cref, int is_lambda)
+			 const rb_cref_t *cref, VALUE additional_type)
 {
     const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
     int i, opt_pc;
-    VALUE type = VM_FRAME_MAGIC_BLOCK | (is_lambda ? VM_FRAME_FLAG_LAMBDA : 0);
+    VALUE type = VM_FRAME_MAGIC_BLOCK | additional_type;
     rb_control_frame_t *cfp = th->ec.cfp;
     VALUE *sp = cfp->sp;
     const rb_callable_method_entry_t *me = th->passed_bmethod_me;
@@ -1021,7 +1021,7 @@ invoke_iseq_block_from_c(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm.c#L1021
     }
 
     opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
-				 (is_lambda ? arg_setup_method : arg_setup_block));
+				 ((type & VM_FRAME_FLAG_LAMBDA) ? arg_setup_method : arg_setup_block));
     cfp->sp = sp;
 
     if (me == NULL) {
@@ -1038,6 +1038,8 @@ invoke_block_from_c_bh(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L1038
 		       VALUE passed_block_handler, const rb_cref_t *cref,
 		       int is_lambda, int force_blockarg)
 {
+    VALUE additional_type = is_lambda ? VM_FRAME_FLAG_LAMBDA : 0;
+
   again:
     switch (vm_block_handler_type(block_handler)) {
       case block_handler_type_iseq:
@@ -1045,7 +1047,7 @@ invoke_block_from_c_bh(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L1047
 	    const struct rb_captured_block *captured = VM_BH_TO_ISEQ_BLOCK(block_handler);
 	    return invoke_iseq_block_from_c(th, captured, captured->self,
 					    argc, argv, passed_block_handler,
-					    cref, is_lambda);
+					    cref, additional_type);
 	}
       case block_handler_type_ifunc:
 	return vm_yield_with_cfunc(th, VM_BH_TO_IFUNC_BLOCK(block_handler),
@@ -1055,8 +1057,11 @@ invoke_block_from_c_bh(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm.c#L1057
 	return vm_yield_with_symbol(th, VM_BH_TO_SYMBOL(block_handler),
 				    argc, argv, passed_block_handler);
       case block_handler_type_proc:
-	if (force_blockarg == FALSE) {
-	    is_lambda = block_proc_is_lambda(VM_BH_TO_PROC(block_handler));
+	if (force_blockarg == FALSE && block_proc_is_lambda(VM_BH_TO_PROC(block_handler))) {
+	    additional_type = VM_FRAME_FLAG_LAMBDA;
+	}
+	else {
+	    additional_type = VM_FRAME_FLAG_PROC;
 	}
 	block_handler = vm_proc_to_block_handler(VM_BH_TO_PROC(block_handler));
 	goto again;
@@ -1114,17 +1119,23 @@ invoke_block_from_c_proc(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/vm.c#L1119
 			 VALUE passed_block_handler, int is_lambda)
 {
     const struct rb_block *block = &proc->block;
+    VALUE additional_type = is_lambda ? VM_FRAME_FLAG_LAMBDA : VM_FRAME_FLAG_PROC;
 
   again:
     switch (vm_block_type(block)) {
       case block_type_iseq:
-	return invoke_iseq_block_from_c(th, &block->as.captured, self, argc, argv, passed_block_handler, NULL, is_lambda);
+	return invoke_iseq_block_from_c(th, &block->as.captured, self, argc, argv, passed_block_handler, NULL, additional_type);
       case block_type_ifunc:
 	return vm_yield_with_cfunc(th, &block->as.captured, self, argc, argv, passed_block_handler);
       case block_type_symbol:
 	return vm_yield_with_symbol(th, block->as.symbol, argc, argv, passed_block_handler);
       case block_type_proc:
-	is_lambda = block_proc_is_lambda(block->as.proc);
+	if (block_proc_is_lambda(block->as.proc)) {
+	    additional_type = VM_FRAME_FLAG_LAMBDA;
+	}
+	else {
+	    additional_type = VM_FRAME_FLAG_PROC;
+	}
 	block = vm_proc_block(block->as.proc);
 	goto again;
     }

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

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