summaryrefslogtreecommitdiff
path: root/mjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-06-15 22:09:37 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2022-06-15 22:09:38 -0700
commitb5079794fd8be0552e758d8b0713f7e633610214 (patch)
tree0e9632abdded523d70e56094e50d51e970c5192b /mjit.c
parent66f0ce34f12ed710c97aad30b083017c73f399ad (diff)
MJIT: Handle compaction units on stop_worker
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/mjit.c b/mjit.c
index 9531172a66..cd283d686f 100644
--- a/mjit.c
+++ b/mjit.c
@@ -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);
}
}