summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2023-07-17 10:41:18 -0400
committerGitHub <noreply@github.com>2023-07-17 10:41:18 -0400
commitd70484f0eb176a7ef7274972ff92b88905ea0edc (patch)
treef255d7024f61ed86e0dd4e2f848c39a8e2dfce97 /vm.c
parent1c4a523006e4a0994db4f166bd410fe1d35e8611 (diff)
YJIT: refactoring to allow for fancier call threshold logic (#8078)
* YJIT: refactoring to allow for fancier call threshold logic * Avoid potentially compiling functions multiple times. * Update vm.c Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> --------- Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Notes
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 88aba3433a..f8cdc5a5ea 100644
--- a/vm.c
+++ b/vm.c
@@ -385,9 +385,14 @@ jit_compile(rb_execution_context_t *ec)
return 0;
}
+ // Don't try to compile the function if it's already compiled
+ if (body->jit_func) {
+ return body->jit_func;
+ }
+
// Trigger JIT compilation as needed
if (yjit_enabled) {
- if (body->total_calls == rb_yjit_call_threshold()) {
+ if (rb_yjit_threshold_hit(iseq)) {
rb_yjit_compile_iseq(iseq, ec);
}
}