Skip to content

Change #[inline(always)] to #[inline(force)] #6987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct Condvar<'self> {

impl<'self> Condvar<'self> {
/// Atomically exit the associated ARC and block until a signal is sent.
#[inline(always)]
#[inline(force)]
pub fn wait(&self) { self.wait_on(0) }

/**
Expand All @@ -68,7 +68,7 @@ impl<'self> Condvar<'self> {
*
* wait() is equivalent to wait_on(0).
*/
#[inline(always)]
#[inline(force)]
pub fn wait_on(&self, condvar_id: uint) {
assert!(!*self.failed);
self.cond.wait_on(condvar_id);
Expand All @@ -77,28 +77,28 @@ impl<'self> Condvar<'self> {
}

/// Wake up a blocked task. Returns false if there was no blocked task.
#[inline(always)]
#[inline(force)]
pub fn signal(&self) -> bool { self.signal_on(0) }

/**
* Wake up a blocked task on a specified condvar (as
* sync::cond.signal_on). Returns false if there was no blocked task.
*/
#[inline(always)]
#[inline(force)]
pub fn signal_on(&self, condvar_id: uint) -> bool {
assert!(!*self.failed);
self.cond.signal_on(condvar_id)
}

/// Wake up all blocked tasks. Returns the number of tasks woken.
#[inline(always)]
#[inline(force)]
pub fn broadcast(&self) -> uint { self.broadcast_on(0) }

/**
* Wake up all blocked tasks on a specified condvar (as
* sync::cond.broadcast_on). Returns the number of tasks woken.
*/
#[inline(always)]
#[inline(force)]
pub fn broadcast_on(&self, condvar_id: uint) -> uint {
assert!(!*self.failed);
self.cond.broadcast_on(condvar_id)
Expand Down Expand Up @@ -199,7 +199,7 @@ impl<T:Owned> MutexARC<T> {
* any tasks that subsequently try to access it (including those already
* blocked on the mutex) will also fail immediately.
*/
#[inline(always)]
#[inline]
pub unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
unsafe {
let state = self.x.get();
Expand All @@ -214,7 +214,7 @@ impl<T:Owned> MutexARC<T> {
}

/// As access(), but with a condvar, as sync::mutex.lock_cond().
#[inline(always)]
#[inline]
pub unsafe fn access_cond<'x, 'c, U>(&self,
blk: &fn(x: &'x mut T,
c: &'c Condvar) -> U)
Expand All @@ -232,7 +232,7 @@ impl<T:Owned> MutexARC<T> {
}

// Common code for {mutex.access,rwlock.write}{,_cond}.
#[inline(always)]
#[inline(force)]
#[doc(hidden)]
fn check_poison(is_mutex: bool, failed: bool) {
if failed {
Expand Down Expand Up @@ -325,7 +325,7 @@ impl<T:Const + Owned> RWARC<T> {
* that other tasks won't block forever. As MutexARC.access, it will also
* poison the ARC, so subsequent readers and writers will both also fail.
*/
#[inline(always)]
#[inline]
pub fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
unsafe {
let state = self.x.get();
Expand All @@ -338,7 +338,7 @@ impl<T:Const + Owned> RWARC<T> {
}

/// As write(), but with a condvar, as sync::rwlock.write_cond().
#[inline(always)]
#[inline]
pub fn write_cond<'x, 'c, U>(&self,
blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
-> U {
Expand Down
16 changes: 8 additions & 8 deletions src/libextra/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub fn Arena() -> Arena {
arena_with_size(32u)
}

#[inline(always)]
#[inline]
fn round_up_to(base: uint, align: uint) -> uint {
(base + (align - 1)) & !(align - 1)
}
Expand Down Expand Up @@ -156,12 +156,12 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
// initialized in the arena in the low bit of the tydesc pointer. This
// is necessary in order to properly do cleanup if a failure occurs
// during an initializer.
#[inline(always)]
#[inline]
unsafe fn bitpack_tydesc_ptr(p: *TypeDesc, is_done: bool) -> uint {
let p_bits: uint = transmute(p);
p_bits | (is_done as uint)
}
#[inline(always)]
#[inline]
unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
(transmute(p & !1), p & 1 == 1)
}
Expand All @@ -179,7 +179,7 @@ impl Arena {
return self.alloc_pod_inner(n_bytes, align);
}

#[inline(always)]
#[inline]
fn alloc_pod_inner(&mut self, n_bytes: uint, align: uint) -> *u8 {
unsafe {
// XXX: Borrow check
Expand All @@ -199,7 +199,7 @@ impl Arena {
}
}

#[inline(always)]
#[inline]
fn alloc_pod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
unsafe {
let tydesc = sys::get_type_desc::<T>();
Expand All @@ -223,7 +223,7 @@ impl Arena {
return self.alloc_nonpod_inner(n_bytes, align);
}

#[inline(always)]
#[inline]
fn alloc_nonpod_inner(&mut self, n_bytes: uint, align: uint)
-> (*u8, *u8) {
unsafe {
Expand All @@ -246,7 +246,7 @@ impl Arena {
}
}

#[inline(always)]
#[inline]
fn alloc_nonpod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
unsafe {
let tydesc = sys::get_type_desc::<T>();
Expand All @@ -268,7 +268,7 @@ impl Arena {
}

// The external interface
#[inline(always)]
#[inline]
pub fn alloc<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
unsafe {
// XXX: Borrow check
Expand Down
Loading