Skip to content

Commit 909d4d9

Browse files
committed
---
yaml --- r: 151549 b: refs/heads/try2 c: 69b321c h: refs/heads/master i: 151547: 2e6c99f v: v3
1 parent 4561a0a commit 909d4d9

File tree

5 files changed

+18
-23
lines changed

5 files changed

+18
-23
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 32988db2bd82edc92f54c2d32fdcbd748ab78cd4
8+
refs/heads/try2: 69b321c84bea60b2ac727c4acbd9a34b19182209
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/rc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use option::{Option, Some, None};
3333
use ptr;
3434
use ptr::RawPtr;
3535
use mem::{min_align_of, size_of};
36-
use rt::heap::exchange_free;
36+
use rt::heap::deallocate;
3737

3838
struct RcBox<T> {
3939
value: T,
@@ -105,8 +105,8 @@ impl<T> Drop for Rc<T> {
105105
self.dec_weak();
106106

107107
if self.weak() == 0 {
108-
exchange_free(self.ptr as *mut u8, size_of::<RcBox<T>>(),
109-
min_align_of::<RcBox<T>>())
108+
deallocate(self.ptr as *mut u8, size_of::<RcBox<T>>(),
109+
min_align_of::<RcBox<T>>())
110110
}
111111
}
112112
}
@@ -179,8 +179,8 @@ impl<T> Drop for Weak<T> {
179179
// the weak count starts at 1, and will only go to
180180
// zero if all the strong pointers have disappeared.
181181
if self.weak() == 0 {
182-
exchange_free(self.ptr as *mut u8, size_of::<RcBox<T>>(),
183-
min_align_of::<RcBox<T>>())
182+
deallocate(self.ptr as *mut u8, size_of::<RcBox<T>>(),
183+
min_align_of::<RcBox<T>>())
184184
}
185185
}
186186
}

branches/try2/src/libstd/rt/heap.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,8 @@ pub unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
165165
#[lang="exchange_free"]
166166
#[inline]
167167
// FIXME: #13994 (rustc should pass align and size here)
168-
pub unsafe fn exchange_free_(ptr: *mut u8) {
169-
exchange_free(ptr, 0, 8)
170-
}
171-
172-
#[inline]
173-
pub unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
174-
deallocate(ptr, size, align);
168+
unsafe fn exchange_free(ptr: *mut u8) {
169+
deallocate(ptr, 0, 8);
175170
}
176171

177172
// FIXME: #7496
@@ -212,7 +207,7 @@ pub unsafe extern "C" fn rust_malloc(size: uint, align: uint) -> *mut u8 {
212207
#[deprecated]
213208
#[cfg(not(test))]
214209
pub unsafe extern "C" fn rust_free(ptr: *mut u8, size: uint, align: uint) {
215-
exchange_free(ptr, size, align)
210+
deallocate(ptr, size, align)
216211
}
217212

218213
#[cfg(test)]

branches/try2/src/libstd/slice.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ use ops::Drop;
109109
use option::{None, Option, Some};
110110
use ptr::RawPtr;
111111
use ptr;
112-
use rt::heap::{exchange_malloc, exchange_free};
112+
use rt::heap::{exchange_malloc, deallocate};
113113
use unstable::finally::try_finally;
114114
use vec::Vec;
115115

@@ -330,7 +330,7 @@ impl<'a, T: Clone> CloneableVector<T> for &'a [T] {
330330
ptr::read(&*p.offset(j));
331331
}
332332
// FIXME: #13994 (should pass align and size here)
333-
exchange_free(ret as *mut u8, 0, 8);
333+
deallocate(ret as *mut u8, 0, 8);
334334
});
335335
mem::transmute(ret)
336336
}
@@ -377,7 +377,7 @@ impl<'a, T: Clone> CloneableVector<T> for &'a [T] {
377377
ptr::read(&*p.offset(j));
378378
}
379379
// FIXME: #13994 (should pass align and size here)
380-
exchange_free(ret as *mut u8, 0, 8);
380+
deallocate(ret as *mut u8, 0, 8);
381381
});
382382
mem::transmute(ret)
383383
}
@@ -817,7 +817,7 @@ impl<T> Drop for MoveItems<T> {
817817
for _x in *self {}
818818
unsafe {
819819
// FIXME: #13994 (should pass align and size here)
820-
exchange_free(self.allocation, 0, 8)
820+
deallocate(self.allocation, 0, 8)
821821
}
822822
}
823823
}

branches/try2/src/libsync/arc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
use std::mem;
1717
use std::ptr;
18-
use std::rt::heap::exchange_free;
18+
use std::rt::heap::deallocate;
1919
use std::sync::atomics;
2020
use std::mem::{min_align_of, size_of};
2121

@@ -191,8 +191,8 @@ impl<T: Share + Send> Drop for Arc<T> {
191191

192192
if self.inner().weak.fetch_sub(1, atomics::Release) == 1 {
193193
atomics::fence(atomics::Acquire);
194-
unsafe { exchange_free(self.x as *mut u8, size_of::<ArcInner<T>>(),
195-
min_align_of::<ArcInner<T>>()) }
194+
unsafe { deallocate(self.x as *mut u8, size_of::<ArcInner<T>>(),
195+
min_align_of::<ArcInner<T>>()) }
196196
}
197197
}
198198
}
@@ -242,8 +242,8 @@ impl<T: Share + Send> Drop for Weak<T> {
242242
// the memory orderings
243243
if self.inner().weak.fetch_sub(1, atomics::Release) == 1 {
244244
atomics::fence(atomics::Acquire);
245-
unsafe { exchange_free(self.x as *mut u8, size_of::<ArcInner<T>>(),
246-
min_align_of::<ArcInner<T>>()) }
245+
unsafe { deallocate(self.x as *mut u8, size_of::<ArcInner<T>>(),
246+
min_align_of::<ArcInner<T>>()) }
247247
}
248248
}
249249
}

0 commit comments

Comments
 (0)