diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2023-07-17 10:41:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-17 10:41:18 -0400 |
commit | d70484f0eb176a7ef7274972ff92b88905ea0edc (patch) | |
tree | f255d7024f61ed86e0dd4e2f848c39a8e2dfce97 /vm.c | |
parent | 1c4a523006e4a0994db4f166bd410fe1d35e8611 (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.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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); } } |