ruby-changes:64054
From: Takashi <ko1@a...>
Date: Thu, 10 Dec 2020 17:21:01 +0900 (JST)
Subject: [ruby-changes:64054] 16c765990c (master): Use list_for_each_safe when list_del is used inside
https://git.ruby-lang.org/ruby.git/commit/?id=16c765990c From 16c765990ceaf5fb1efaeba2850083cfec7c137e Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Thu, 10 Dec 2020 00:17:59 -0800 Subject: Use list_for_each_safe when list_del is used inside list_for_each seems to cause all the SEGVs we've seen. diff --git a/mjit_worker.c b/mjit_worker.c index 725a922..377fd41 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -910,8 +910,8 @@ compile_compact_jit_code(char* c_file) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L910 } // We need to check again here because we could've waited on GC above bool iseq_gced = false; - struct rb_mjit_unit *child_unit = 0; - list_for_each(&active_units.head, child_unit, unode) { + struct rb_mjit_unit *child_unit = 0, *next; + list_for_each_safe(&active_units.head, child_unit, next, unode) { if (child_unit->iseq == NULL) { // ISeq is GC-ed iseq_gced = true; verbose(1, "JIT compaction: A method for JIT code u%d is obsoleted. Compaction will be skipped.", child_unit->id); @@ -1303,7 +1303,7 @@ unload_units(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1303 prev_queue_calls = max_queue_calls; bool unloaded_p = false; - list_for_each(&active_units.head, unit, unode) { + list_for_each_safe(&active_units.head, unit, next, unode) { if (unit->used_code_p) // We can't unload code on stack. continue; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/