* 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
Родитель 520053232e
Коммит 09205cf2c3
3 изменённых файлов: 28 добавлений и 5 удалений

Просмотреть файл

@ -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>
* ext/bigdecimal/bigdecimal.c (BigDecimal_divide): fix precision too.

Просмотреть файл

@ -502,3 +502,24 @@ assert_equal %Q{ENSURE\n}, %q{
test
}, '[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
Просмотреть файл

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