Skip to content

Commit 70b4f45

Browse files
authored
YJIT: Decouple Context from encoding details (#11283)
1 parent 27c22f8 commit 70b4f45

File tree

2 files changed

+77
-244
lines changed

2 files changed

+77
-244
lines changed

yjit/src/codegen.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,8 @@ fn verify_ctx(jit: &JITState, ctx: &Context) {
660660
let stack_val = jit.peek_at_stack(ctx, i as isize);
661661
let val_type = Type::from(stack_val);
662662

663-
match learned_mapping.get_kind() {
664-
TempMappingKind::MapToSelf => {
663+
match learned_mapping {
664+
TempMapping::MapToSelf => {
665665
if self_val != stack_val {
666666
panic!(
667667
"verify_ctx: stack value was mapped to self, but values did not match!\n stack: {}\n self: {}",
@@ -670,8 +670,7 @@ fn verify_ctx(jit: &JITState, ctx: &Context) {
670670
);
671671
}
672672
}
673-
TempMappingKind::MapToLocal => {
674-
let local_idx: u8 = learned_mapping.get_local_idx();
673+
TempMapping::MapToLocal(local_idx) => {
675674
let local_val = jit.peek_at_local(local_idx.into());
676675
if local_val != stack_val {
677676
panic!(
@@ -682,7 +681,7 @@ fn verify_ctx(jit: &JITState, ctx: &Context) {
682681
);
683682
}
684683
}
685-
TempMappingKind::MapToStack => {}
684+
TempMapping::MapToStack(_) => {}
686685
}
687686

688687
// If the actual type differs from the learned type
@@ -7987,7 +7986,7 @@ fn gen_iseq_kw_call(
79877986
asm.ctx.dealloc_reg(stack_kwrest.reg_opnd());
79887987
asm.mov(stack_kwrest, kwrest);
79897988
if stack_kwrest_idx >= 0 {
7990-
asm.ctx.set_opnd_mapping(stack_kwrest.into(), TempMapping::map_to_stack(kwrest_type));
7989+
asm.ctx.set_opnd_mapping(stack_kwrest.into(), TempMapping::MapToStack(kwrest_type));
79917990
}
79927991

79937992
Some(kwrest_type)
@@ -8057,7 +8056,7 @@ fn gen_iseq_kw_call(
80578056
let default_param = asm.stack_opnd(kwargs_stack_base - kwarg_idx as i32);
80588057
let param_type = Type::from(default_value);
80598058
asm.mov(default_param, default_value.into());
8060-
asm.ctx.set_opnd_mapping(default_param.into(), TempMapping::map_to_stack(param_type));
8059+
asm.ctx.set_opnd_mapping(default_param.into(), TempMapping::MapToStack(param_type));
80618060
}
80628061
}
80638062

0 commit comments

Comments
 (0)