mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fix infinite recursion
* vm_insnhelper.c (vm_once_dispatch): no guarantee that tail call is always optimized away. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
826f16d465
commit
f0e5e05609
1 changed files with 3 additions and 2 deletions
|
@ -3238,8 +3238,9 @@ static VALUE
|
||||||
vm_once_dispatch(ISEQ iseq, IC ic, rb_thread_t *th)
|
vm_once_dispatch(ISEQ iseq, IC ic, rb_thread_t *th)
|
||||||
{
|
{
|
||||||
rb_thread_t *const RUNNING_THREAD_ONCE_DONE = (rb_thread_t *)(0x1);
|
rb_thread_t *const RUNNING_THREAD_ONCE_DONE = (rb_thread_t *)(0x1);
|
||||||
union iseq_inline_storage_entry *is = (union iseq_inline_storage_entry *)ic;
|
union iseq_inline_storage_entry *const is = (union iseq_inline_storage_entry *)ic;
|
||||||
|
|
||||||
|
again:
|
||||||
if (is->once.running_thread == RUNNING_THREAD_ONCE_DONE) {
|
if (is->once.running_thread == RUNNING_THREAD_ONCE_DONE) {
|
||||||
return is->once.value;
|
return is->once.value;
|
||||||
}
|
}
|
||||||
|
@ -3260,7 +3261,7 @@ vm_once_dispatch(ISEQ iseq, IC ic, rb_thread_t *th)
|
||||||
/* waiting for finish */
|
/* waiting for finish */
|
||||||
RUBY_VM_CHECK_INTS(th);
|
RUBY_VM_CHECK_INTS(th);
|
||||||
rb_thread_schedule();
|
rb_thread_schedule();
|
||||||
return vm_once_dispatch(iseq, ic, th);
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue