From a63f85ce8c48a819c341f247ef451eb2160b30b1 Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Tue, 14 Aug 2012 20:36:36 -0400 Subject: [PATCH] add some inlines to shared mutable state --- src/libcore/unsafe.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcore/unsafe.rs b/src/libcore/unsafe.rs index f945cb8ad1d8..22cdbacd60f5 100644 --- a/src/libcore/unsafe.rs +++ b/src/libcore/unsafe.rs @@ -105,6 +105,7 @@ unsafe fn shared_mutable_state(+data: T) -> SharedMutableState { } } +#[inline(always)] unsafe fn get_shared_mutable_state(rc: &SharedMutableState) -> &mut T { unsafe { @@ -116,6 +117,7 @@ unsafe fn get_shared_mutable_state(rc: &SharedMutableState) return r; } } +#[inline(always)] unsafe fn get_shared_immutable_state(rc: &SharedMutableState) -> &T { unsafe { @@ -169,6 +171,7 @@ class LittleLock { } impl LittleLock { + #[inline(always)] unsafe fn lock(f: fn() -> T) -> T { class Unlock { let l: rust_little_lock; @@ -209,6 +212,7 @@ impl Exclusive { // Currently, scheduling operations (i.e., yielding, receiving on a pipe, // accessing the provided condition variable) are prohibited while inside // the exclusive. Supporting that is a work in progress. + #[inline(always)] unsafe fn with(f: fn(x: &mut T) -> U) -> U { let rec = unsafe { get_shared_mutable_state(&self.x) }; do rec.lock.lock {