|
| 1 | +From 50ce3e454d5721cb534a9e9bb73c82246b930bab Mon Sep 17 00:00:00 2001 |
| 2 | + |
| 3 | +Date: Sat, 19 Jan 2019 11:46:43 +0100 |
| 4 | +Subject: [PATCH] Disable inline assembly in libcore |
| 5 | + |
| 6 | +--- |
| 7 | + src/libcore/hint.rs | 2 ++ |
| 8 | + 1 file changed, 2 insertions(+) |
| 9 | + |
| 10 | +diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs |
| 11 | +index ad5a207..04712b8 100644 |
| 12 | +--- a/src/libcore/hint.rs |
| 13 | ++++ b/src/libcore/hint.rs |
| 14 | +@@ -62,6 +62,7 @@ pub unsafe fn unreachable_unchecked() -> ! { |
| 15 | + #[inline] |
| 16 | + #[unstable(feature = "renamed_spin_loop", issue = "55002")] |
| 17 | + pub fn spin_loop() { |
| 18 | ++ /* |
| 19 | + #[cfg( |
| 20 | + all( |
| 21 | + any(target_arch = "x86", target_arch = "x86_64"), |
| 22 | +@@ -71,4 +72,5 @@ pub fn spin_loop() { |
| 23 | + unsafe { crate::arch::arm::__yield() }; |
| 24 | + } |
| 25 | + } |
| 26 | ++ */ |
| 27 | + } |
| 28 | +diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs |
| 29 | +index ce35181..7d3f6a5 100644 |
| 30 | +--- a/src/libcore/hint.rs |
| 31 | ++++ b/src/libcore/hint.rs |
| 32 | +@@ -128,6 +128,7 @@ pub fn black_box<T>(dummy: T) -> T { |
| 33 | + // this. LLVM's intepretation of inline assembly is that it's, well, a black |
| 34 | + // box. This isn't the greatest implementation since it probably deoptimizes |
| 35 | + // more than we want, but it's so far good enough. |
| 36 | ++/* |
| 37 | + #[cfg(not(any( |
| 38 | + target_arch = "asmjs", |
| 39 | + all( |
| 40 | +@@ -139,6 +140,7 @@ pub fn black_box<T>(dummy: T) -> T { |
| 41 | + asm!("" : : "r"(&dummy)); |
| 42 | + return dummy; |
| 43 | + } |
| 44 | ++*/ |
| 45 | + |
| 46 | + // Not all platforms support inline assembly so try to do something without |
| 47 | + // inline assembly which in theory still hinders at least some optimizations |
| 48 | +-- |
| 49 | +2.17.2 (Apple Git-113) |
0 commit comments