diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2021-02-16 12:16:00 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:29 -0400 |
commit | ddd1a5ce790717d8606d3aba17cd1aaae266819f (patch) | |
tree | 338808c47d1a4c68b3a38501f6159bb5b92fa5fd | |
parent | 48736599ace66fe6bd205e3df2979563f04e0a30 (diff) |
Add op-not-redefined check to opt_aref
-rw-r--r-- | ujit_codegen.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ujit_codegen.c b/ujit_codegen.c index 90c1af21c4..541f74b964 100644 --- a/ujit_codegen.c +++ b/ujit_codegen.c @@ -706,6 +706,16 @@ gen_opt_aref(jitstate_t* jit, ctx_t* ctx) // Create a size-exit to fall back to the interpreter uint8_t* side_exit = ujit_side_exit(jit, ctx); + // TODO: make a helper function for guarding on op-not-redefined + // Make sure that minus isn't redefined for integers + mov(cb, RAX, const_ptr_opnd(ruby_current_vm_ptr)); + test( + cb, + member_opnd_idx(RAX, rb_vm_t, redefined_flag, BOP_AREF), + imm_opnd(ARRAY_REDEFINED_OP_FLAG) + ); + jnz_ptr(cb, side_exit); + x86opnd_t recv = ctx_stack_pop(ctx, 1); mov(cb, REG0, recv); |