diff options
author | John Hawthorn <[email protected]> | 2021-08-03 10:31:26 -0700 |
---|---|---|
committer | Alan Wu <[email protected]> | 2021-10-20 18:19:38 -0400 |
commit | 2e707ee66f484c11d4548011911ad17bec2063b9 (patch) | |
tree | 16f30c256bd1f18bbfa028200366f57ec6499b96 /yjit_core.c | |
parent | d2e8b99b5bc485b864d25c4293002214b0c64ced (diff) |
Don't generate entry point when PC != 0
If we hit this at PC > 0 (ie. with an optional argument) the provided
types and context are likely incorrect and it is likely this block can't
be used.
Diffstat (limited to 'yjit_core.c')
-rw-r--r-- | yjit_core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/yjit_core.c b/yjit_core.c index 45386dea23..95bdcc1fa4 100644 --- a/yjit_core.c +++ b/yjit_core.c @@ -613,6 +613,12 @@ block_t* gen_block_version(blockid_t blockid, const ctx_t* start_ctx, rb_executi // Generate a block version that is an entry point inserted into an iseq uint8_t* gen_entry_point(const rb_iseq_t *iseq, uint32_t insn_idx, rb_execution_context_t *ec) { + // If we aren't at PC 0, don't generate code + // See yjit_pc_guard + if (iseq->body->iseq_encoded != ec->cfp->pc) { + return NULL; + } + // The entry context makes no assumptions about types blockid_t blockid = { iseq, insn_idx }; |