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

MJIT: Handle compaction units on stop_worker

This commit is contained in:
Takashi Kokubun 2022-06-15 22:09:37 -07:00
parent 66f0ce34f1
commit b5079794fd
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

19
mjit.c
View file

@ -453,6 +453,17 @@ mjit_wait(struct rb_iseq_constant_body *body)
}
}
static void
mjit_wait_unit(struct rb_mjit_unit *unit)
{
if (unit->compact_p) {
mjit_wait(NULL);
}
else {
mjit_wait(current_cc_unit->iseq->body);
}
}
// Wait for JIT compilation finish for --jit-wait, and call the function pointer
// if the compiled result is not NOT_COMPILED_JIT_ISEQ_FUNC.
VALUE
@ -909,7 +920,7 @@ stop_worker(void)
{
stop_worker_p = true;
if (current_cc_unit != NULL) {
mjit_wait(current_cc_unit->iseq->body); // TODO: consider unit->compact_p
mjit_wait_unit(current_cc_unit);
}
worker_stopped = true;
}
@ -928,11 +939,7 @@ mjit_pause(bool wait_p)
// Flush all queued units with no option or `wait: true`
if (wait_p) {
while (current_cc_unit != NULL) {
if (current_cc_unit->compact_p) {
mjit_wait(NULL);
} else {
mjit_wait(current_cc_unit->iseq->body);
}
mjit_wait_unit(current_cc_unit);
}
}