1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm.c (vm_exec): reset thread state before starting vm loop.

[ruby-core:28129]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-02-09 19:06:39 +00:00
parent 520053232e
commit 09205cf2c3
3 changed files with 28 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Wed Feb 10 04:06:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm.c (vm_exec): reset thread state before starting vm loop.
[ruby-core:28129]
Tue Feb 9 23:48:25 2010 Yusuke Endoh <mame@tsg.ne.jp> Tue Feb 9 23:48:25 2010 Yusuke Endoh <mame@tsg.ne.jp>
* ext/bigdecimal/bigdecimal.c (BigDecimal_divide): fix precision too. * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): fix precision too.

View file

@ -502,3 +502,24 @@ assert_equal %Q{ENSURE\n}, %q{
test test
}, '[ruby-dev:37967]' }, '[ruby-dev:37967]'
[['[ruby-core:28129]', %q{
class Bug2728
include Enumerable
define_method(:dynamic_method) do
"dynamically defined method"
end
def each
begin
yield :foo
ensure
dynamic_method
end
end
end
e = Bug2728.new
}]].each do |bug, src|
assert_equal "foo", src + %q{e.detect {true}}, bug
assert_equal "true", src + %q{e.any? {true}}, bug
assert_equal "false", src + %q{e.all? {false}}, bug
assert_equal "true", src + %q{e.include?(:foo)}, bug
end

7
vm.c
View file

@ -1121,6 +1121,8 @@ vm_exec(rb_thread_t *th)
_tag.retval = Qnil; _tag.retval = Qnil;
if ((state = EXEC_TAG()) == 0) { if ((state = EXEC_TAG()) == 0) {
vm_loop_start: vm_loop_start:
th->state = 0;
th->errinfo = Qnil;
result = vm_exec_core(th, initial); result = vm_exec_core(th, initial);
if ((state = th->state) != 0) { if ((state = th->state) != 0) {
err = result; err = result;
@ -1189,7 +1191,6 @@ vm_exec(rb_thread_t *th)
#else #else
*th->cfp->sp++ = (GET_THROWOBJ_VAL(err)); *th->cfp->sp++ = (GET_THROWOBJ_VAL(err));
#endif #endif
th->errinfo = Qnil;
goto vm_loop_start; goto vm_loop_start;
} }
} }
@ -1226,7 +1227,6 @@ vm_exec(rb_thread_t *th)
escape_dfp = GET_THROWOBJ_CATCH_POINT(err); escape_dfp = GET_THROWOBJ_CATCH_POINT(err);
if (cfp->dfp == escape_dfp) { if (cfp->dfp == escape_dfp) {
cfp->pc = cfp->iseq->iseq_encoded + entry->cont; cfp->pc = cfp->iseq->iseq_encoded + entry->cont;
th->errinfo = Qnil;
goto vm_loop_start; goto vm_loop_start;
} }
} }
@ -1258,7 +1258,6 @@ vm_exec(rb_thread_t *th)
*th->cfp->sp++ = (GET_THROWOBJ_VAL(err)); *th->cfp->sp++ = (GET_THROWOBJ_VAL(err));
#endif #endif
} }
th->errinfo = Qnil;
goto vm_loop_start; goto vm_loop_start;
} }
} }
@ -1302,8 +1301,6 @@ vm_exec(rb_thread_t *th)
cfp->self, (VALUE)cfp->dfp, catch_iseq->iseq_encoded, cfp->self, (VALUE)cfp->dfp, catch_iseq->iseq_encoded,
cfp->sp + 1 /* push value */, cfp->lfp, catch_iseq->local_size - 1); cfp->sp + 1 /* push value */, cfp->lfp, catch_iseq->local_size - 1);
state = 0;
th->errinfo = Qnil;
goto vm_loop_start; goto vm_loop_start;
} }
else { else {