-
Notifications
You must be signed in to change notification settings - Fork 0
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
Multi version IR - CP transition baed on JIT state #16
base: master
Are you sure you want to change the base?
Conversation
ykrt/src/trace/swt/cp.rs
Outdated
// ; int3 // Insert a breakpoint for GDB | ||
; mov rax, QWORD target_addr | ||
; mov [rsp], rax | ||
; ret |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we do the jump we need to adjust rsp:
- check stack size of unopt
- calculate the difference
- sub the diff from rsp
// ); | ||
|
||
// asm.finalize().unwrap() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjust rsp here.
ykrt/src/trace/swt/cp.rs
Outdated
|
||
#[cfg(tracer_swt)] | ||
fn build_livevars_cp_asm(src_smid: usize, dst_smid: usize, asm: &mut Assembler) { | ||
let (src_rec, _) = AOT_STACKMAPS.as_ref().unwrap().get(src_smid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
records size is the size of the stack.
ykrt/src/trace/swt/cp.rs
Outdated
1 => dynasm!(asm | ||
// ; mov al, BYTE [Rq(src_reg)] | ||
// ; mov BYTE [Rq(dst_reg) + *dst_off], al# | ||
; mov al, BYTE [rsp + src_offset] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
; mov al, BYTE [rsp + src_offset] | |
; mov al, BYTE [rbp + src_offset] |
ykrt/src/trace/swt/cp.rs
Outdated
Direct(src_reg_num, src_off, src_val_size), | ||
Direct(dst_reg_num, dst_off, dst_val_size), | ||
) => { | ||
assert_eq!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need it probably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be ignored.
ykrt/src/trace/swt/cp.rs
Outdated
Direct(src_reg_num, src_off, src_val_size), | ||
Direct(dst_reg_num, dst_off, dst_val_size), | ||
) => { | ||
assert_eq!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be ignored.
ykrt/src/trace/swt/cp.rs
Outdated
// ; pop r14 // Corresponds to push r14 | ||
// ; pop r15 // Corresponds to push r15 | ||
// ; ret | ||
// ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverse the change of rsp.
ykrt/src/mt.rs
Outdated
// let func: unsafe fn() = std::mem::transmute(debug_return_into_unopt_cp().as_ptr()); | ||
let func: unsafe fn() = std::mem::transmute(RETURN_INTO_UNOPT_CP.as_ptr()); | ||
// self.log.log(Verbosity::JITEvent, "returning into unopt cp"); | ||
func(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I call my control point transition asm code the $rsp
is affected (I guess by this function execution).
Expected return address at main+330
: 0x7fffffffdcd0
But $rsp value when RETURN_INTO_UNOPT_CP
asm is executed is 0x7fffffffd360
which is off by:
0x7fffffffdcd0 - 0x7fffffffd360 = 2416
Therefore I get segfaults downstream...
No description provided.