mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
MicroJIT: Don't compile trace instructions
This commit is contained in:
parent
ba45aff16b
commit
93f6ac39f2
3 changed files with 22 additions and 1 deletions
19
iseq.c
19
iseq.c
|
@ -3232,6 +3232,25 @@ rb_vm_insn_addr2insn(const void *addr)
|
||||||
rb_bug("rb_vm_insn_addr2insn: invalid insn address: %p", 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.
|
// Decode `iseq->body->iseq_encoded[i]` to an insn.
|
||||||
int
|
int
|
||||||
rb_vm_insn_decode(const VALUE encoded)
|
rb_vm_insn_decode(const VALUE encoded)
|
||||||
|
|
2
iseq.h
2
iseq.h
|
@ -167,6 +167,8 @@ const rb_iseq_t *rb_iseq_load_iseq(VALUE fname);
|
||||||
unsigned int *rb_iseq_insns_info_decode_positions(const struct rb_iseq_constant_body *body);
|
unsigned int *rb_iseq_insns_info_decode_positions(const struct rb_iseq_constant_body *body);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int rb_vm_insn_addr2opcode(const void *addr);
|
||||||
|
|
||||||
RUBY_SYMBOL_EXPORT_BEGIN
|
RUBY_SYMBOL_EXPORT_BEGIN
|
||||||
|
|
||||||
/* compile.c */
|
/* compile.c */
|
||||||
|
|
|
@ -74,7 +74,7 @@ opcode_at_pc(const rb_iseq_t *iseq, const VALUE *pc)
|
||||||
{
|
{
|
||||||
const VALUE at_pc = *pc;
|
const VALUE at_pc = *pc;
|
||||||
if (FL_TEST_RAW((VALUE)iseq, ISEQ_TRANSLATED)) {
|
if (FL_TEST_RAW((VALUE)iseq, ISEQ_TRANSLATED)) {
|
||||||
return rb_vm_insn_addr2insn((const void *)at_pc);
|
return rb_vm_insn_addr2opcode((const void *)at_pc);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (int)at_pc;
|
return (int)at_pc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue