aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-19 15:14:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-19 15:14:03 +0000
commit2c09976db69e766c61a88cfc5f02fdce32dcab7d (patch)
tree7a0c2fcfd6d25bd74fa2adeedd68f011911efbfc /vm_insnhelper.c
parent3261463785be6da34ec355f98b90d092220056ba (diff)
downloadruby-2c09976db69e766c61a88cfc5f02fdce32dcab7d.tar.gz
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
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index d5b53314dc..a40a1c376e 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -3238,8 +3238,9 @@ static VALUE
vm_once_dispatch(ISEQ iseq, IC ic, rb_thread_t *th)
{
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) {
return is->once.value;
}
@@ -3260,7 +3261,7 @@ vm_once_dispatch(ISEQ iseq, IC ic, rb_thread_t *th)
/* waiting for finish */
RUBY_VM_CHECK_INTS(th);
rb_thread_schedule();
- return vm_once_dispatch(iseq, ic, th);
+ goto again;
}
}