Use raw pointers instead of references to avoid aliasing issues
This commit is contained in:
parent
c6ece101e2
commit
fb9acb73f3
|
@ -107,7 +107,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer,
|
pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPointer,
|
||||||
new_stack: &Stack) -> usize {
|
new_stack: &Stack) -> usize {
|
||||||
// Address of the topmost CFA stack slot.
|
// Address of the topmost CFA stack slot.
|
||||||
let new_cfa = (new_stack.base() as *mut usize).offset(-1);
|
let new_cfa = (new_stack.base() as *mut usize).offset(-1);
|
||||||
|
|
|
@ -106,7 +106,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer,
|
pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPointer,
|
||||||
new_stack: &Stack) -> usize {
|
new_stack: &Stack) -> usize {
|
||||||
// Address of the topmost CFA stack slot.
|
// Address of the topmost CFA stack slot.
|
||||||
let new_cfa = (new_stack.base() as *mut usize).offset(-1);
|
let new_cfa = (new_stack.base() as *mut usize).offset(-1);
|
||||||
|
|
|
@ -133,7 +133,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn swap(arg: usize, old_sp: &mut StackPointer, new_sp: &StackPointer,
|
pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPointer,
|
||||||
new_stack: &Stack) -> usize {
|
new_stack: &Stack) -> usize {
|
||||||
// Address of the topmost CFA stack slot.
|
// Address of the topmost CFA stack slot.
|
||||||
let new_cfa = (new_stack.base() as *mut usize).offset(-1);
|
let new_cfa = (new_stack.base() as *mut usize).offset(-1);
|
||||||
|
|
Loading…
Reference in New Issue