Lock only active_units references

556a728508 was not good maybe because it
wasn't using list_for_each_safe. If list_for_each_safe is safe for
list_del for any nodes (is that true?), this should be fine.
This commit is contained in:
Takashi Kokubun 2020-12-14 23:33:49 -08:00
Родитель ce6fafb8cc
Коммит 5463eff5f6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 6FFC433B12EE23DD
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -947,7 +947,8 @@ compile_compact_jit_code(char* c_file)
// compacted functions (not done yet). // compacted functions (not done yet).
bool success = true; bool success = true;
CRITICAL_SECTION_START(3, "before active_units list_for_each"); CRITICAL_SECTION_START(3, "before active_units list_for_each");
list_for_each(&active_units.head, child_unit, unode) { list_for_each_safe(&active_units.head, child_unit, next, unode) {
CRITICAL_SECTION_FINISH(3, "after active_units list_for_each");
char funcname[MAXPATHLEN]; char funcname[MAXPATHLEN];
sprint_funcname(funcname, child_unit); sprint_funcname(funcname, child_unit);
@ -961,6 +962,8 @@ compile_compact_jit_code(char* c_file)
if (!iseq_label) iseq_label = sep = ""; if (!iseq_label) iseq_label = sep = "";
fprintf(f, "\n/* %s%s%s:%ld */\n", iseq_label, sep, iseq_path, iseq_lineno); fprintf(f, "\n/* %s%s%s:%ld */\n", iseq_label, sep, iseq_path, iseq_lineno);
success &= mjit_compile(f, child_unit->iseq, funcname, child_unit->id); success &= mjit_compile(f, child_unit->iseq, funcname, child_unit->id);
CRITICAL_SECTION_START(3, "before active_units list_for_each");
} }
CRITICAL_SECTION_FINISH(3, "after active_units list_for_each"); CRITICAL_SECTION_FINISH(3, "after active_units list_for_each");