зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
999b58c1ff
Коммит
cc7bd8e5ff
13
iseq.c
13
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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче