diff options
author | Takashi Kokubun <[email protected]> | 2023-11-07 07:54:33 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-11-07 10:54:33 -0500 |
commit | 9877f3ada8019f559dc0f86911ef4bbddddb5677 (patch) | |
tree | 5b5debc885378002423dd95fa9a30b293447c03a /yjit/src/cruby.rs | |
parent | a294bb844c697799d8ba766aa2e5ba5449d05448 (diff) |
YJIT: Inline basic Ruby methods (#8855)
* YJIT: Inline basic Ruby methods
* YJIT: Fix "InsnOut operand made it past register allocation"
checktype should not generate a useless instruction.
Diffstat (limited to 'yjit/src/cruby.rs')
-rw-r--r-- | yjit/src/cruby.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/yjit/src/cruby.rs b/yjit/src/cruby.rs index 6896ae9fce..a9e35cdbdd 100644 --- a/yjit/src/cruby.rs +++ b/yjit/src/cruby.rs @@ -252,6 +252,12 @@ pub fn iseq_pc_to_insn_idx(iseq: IseqPtr, pc: *mut VALUE) -> Option<u16> { unsafe { pc.offset_from(pc_zero) }.try_into().ok() } +/// Given an ISEQ pointer and an instruction index, return an opcode. +pub fn iseq_opcode_at_idx(iseq: IseqPtr, insn_idx: u32) -> u32 { + let pc = unsafe { rb_iseq_pc_at_idx(iseq, insn_idx) }; + unsafe { rb_iseq_opcode_at_pc(iseq, pc) as u32 } +} + /// Opaque execution-context type from vm_core.h #[repr(C)] pub struct rb_execution_context_struct { |