YJIT: Fix kwrest calls setting SP with uninit values

We did stack_push() and then saved the SP without writing to the slots
of the new values first, which caused the GC to mark uninitialized
values. Should fix crashes like
2149317929
This commit is contained in:
Alan Wu 2024-02-12 15:57:37 -05:00
parent 0536b2ce48
commit cbdabd5890

View file

@ -6996,13 +6996,8 @@ fn gen_send_iseq(
let mut unspecified_bits = 0;
// Start by ensuring the stack is large enough for the callee
for _ in caller_keyword_len..callee_kw_count {
argc += 1;
asm.stack_push(Type::Unknown);
}
// Now this is the stack_opnd() index to the 0th keyword argument.
let kwargs_stack_base = kwargs_order.len() as i32 - 1;
// The stack_opnd() index to the 0th keyword argument.
let kwargs_stack_base = caller_keyword_len_i32 - 1;
// Build the keyword rest parameter hash before we make any changes to the order of
// the supplied keyword arguments
@ -7089,6 +7084,14 @@ fn gen_send_iseq(
}
}
// Ensure the stack is large enough for the callee
for _ in caller_keyword_len..callee_kw_count {
argc += 1;
asm.stack_push(Type::Unknown);
}
// Now this is the stack_opnd() index to the 0th keyword argument.
let kwargs_stack_base = kwargs_order.len() as i32 - 1;
// Next, we're going to loop through every keyword that was
// specified by the caller and make sure that it's in the correct
// place. If it's not we're going to swap it around with another one.