aboutsummaryrefslogtreecommitdiffstats
path: root/mjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-02-28 23:20:44 -0800
committerNARUSE, Yui <naruse@airemix.jp>2020-03-15 19:35:24 +0900
commit17e925b9917f4877f2da8c64316feb3ce1ca2932 (patch)
tree1fbecc1ec317127afda2ae34c926045f78161dc7 /mjit.c
parentc6944377d798e088042f2944b81aa3fa8a4e5411 (diff)
downloadruby-17e925b9917f4877f2da8c64316feb3ce1ca2932.tar.gz
Avoid infinite loop on --jit-wait
(cherry picked from commit a8dcab723316997d9e01c89d6df969edce75bdca)
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mjit.c b/mjit.c
index 33abfbe3e9..df0169e748 100644
--- a/mjit.c
+++ b/mjit.c
@@ -366,7 +366,14 @@ unload_units(void)
remove_from_list(worst, &active_units);
free_unit(worst);
}
- verbose(1, "Too many JIT code -- %d units unloaded", units_num - active_units.length);
+
+ if (units_num == active_units.length && mjit_opts.wait) {
+ mjit_opts.max_cache_size++; // avoid infinite loop on `rb_mjit_wait_call`. Note that --jit-wait is just for testing.
+ verbose(1, "No units can be unloaded -- incremented max-cache-size to %d for --jit-wait", mjit_opts.max_cache_size);
+ }
+ else {
+ verbose(1, "Too many JIT code -- %d units unloaded", units_num - active_units.length);
+ }
}
static void