summaryrefslogtreecommitdiff
path: root/yjit_core.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-08-26 11:41:47 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:39 -0400
commit0ca04e2dd4d8624df09bf9065b4b96266da4771c (patch)
treea02eb22cea665c94d6cfaa1740ce61311f77f616 /yjit_core.c
parentb5a0baf1c0f969bba966ca0791f27487de5b1067 (diff)
Only clear the JIT function when we invalidate the entry block
We should only clear the JIT function when the entry point is invalidated. Right now we only support compiling functions with a PC offset of zero (functions that take optional parameters can start at non-zero PC), so this patch just checks that the index is 0 before clearing the jit function
Diffstat (limited to 'yjit_core.c')
-rw-r--r--yjit_core.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/yjit_core.c b/yjit_core.c
index 413411a375..ef6017b74d 100644
--- a/yjit_core.c
+++ b/yjit_core.c
@@ -1122,7 +1122,14 @@ invalidate_block_version(block_t *block)
// interpreter will run the iseq
#if JIT_ENABLED
- iseq->body->jit_func = 0;
+ // Only clear the jit_func when we're invalidating the JIT entry block.
+ // We only support compiling iseqs from index 0 right now. So entry
+ // points will always have an instruction index of 0. We'll need to
+ // change this in the future when we support optional parameters because
+ // they enter the function with a non-zero PC
+ if (block->blockid.idx == 0) {
+ iseq->body->jit_func = 0;
+ }
#endif
// TODO: