about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-05-09 12:49:14 -0700
committerBrian Anderson <banderson@mozilla.com>2013-05-20 14:41:56 -0700
commit7bd421776681285bf4dfba09fe7a6dae4c8eecd5 (patch)
tree45095b331846d23abdff09591a9dd57cd1ff8ceb /src/libcore
parent26babaafcdbcfdf2e842d84dbeabbed0dae6efef (diff)
Replace all uses of rust-intrinsic ABI with calls to unstable::intrinsics
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/cast.rs27
-rw-r--r--src/libcore/stackwalk.rs10
-rw-r--r--src/libcore/sys.rs19
-rw-r--r--src/libcore/unstable/intrinsics.rs5
4 files changed, 19 insertions, 42 deletions
diff --git a/src/libcore/cast.rs b/src/libcore/cast.rs
index 4e71b62f10c..e3336e24a6e 100644
--- a/src/libcore/cast.rs
+++ b/src/libcore/cast.rs
@@ -12,26 +12,17 @@
 
 use sys;
 use unstable;
-
-pub mod rusti {
-    #[abi = "rust-intrinsic"]
-    #[link_name = "rusti"]
-    pub extern "rust-intrinsic" {
-        fn forget<T>(x: T);
-
-        fn transmute<T,U>(e: T) -> U;
-    }
-}
+use unstable::intrinsics;
 
 /// Casts the value at `src` to U. The two types must have the same length.
 pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
-    let mut dest: U = unstable::intrinsics::init();
+    let mut dest: U = intrinsics::init();
     {
-        let dest_ptr: *mut u8 = rusti::transmute(&mut dest);
-        let src_ptr: *u8 = rusti::transmute(src);
-        unstable::intrinsics::memmove64(dest_ptr,
-                                        src_ptr,
-                                        sys::size_of::<U>() as u64);
+        let dest_ptr: *mut u8 = transmute(&mut dest);
+        let src_ptr: *u8 = transmute(src);
+        intrinsics::memmove64(dest_ptr,
+                              src_ptr,
+                              sys::size_of::<U>() as u64);
     }
     dest
 }
@@ -45,7 +36,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
  * reinterpret_cast on pointer types.
  */
 #[inline(always)]
-pub unsafe fn forget<T>(thing: T) { rusti::forget(thing); }
+pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing); }
 
 /**
  * Force-increment the reference count on a shared box. If used
@@ -65,7 +56,7 @@ pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); }
  */
 #[inline(always)]
 pub unsafe fn transmute<L, G>(thing: L) -> G {
-    rusti::transmute(thing)
+    intrinsics::transmute(thing)
 }
 
 /// Coerce an immutable reference to be mutable.
diff --git a/src/libcore/stackwalk.rs b/src/libcore/stackwalk.rs
index fbb67537232..784656718d0 100644
--- a/src/libcore/stackwalk.rs
+++ b/src/libcore/stackwalk.rs
@@ -11,6 +11,7 @@
 #[doc(hidden)]; // FIXME #3538
 
 use cast::transmute;
+use unstable::intrinsics;
 
 pub type Word = uint;
 
@@ -75,13 +76,6 @@ fn test_simple_deep() {
 
 fn frame_address(f: &fn(x: *u8)) {
     unsafe {
-        rusti::frame_address(f)
-    }
-}
-
-pub mod rusti {
-    #[abi = "rust-intrinsic"]
-    pub extern "rust-intrinsic" {
-        pub fn frame_address(f: &once fn(x: *u8));
+        intrinsics::frame_address(f)
     }
 }
diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs
index fc57cf40d1e..962295e0b8a 100644
--- a/src/libcore/sys.rs
+++ b/src/libcore/sys.rs
@@ -19,6 +19,7 @@ use libc;
 use libc::{c_void, c_char, size_t};
 use repr;
 use str;
+use unstable::intrinsics;
 
 pub type FreeGlue<'self> = &'self fn(*TypeDesc, *c_void);
 
@@ -38,16 +39,6 @@ pub struct Closure {
     env: *(),
 }
 
-pub mod rusti {
-    #[abi = "rust-intrinsic"]
-    pub extern "rust-intrinsic" {
-        fn get_tydesc<T>() -> *();
-        fn size_of<T>() -> uint;
-        fn pref_align_of<T>() -> uint;
-        fn min_align_of<T>() -> uint;
-    }
-}
-
 pub mod rustrt {
     use libc::{c_char, size_t};
 
@@ -81,7 +72,7 @@ pub fn shape_le<T:Ord>(x1: &T, x2: &T) -> bool {
  */
 #[inline(always)]
 pub fn get_type_desc<T>() -> *TypeDesc {
-    unsafe { rusti::get_tydesc::<T>() as *TypeDesc }
+    unsafe { intrinsics::get_tydesc::<T>() as *TypeDesc }
 }
 
 /// Returns a pointer to a type descriptor.
@@ -93,7 +84,7 @@ pub fn get_type_desc_val<T>(_val: &T) -> *TypeDesc {
 /// Returns the size of a type
 #[inline(always)]
 pub fn size_of<T>() -> uint {
-    unsafe { rusti::size_of::<T>() }
+    unsafe { intrinsics::size_of::<T>() }
 }
 
 /// Returns the size of the type that `_val` points to
@@ -128,7 +119,7 @@ pub fn nonzero_size_of_val<T>(_val: &T) -> uint {
  */
 #[inline(always)]
 pub fn min_align_of<T>() -> uint {
-    unsafe { rusti::min_align_of::<T>() }
+    unsafe { intrinsics::min_align_of::<T>() }
 }
 
 /// Returns the ABI-required minimum alignment of the type of the value that
@@ -141,7 +132,7 @@ pub fn min_align_of_val<T>(_val: &T) -> uint {
 /// Returns the preferred alignment of a type
 #[inline(always)]
 pub fn pref_align_of<T>() -> uint {
-    unsafe { rusti::pref_align_of::<T>() }
+    unsafe { intrinsics::pref_align_of::<T>() }
 }
 
 /// Returns the preferred alignment of the type of the value that
diff --git a/src/libcore/unstable/intrinsics.rs b/src/libcore/unstable/intrinsics.rs
index f332ecc63fc..d476822819e 100644
--- a/src/libcore/unstable/intrinsics.rs
+++ b/src/libcore/unstable/intrinsics.rs
@@ -114,6 +114,7 @@ pub extern "rust-intrinsic" {
     /// `forget` is unsafe because the caller is responsible for
     /// ensuring the argument is deallocated already.
     pub unsafe fn forget<T>(_: T) -> ();
+    pub fn transmute<T,U>(e: T) -> U;
 
     /// Returns `true` if a type requires drop glue.
     pub fn needs_drop<T>() -> bool;
@@ -121,8 +122,8 @@ pub extern "rust-intrinsic" {
     // XXX: intrinsic uses legacy modes and has reference to TyDesc
     // and TyVisitor which are in librustc
     //fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor) -> ();
-    // XXX: intrinsic uses legacy modes
-    //fn frame_address(f: &once fn(*u8));
+
+    pub fn frame_address(f: &once fn(*u8));
 
     /// Get the address of the `__morestack` stack growth function.
     pub fn morestack_addr() -> *();