Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we reset rsp correctly? #1526

Open
ltratt opened this issue Dec 22, 2024 · 0 comments
Open

Do we reset rsp correctly? #1526

ltratt opened this issue Dec 22, 2024 · 0 comments
Assignees

Comments

@ltratt
Copy link
Contributor

ltratt commented Dec 22, 2024

This might be me being very, very stupid, but in patch_frame_allocation we retrospectively make sure rsp is given enough space for all the spills the trace needs:

let stack_size = self.ra.align_stack(SYSV_CALL_STACK_ALIGN) - self.sp_offset;
match i32::try_from(stack_size) {
    Ok(asp) => {
	let mut patchup = self.asm.alter_uncommitted();
	patchup.goto(asm_off);
	dynasm!(patchup ; sub rsp, DWORD asp);

For example for big_loop this inserts:

sub rsp, 0x30

as the very first instruction of the trace.

However, when a guard fails we seem to pass rsp in without subtracting that offset. Nor, as far as I can see, is that stack offset information available to __yk_deopt. Does this mean we gradually end up with the wrong rsp as we fail from guards?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants