Skip to content

Commit b0c9215

Browse files
committed
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
1 parent 4529948 commit b0c9215

File tree

4 files changed

+20
-32
lines changed

4 files changed

+20
-32
lines changed

test/ruby/test_io.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,28 +2823,6 @@ def test_cross_thread_close_stdio
28232823
end;
28242824
end
28252825

2826-
def test_single_exception_on_close
2827-
a = []
2828-
t = []
2829-
10.times do
2830-
r, w = IO.pipe
2831-
a << [r, w]
2832-
t << Thread.new do
2833-
while r.gets
2834-
end rescue IOError
2835-
Thread.current.pending_interrupt?
2836-
end
2837-
end
2838-
a.each do |r, w|
2839-
w.write -"\n"
2840-
w.close
2841-
r.close
2842-
end
2843-
t.each do |th|
2844-
assert_equal false, th.value, '[ruby-core:81581] [Bug #13632]'
2845-
end
2846-
end
2847-
28482826
def test_open_mode
28492827
feature4742 = "[ruby-core:36338]"
28502828
bug6055 = '[ruby-dev:45268]'

thread.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,8 +2213,6 @@ rb_notify_fd_close(int fd)
22132213
if (wfd->fd == fd) {
22142214
rb_thread_t *th = wfd->th;
22152215
VALUE err = th->vm->special_exceptions[ruby_error_stream_closed];
2216-
2217-
wfd->fd = -1; /* ensure we only enqueue once */
22182216
rb_threadptr_pending_interrupt_enque(th, err);
22192217
rb_threadptr_interrupt(th);
22202218
busy = 1;

vm.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,11 +1004,11 @@ invoke_bmethod(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const struct
10041004
static inline VALUE
10051005
invoke_iseq_block_from_c(rb_thread_t *th, const struct rb_captured_block *captured,
10061006
VALUE self, int argc, const VALUE *argv, VALUE passed_block_handler,
1007-
const rb_cref_t *cref, int is_lambda)
1007+
const rb_cref_t *cref, VALUE additional_type)
10081008
{
10091009
const rb_iseq_t *iseq = rb_iseq_check(captured->code.iseq);
10101010
int i, opt_pc;
1011-
VALUE type = VM_FRAME_MAGIC_BLOCK | (is_lambda ? VM_FRAME_FLAG_LAMBDA : 0);
1011+
VALUE type = VM_FRAME_MAGIC_BLOCK | additional_type;
10121012
rb_control_frame_t *cfp = th->ec.cfp;
10131013
VALUE *sp = cfp->sp;
10141014
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
10211021
}
10221022

10231023
opt_pc = vm_yield_setup_args(th, iseq, argc, sp, passed_block_handler,
1024-
(is_lambda ? arg_setup_method : arg_setup_block));
1024+
((type & VM_FRAME_FLAG_LAMBDA) ? arg_setup_method : arg_setup_block));
10251025
cfp->sp = sp;
10261026

10271027
if (me == NULL) {
@@ -1038,14 +1038,16 @@ invoke_block_from_c_bh(rb_thread_t *th, VALUE block_handler,
10381038
VALUE passed_block_handler, const rb_cref_t *cref,
10391039
int is_lambda, int force_blockarg)
10401040
{
1041+
VALUE additional_type = is_lambda ? VM_FRAME_FLAG_LAMBDA : 0;
1042+
10411043
again:
10421044
switch (vm_block_handler_type(block_handler)) {
10431045
case block_handler_type_iseq:
10441046
{
10451047
const struct rb_captured_block *captured = VM_BH_TO_ISEQ_BLOCK(block_handler);
10461048
return invoke_iseq_block_from_c(th, captured, captured->self,
10471049
argc, argv, passed_block_handler,
1048-
cref, is_lambda);
1050+
cref, additional_type);
10491051
}
10501052
case block_handler_type_ifunc:
10511053
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,
10551057
return vm_yield_with_symbol(th, VM_BH_TO_SYMBOL(block_handler),
10561058
argc, argv, passed_block_handler);
10571059
case block_handler_type_proc:
1058-
if (force_blockarg == FALSE) {
1059-
is_lambda = block_proc_is_lambda(VM_BH_TO_PROC(block_handler));
1060+
if (force_blockarg == FALSE && block_proc_is_lambda(VM_BH_TO_PROC(block_handler))) {
1061+
additional_type = VM_FRAME_FLAG_LAMBDA;
1062+
}
1063+
else {
1064+
additional_type = VM_FRAME_FLAG_PROC;
10601065
}
10611066
block_handler = vm_proc_to_block_handler(VM_BH_TO_PROC(block_handler));
10621067
goto again;
@@ -1114,17 +1119,23 @@ invoke_block_from_c_proc(rb_thread_t *th, const rb_proc_t *proc,
11141119
VALUE passed_block_handler, int is_lambda)
11151120
{
11161121
const struct rb_block *block = &proc->block;
1122+
VALUE additional_type = is_lambda ? VM_FRAME_FLAG_LAMBDA : VM_FRAME_FLAG_PROC;
11171123

11181124
again:
11191125
switch (vm_block_type(block)) {
11201126
case block_type_iseq:
1121-
return invoke_iseq_block_from_c(th, &block->as.captured, self, argc, argv, passed_block_handler, NULL, is_lambda);
1127+
return invoke_iseq_block_from_c(th, &block->as.captured, self, argc, argv, passed_block_handler, NULL, additional_type);
11221128
case block_type_ifunc:
11231129
return vm_yield_with_cfunc(th, &block->as.captured, self, argc, argv, passed_block_handler);
11241130
case block_type_symbol:
11251131
return vm_yield_with_symbol(th, block->as.symbol, argc, argv, passed_block_handler);
11261132
case block_type_proc:
1127-
is_lambda = block_proc_is_lambda(block->as.proc);
1133+
if (block_proc_is_lambda(block->as.proc)) {
1134+
additional_type = VM_FRAME_FLAG_LAMBDA;
1135+
}
1136+
else {
1137+
additional_type = VM_FRAME_FLAG_PROC;
1138+
}
11281139
block = vm_proc_block(block->as.proc);
11291140
goto again;
11301141
}

vm_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ enum {
10071007
VM_FRAME_FLAG_BMETHOD = 0x0040,
10081008
VM_FRAME_FLAG_CFRAME = 0x0080,
10091009
VM_FRAME_FLAG_LAMBDA = 0x0100,
1010+
VM_FRAME_FLAG_PROC = 0x0200,
10101011

10111012
/* env flag */
10121013
VM_ENV_FLAG_LOCAL = 0x0002,

0 commit comments

Comments
 (0)