summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iseq.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/iseq.c b/iseq.c
index 52e6d7e..f9a676b 100644
--- a/iseq.c
+++ b/iseq.c
@@ -2758,12 +2758,12 @@ rb_iseq_defined_string(enum defined_type type)
}
+#define TRACE_INSN_P(insn) ((insn) >= VM_INSTRUCTION_SIZE/2)
+
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
#define INSN_CODE(insn) ((VALUE)table[insn])
-#define TRACE_INSN_P(insn, insn_encoded) ((VALUE)table[insn] != insn_encoded)
#else
#define INSN_CODE(insn) (insn)
-#define TRACE_INSN_P(insn, insn_encoded) ((insn_encoded) >= VM_INSTRUCTION_SIZE/2)
#endif
void
@@ -2793,16 +2793,13 @@ rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events)
int insn = (int)code[i];
rb_event_flag_t events = rb_iseq_event_flags(iseq, i);
- /* code represents before transformation */
- VM_ASSERT(insn < VM_INSTRUCTION_SIZE/2);
-
if (events & turnon_events) {
- if (!TRACE_INSN_P(insn, iseq_encoded[i])) {
+ if (!TRACE_INSN_P(insn)) {
iseq_encoded[i] = INSN_CODE(insn + VM_INSTRUCTION_SIZE/2);
}
}
- else if (TRACE_INSN_P(insn, iseq_encoded[i])) {
- iseq_encoded[i] = INSN_CODE(insn);
+ else if (TRACE_INSN_P(insn)) {
+ iseq_encoded[i] = INSN_CODE(insn - VM_INSTRUCTION_SIZE/2);
}
i += insn_len(insn);
}