4646// * The 1st init trampoline tells the unwinder to restore %rbp and its return
4747// address from the stack frame at %rbp (in the parent stack), thus continuing
4848// unwinding at the swap call site instead of falling off the end of context stack.
49- use core:: mem;
50- use stack:: Stack ;
49+
50+ use crate :: stack:: Stack ;
51+ use core:: mem:: MaybeUninit ;
5152
5253pub const STACK_ALIGNMENT : usize = 16 ;
5354
@@ -56,13 +57,13 @@ pub const STACK_ALIGNMENT: usize = 16;
5657pub struct StackPointer ( * mut usize ) ;
5758
5859pub unsafe fn init (
59- stack : & Stack ,
60+ stack : & dyn Stack ,
6061 f : unsafe extern "C" fn ( usize , StackPointer ) -> !,
6162) -> StackPointer {
6263 #[ cfg( not( target_vendor = "apple" ) ) ]
6364 #[ naked]
6465 unsafe extern "C" fn trampoline_1 ( ) {
65- asm ! (
66+ llvm_asm ! (
6667 r#"
6768 # gdb has a hardcoded check that rejects backtraces where frame addresses
6869 # do not monotonically decrease. It is turned off if the function is called
@@ -102,7 +103,7 @@ pub unsafe fn init(
102103 #[ cfg( target_vendor = "apple" ) ]
103104 #[ naked]
104105 unsafe extern "C" fn trampoline_1 ( ) {
105- asm ! (
106+ llvm_asm ! (
106107 r#"
107108 # Identical to the above, except avoids .local/.size that aren't available on Mach-O.
108109 __morestack:
@@ -117,7 +118,7 @@ pub unsafe fn init(
117118
118119 #[ naked]
119120 unsafe extern "C" fn trampoline_2 ( ) {
120- asm ! (
121+ llvm_asm ! (
121122 r#"
122123 # Set up the second part of our DWARF CFI.
123124 # When unwinding the frame corresponding to this function, a DWARF unwinder
@@ -175,20 +176,20 @@ pub unsafe fn init(
175176pub unsafe fn swap (
176177 arg : usize ,
177178 new_sp : StackPointer ,
178- new_stack : Option < & Stack > ,
179+ new_stack : Option < & dyn Stack > ,
179180) -> ( usize , StackPointer ) {
180181 // Address of the topmost CFA stack slot.
181- let mut dummy: usize = mem :: uninitialized ( ) ;
182+ let mut dummy: MaybeUninit < usize > = MaybeUninit :: uninit ( ) ;
182183 let new_cfa = if let Some ( new_stack) = new_stack {
183184 ( new_stack. base ( ) as * mut usize ) . offset ( -4 )
184185 } else {
185186 // Just pass a dummy pointer if we aren't linking the stack
186- & mut dummy
187+ dummy. as_mut_ptr ( )
187188 } ;
188189
189- let ret: usize ;
190- let ret_sp: * mut usize ;
191- asm ! (
190+ let mut ret: usize ;
191+ let mut ret_sp: * mut usize ;
192+ llvm_asm ! (
192193 r#"
193194 # Push the return address
194195 leaq 0f(%rip), %rax
0 commit comments