diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2020-03-20 06:12:36 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2020-03-20 06:12:36 +0000 |
commit | c01e52eb715c1583f594a1c6e19de249f8e9b439 (patch) | |
tree | a21e6bcf4aef2cce913e1a107787d20a3e4d1e3e /cont.c | |
parent | 1e4174b45c4b9c3d27ef68e532d58aae22457bbf (diff) |
merge revision(s) adcf0316d1ecedae2a9157ad941550e0c0fb510b: [Backport #16664]
Prevent unloading methods used in root_fiber while calling another
Fiber (#2939)
Fixing SEGVs like:
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2744905
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2744420
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2741400
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -627,6 +627,15 @@ cont_save_thread(rb_context_t *cont, rb_thread_t *th) } static void +cont_init_mjit_cont(rb_context_t *cont) +{ + VM_ASSERT(cont->mjit_cont == NULL); + if (mjit_enabled) { + cont->mjit_cont = mjit_cont_new(&(cont->saved_ec)); + } +} + +static void cont_init(rb_context_t *cont, rb_thread_t *th) { /* save thread context */ @@ -635,9 +644,7 @@ cont_init(rb_context_t *cont, rb_thread_t *th) cont->saved_ec.local_storage = NULL; cont->saved_ec.local_storage_recursive_hash = Qnil; cont->saved_ec.local_storage_recursive_hash_for_trace = Qnil; - if (mjit_enabled) { - cont->mjit_cont = mjit_cont_new(&cont->saved_ec); - } + cont_init_mjit_cont(cont); } static rb_context_t * @@ -654,6 +661,14 @@ cont_new(VALUE klass) return cont; } +void +rb_fiber_init_mjit_cont(struct rb_fiber_struct *fiber) +{ + // Currently this function is meant for root_fiber. Others go through cont_new. + // XXX: Is this mjit_cont `mjit_cont_free`d? + cont_init_mjit_cont(&fiber->cont); +} + #if 0 void show_vm_stack(const rb_execution_context_t *ec) |