diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2021-06-02 01:16:49 -0700 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2021-06-02 01:16:50 -0700 |
commit | 070caf54d2a17168d3de05aa1633979c8545f8f4 (patch) | |
tree | 61ec56b0fd8090f5b367b770226607e1e963507c /iseq.c | |
parent | c32ce2cbf100edd2a88e4230f08879c7cc73a891 (diff) |
Refactor rb_vm_insn_addr2insn calls
It's been a way too much amount of ifdefs.
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -3192,6 +3192,18 @@ rb_vm_insn_addr2insn(const void *addr) rb_bug("rb_vm_insn_addr2insn: invalid insn address: %p", addr); } +// Decode `iseq->body->iseq_encoded[i]` to an insn. +int +rb_vm_insn_decode(const VALUE encoded) +{ +#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE + int insn = rb_vm_insn_addr2insn((void *)encoded); +#else + int insn = (int)encoded; +#endif + return insn; +} + static inline int encoded_iseq_trace_instrument(VALUE *iseq_encoded_insn, rb_event_flag_t turnon, bool remain_current_trace) { |