Skip to content

Commit a63f85c

Browse files
committed
add some inlines to shared mutable state
1 parent 6d68658 commit a63f85c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libcore/unsafe.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ unsafe fn shared_mutable_state<T: send>(+data: T) -> SharedMutableState<T> {
105105
}
106106
}
107107

108+
#[inline(always)]
108109
unsafe fn get_shared_mutable_state<T: send>(rc: &SharedMutableState<T>)
109110
-> &mut T {
110111
unsafe {
@@ -116,6 +117,7 @@ unsafe fn get_shared_mutable_state<T: send>(rc: &SharedMutableState<T>)
116117
return r;
117118
}
118119
}
120+
#[inline(always)]
119121
unsafe fn get_shared_immutable_state<T: send>(rc: &SharedMutableState<T>)
120122
-> &T {
121123
unsafe {
@@ -169,6 +171,7 @@ class LittleLock {
169171
}
170172

171173
impl LittleLock {
174+
#[inline(always)]
172175
unsafe fn lock<T>(f: fn() -> T) -> T {
173176
class Unlock {
174177
let l: rust_little_lock;
@@ -209,6 +212,7 @@ impl<T: send> Exclusive<T> {
209212
// Currently, scheduling operations (i.e., yielding, receiving on a pipe,
210213
// accessing the provided condition variable) are prohibited while inside
211214
// the exclusive. Supporting that is a work in progress.
215+
#[inline(always)]
212216
unsafe fn with<U>(f: fn(x: &mut T) -> U) -> U {
213217
let rec = unsafe { get_shared_mutable_state(&self.x) };
214218
do rec.lock.lock {

0 commit comments

Comments
 (0)