about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-03-28 08:46:08 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-03-28 13:11:24 -0700
commitce9e5ecb6c1f833eccb520b4179cf86329331fa6 (patch)
tree8dac921e0ee1118f3140cd0469d29669e4abafdc /src
parentbb14ea922b236b5c152c2770221b0f9181c2cc7f (diff)
downloadrust-ce9e5ecb6c1f833eccb520b4179cf86329331fa6.tar.gz
rust-ce9e5ecb6c1f833eccb520b4179cf86329331fa6.zip
core: Inline mallocing wrapper functions
As far as I can tell, this doesn't make rust compile any
faster, but it does at least remove one level of indirection
on malloc, which might help speed up some operations.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/unstable/lang.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs
index 554083fcdb5..ff96029bc0e 100644
--- a/src/libcore/unstable/lang.rs
+++ b/src/libcore/unstable/lang.rs
@@ -64,6 +64,7 @@ pub unsafe fn fail_borrowed() {
 
 // FIXME #4942: Make these signatures agree with exchange_alloc's signatures
 #[lang="exchange_malloc"]
+#[inline(always)]
 pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
     transmute(exchange_alloc::malloc(transmute(td), transmute(size)))
 }
@@ -72,11 +73,13 @@ pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
 // inside a landing pad may corrupt the state of the exception handler. If a
 // problem occurs, call exit instead.
 #[lang="exchange_free"]
+#[inline(always)]
 pub unsafe fn exchange_free(ptr: *c_char) {
     exchange_alloc::free(transmute(ptr))
 }
 
 #[lang="malloc"]
+#[inline(always)]
 pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
     return rustrt::rust_upcall_malloc(td, size);
 }
@@ -85,6 +88,7 @@ pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
 // inside a landing pad may corrupt the state of the exception handler. If a
 // problem occurs, call exit instead.
 #[lang="free"]
+#[inline(always)]
 pub unsafe fn local_free(ptr: *c_char) {
     rustrt::rust_upcall_free(ptr);
 }
@@ -117,6 +121,7 @@ pub unsafe fn check_not_borrowed(a: *u8) {
 }
 
 #[lang="strdup_uniq"]
+#[inline(always)]
 pub unsafe fn strdup_uniq(ptr: *c_uchar, len: uint) -> ~str {
     str::raw::from_buf_len(ptr, len)
 }