1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use list_for_each_safe when list_del is used inside

list_for_each seems to cause all the SEGVs we've seen.
This commit is contained in:
Takashi Kokubun 2020-12-10 00:17:59 -08:00
parent da3bca513f
commit 16c765990c
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -910,8 +910,8 @@ compile_compact_jit_code(char* c_file)
}
// 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)
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;