Remove unnecessary "memory" clobbers for naked function asm

This commit is contained in:
Amanieu d'Antras 2016-09-01 16:39:34 +01:00 committed by edef
parent 38ff4126b6
commit 86e29b2baa
3 changed files with 10 additions and 10 deletions

View File

@ -73,7 +73,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
.Lend: .Lend:
.size __morestack, .Lend-__morestack .size __morestack, .Lend-__morestack
"# "#
: : "s" (trampoline_2 as usize) : "memory" : "volatile") : : "s" (trampoline_2 as usize) : : "volatile")
} }
#[naked] #[naked]
@ -89,7 +89,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
l.jr r9 l.jr r9
l.nop l.nop
"# "#
: : : "memory" : "volatile") : : : : "volatile")
} }
unsafe fn push(sp: &mut StackPointer, val: usize) { unsafe fn push(sp: &mut StackPointer, val: usize) {
@ -139,7 +139,7 @@ pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPo
l.jr r9 l.jr r9
l.nop l.nop
"# "#
: : : "memory" : "volatile") : : : : "volatile")
} }
let ret: usize; let ret: usize;

View File

@ -72,7 +72,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
.Lend: .Lend:
.size __morestack, .Lend-__morestack .size __morestack, .Lend-__morestack
"# "#
: : "s" (trampoline_2 as usize) : "memory" : "volatile") : : "s" (trampoline_2 as usize) : : "volatile")
} }
#[naked] #[naked]
@ -89,7 +89,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
# Call the provided function. # Call the provided function.
call *8(%esp) call *8(%esp)
"# "#
: : : "memory" : "volatile") : : : : "volatile")
} }
unsafe fn push(sp: &mut StackPointer, val: usize) { unsafe fn push(sp: &mut StackPointer, val: usize) {
@ -135,7 +135,7 @@ pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPo
popl %ebx popl %ebx
jmpl *%ebx jmpl *%ebx
"# "#
: : : "memory" : "volatile") : : : : "volatile")
} }
let ret: usize; let ret: usize;

View File

@ -77,7 +77,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
.Lend: .Lend:
.size __morestack, .Lend-__morestack .size __morestack, .Lend-__morestack
"# "#
: : "s" (trampoline_2 as usize) : "memory" : "volatile") : : "s" (trampoline_2 as usize) : : "volatile")
} }
#[cfg(target_vendor = "apple")] #[cfg(target_vendor = "apple")]
@ -92,7 +92,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
.cfi_offset %rbp, -16 .cfi_offset %rbp, -16
call ${0:c} call ${0:c}
"# "#
: : "s" (trampoline_2 as usize) : "memory" : "volatile") : : "s" (trampoline_2 as usize) : : "volatile")
} }
#[naked] #[naked]
@ -115,7 +115,7 @@ pub unsafe fn init(stack: &Stack, f: unsafe extern "C" fn(usize) -> !) -> StackP
# Call the provided function. # Call the provided function.
call *8(%rsp) call *8(%rsp)
"# "#
: : : "memory" : "volatile") : : : : "volatile")
} }
unsafe fn push(sp: &mut StackPointer, val: usize) { unsafe fn push(sp: &mut StackPointer, val: usize) {
@ -162,7 +162,7 @@ pub unsafe fn swap(arg: usize, old_sp: *mut StackPointer, new_sp: *const StackPo
popq %rbx popq %rbx
jmpq *%rbx jmpq *%rbx
"# "#
: : : "memory" : "volatile") : : : : "volatile")
} }
let ret: usize; let ret: usize;