diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-14 23:27:10 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-14 23:27:10 +0000 |
commit | cc7bd8e5fff13b7b60e472748bfd4dc407c29bae (patch) | |
tree | 51c6584489083ecc4ecd65125b363cf2232a0bf1 /iseq.c | |
parent | 999b58c1ff0d6f533c1fa7c110820c0ed26ec88e (diff) | |
download | ruby-cc7bd8e5fff13b7b60e472748bfd4dc407c29bae.tar.gz |
Unconditionally define `TRACE_INSN_P`
`TRACE_INSN_P` doesn't need to know about encoded iseqs, it just needs
to look at decoded iseqs. We have the decoded iseqs available, so no
reason to look at encoded ones. This change allows us to clear
`original_iseq` from the iseq struct without any segvs (previously,
clearing `original_iseq` would cause the tests to crash).
* iseq.c (rb_iseq_trace_set): Only use decoded iseq with `TRACE_INSN_P`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -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); } |