summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-06 06:58:54 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-06 06:58:54 +0000
commitb0c9215f72c571c095bf82c4233af6ff848d48d2 (patch)
tree374b89ec860447f7d737eef386da65bac2800063
parent4529948edd67b88722ca39edbceb7da9042a0869 (diff)
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_io.rb22
-rw-r--r--thread.c2
-rw-r--r--vm.c27
-rw-r--r--vm_core.h1
4 files changed, 20 insertions, 32 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 791e52b500..2cd60a4fca 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2823,28 +2823,6 @@ __END__
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]'
diff --git a/thread.c b/thread.c
index 42159b3c19..da834974bd 100644
--- a/thread.c
+++ b/thread.c
@@ -2213,8 +2213,6 @@ rb_notify_fd_close(int fd)
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;
diff --git a/vm.c b/vm.c
index 33be0723fa..e2bb1d3ce2 100644
--- a/vm.c
+++ b/vm.c
@@ -1004,11 +1004,11 @@ invoke_bmethod(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const struct
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, const struct rb_captured_block *captur
}
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, VALUE block_handler,
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, VALUE block_handler,
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, VALUE block_handler,
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, const rb_proc_t *proc,
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;
}
diff --git a/vm_core.h b/vm_core.h
index a55942e290..9757147f6d 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1007,6 +1007,7 @@ enum {
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,