about summary refs log tree commit diff
path: root/src/libstd/sys/common
diff options
context:
space:
mode:
authorSébastien Marie <semarie@users.noreply.github.com>2015-01-30 08:15:28 +0100
committerSébastien Marie <semarie@users.noreply.github.com>2015-02-01 14:41:40 +0100
commit568a451a90a14b101ed357235a5055de2940f16b (patch)
treef82c25a1c787d485021e37e895a613da209fa9c2 /src/libstd/sys/common
parent3096784a3b1dd7d20bc67f19d4ccd61ae497a7de (diff)
downloadrust-568a451a90a14b101ed357235a5055de2940f16b.tar.gz
rust-568a451a90a14b101ed357235a5055de2940f16b.zip
openbsd: incoporate remarks
- consolidate target_record_sp_limit and target_get_sp_limit functions
  for aarch64, powerpc, arm-ios and openbsd as there are all without
  segmented stacks (no need to duplicate functions).

- rename __load_self function to rust_load_self

- use a mutex inner load_self() as underline implementation is not thread-safe
Diffstat (limited to 'src/libstd/sys/common')
-rw-r--r--src/libstd/sys/common/stack.rs54
1 files changed, 17 insertions, 37 deletions
diff --git a/src/libstd/sys/common/stack.rs b/src/libstd/sys/common/stack.rs
index cd5458a2109..8dd2f154fa8 100644
--- a/src/libstd/sys/common/stack.rs
+++ b/src/libstd/sys/common/stack.rs
@@ -227,24 +227,14 @@ pub unsafe fn record_sp_limit(limit: uint) {
     }
 
     // aarch64 - FIXME(AARCH64): missing...
-    #[cfg(target_arch = "aarch64")]
-    unsafe fn target_record_sp_limit(_: uint) {
-    }
-
     // powerpc - FIXME(POWERPC): missing...
-    #[cfg(target_arch = "powerpc")]
-    unsafe fn target_record_sp_limit(_: uint) {
-    }
-
-
-    // iOS segmented stack is disabled for now, see related notes
-    #[cfg(all(target_arch = "arm", target_os = "ios"))] #[inline(always)]
-    unsafe fn target_record_sp_limit(_: uint) {
-    }
-
-    #[cfg(target_os = "openbsd")] #[inline(always)]
+    // arm-ios - iOS segmented stack is disabled for now, see related notes
+    // openbsd - segmented stack is disabled
+    #[cfg(any(target_arch = "aarch64",
+              target_arch = "powerpc",
+              all(target_arch = "arm", target_os = "ios"),
+              target_os = "openbsd"))]
     unsafe fn target_record_sp_limit(_: uint) {
-        // segmented stack is disabled
     }
 }
 
@@ -332,28 +322,18 @@ pub unsafe fn get_sp_limit() -> uint {
     }
 
     // aarch64 - FIXME(AARCH64): missing...
-    #[cfg(target_arch = "aarch64")]
-    unsafe fn target_get_sp_limit() -> uint {
-        1024
-    }
-
-    // powepc - FIXME(POWERPC): missing...
-    #[cfg(target_arch = "powerpc")]
-    unsafe fn target_get_sp_limit() -> uint {
-        1024
-    }
-
-    // iOS doesn't support segmented stacks yet. This function might
-    // be called by runtime though so it is unsafe to mark it as
-    // unreachable, let's return a fixed constant.
-    #[cfg(all(target_arch = "arm", target_os = "ios"))] #[inline(always)]
-    unsafe fn target_get_sp_limit() -> uint {
-        1024
-    }
-
-    #[cfg(target_os = "openbsd")] #[inline(always)]
+    // powerpc - FIXME(POWERPC): missing...
+    // arm-ios - iOS doesn't support segmented stacks yet.
+    // openbsd - OpenBSD doesn't support segmented stacks.
+    //
+    // This function might be called by runtime though
+    // so it is unsafe to unreachable, let's return a fixed constant.
+    #[cfg(any(target_arch = "aarch64",
+              target_arch = "powerpc",
+              all(target_arch = "arm", target_os = "ios"),
+              target_os = "openbsd"))]
+    #[inline(always)]
     unsafe fn target_get_sp_limit() -> uint {
-        // segmented stack is disabled
         1024
     }
 }