diff options
author | Alan Wu <[email protected]> | 2020-10-19 09:47:39 -0400 |
---|---|---|
committer | Alan Wu <[email protected]> | 2021-10-20 18:19:25 -0400 |
commit | 93f6ac39f20f64a879507db98a16177530e9f3d4 (patch) | |
tree | e637f031469ce2c2ed3697c3f43fed3956f2d372 /iseq.c | |
parent | ba45aff16b1246a3c6b31e9cebb0096fb4e1fcae (diff) |
MicroJIT: Don't compile trace instructions
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -3232,6 +3232,25 @@ rb_vm_insn_addr2insn(const void *addr) rb_bug("rb_vm_insn_addr2insn: invalid insn address: %p", addr); } +// Unlike rb_vm_insn_addr2insn, this function can return trace opcode variants. +int +rb_vm_insn_addr2opcode(const void *addr) +{ + st_data_t key = (st_data_t)addr; + st_data_t val; + + if (st_lookup(rb_encoded_insn_data, key, &val)) { + insn_data_t *e = (insn_data_t *)val; + int opcode = e->insn; + if (addr == e->trace_encoded_insn) { + opcode += VM_INSTRUCTION_SIZE/2; + } + return opcode; + } + + rb_bug("rb_vm_insn_addr2opcode: invalid insn address: %p", addr); +} + // Decode `iseq->body->iseq_encoded[i]` to an insn. int rb_vm_insn_decode(const VALUE encoded) |