mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
YJIT: Maintain MapToLocal that is just upgraded (#9876)
This commit is contained in:
parent
3e03981f25
commit
1936278461
1 changed files with 11 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue