Skip to content

Commit d1bea77

Browse files
committed
ZJIT: Introduce GetLEP instruction
1 parent f3a5b0c commit d1bea77

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

zjit/src/codegen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio
498498
&Insn::GuardShape { val, shape, state } => gen_guard_shape(jit, asm, opnd!(val), shape, &function.frame_state(state)),
499499
Insn::LoadPC => gen_load_pc(asm),
500500
Insn::LoadEC => gen_load_ec(),
501+
Insn::GetLEP => gen_get_lep(jit, asm),
501502
Insn::LoadSelf => gen_load_self(),
502503
&Insn::LoadField { recv, id, offset, return_type } => gen_load_field(asm, opnd!(recv), id, offset, return_type),
503504
&Insn::StoreField { recv, id, offset, val } => no_output!(gen_store_field(asm, opnd!(recv), id, offset, opnd!(val), function.type_of(val))),

zjit/src/hir.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,10 @@ pub enum Insn {
849849
/// Set a class variable `id` to `val`
850850
SetClassVar { id: ID, val: InsnId, ic: *const iseq_inline_cvar_cache_entry, state: InsnId },
851851

852+
/// Get the EP of the ISeq of the containing method, or "local level", skipping over block-level EPs.
853+
/// Equivalent of GET_LEP() macro.
854+
GetLEP,
855+
852856
/// Own a FrameState so that instructions can look up their dominating FrameState when
853857
/// generating deopt side-exits and frame reconstruction metadata. Does not directly generate
854858
/// any code.
@@ -1131,6 +1135,7 @@ impl Insn {
11311135
Insn::DefinedIvar { .. } => effects::Any,
11321136
Insn::LoadPC { .. } => Effect::read_write(abstract_heaps::PC, abstract_heaps::Empty),
11331137
Insn::LoadEC { .. } => effects::Empty,
1138+
Insn::GetLEP { .. } => effects::Empty,
11341139
Insn::LoadSelf { .. } => Effect::read_write(abstract_heaps::Frame, abstract_heaps::Empty),
11351140
Insn::LoadField { .. } => Effect::read_write(abstract_heaps::Other, abstract_heaps::Empty),
11361141
Insn::StoreField { .. } => effects::Any,
@@ -1562,6 +1567,7 @@ impl<'a> std::fmt::Display for InsnPrinter<'a> {
15621567
Insn::GetIvar { self_val, id, .. } => write!(f, "GetIvar {self_val}, :{}", id.contents_lossy()),
15631568
Insn::LoadPC => write!(f, "LoadPC"),
15641569
Insn::LoadEC => write!(f, "LoadEC"),
1570+
Insn::GetLEP => write!(f, "GetLEP"),
15651571
Insn::LoadSelf => write!(f, "LoadSelf"),
15661572
&Insn::LoadField { recv, id, offset, return_type: _ } => write!(f, "LoadField {recv}, :{}@{:p}", id.contents_lossy(), self.ptr_map.map_offset(offset)),
15671573
&Insn::StoreField { recv, id, offset, val } => write!(f, "StoreField {recv}, :{}@{:p}, {val}", id.contents_lossy(), self.ptr_map.map_offset(offset)),
@@ -2128,6 +2134,7 @@ impl Function {
21282134
| EntryPoint {..}
21292135
| LoadPC
21302136
| LoadEC
2137+
| GetLEP
21312138
| LoadSelf
21322139
| IncrCounterPtr {..}
21332140
| IncrCounter(_)) => result.clone(),
@@ -2457,6 +2464,7 @@ impl Function {
24572464
Insn::GetIvar { .. } => types::BasicObject,
24582465
Insn::LoadPC => types::CPtr,
24592466
Insn::LoadEC => types::CPtr,
2467+
Insn::GetLEP => types::CPtr,
24602468
Insn::LoadSelf => types::BasicObject,
24612469
&Insn::LoadField { return_type, .. } => return_type,
24622470
Insn::GetSpecialSymbol { .. } => types::BasicObject,
@@ -4357,6 +4365,7 @@ impl Function {
43574365
| &Insn::EntryPoint { .. }
43584366
| &Insn::LoadPC
43594367
| &Insn::LoadEC
4368+
| &Insn::GetLEP
43604369
| &Insn::LoadSelf
43614370
| &Insn::GetLocal { .. }
43624371
| &Insn::GetBlockHandler
@@ -5099,6 +5108,7 @@ impl Function {
50995108
| Insn::GetGlobal { .. }
51005109
| Insn::LoadPC
51015110
| Insn::LoadEC
5111+
| Insn::GetLEP
51025112
| Insn::LoadSelf
51035113
| Insn::Snapshot { .. }
51045114
| Insn::Jump { .. }

0 commit comments

Comments
 (0)