YJIT: Maintain MapToLocal that is just upgraded (#9876)

This commit is contained in:
Takashi Kokubun 2024-02-08 09:03:47 -08:00 committed by GitHub
parent 3e03981f25
commit 1936278461
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1947,6 +1947,9 @@ impl Context {
let mut new_type = self.get_local_type(idx);
new_type.upgrade(opnd_type);
self.set_local_type(idx, new_type);
// Re-attach MapToLocal for this StackOpnd(idx). set_local_type() detaches
// all MapToLocal mappings, including the one we're upgrading here.
self.set_opnd_mapping(opnd, mapping);
}
}
}
@ -3581,6 +3584,14 @@ mod tests {
// TODO: write more tests for Context type diff
}
#[test]
fn context_upgrade_local() {
let mut asm = Assembler::new();
asm.stack_push_local(0);
asm.ctx.upgrade_opnd_type(StackOpnd(0), Type::Nil);
assert_eq!(Type::Nil, asm.ctx.get_opnd_type(StackOpnd(0)));
}
#[test]
fn context_chain_depth() {
let mut ctx = Context::default();