CFG_RUSTC_FLAGS += -Z trace
endif
ifdef CFG_DISABLE_RPATH
-# NOTE: make this CFG_RUSTC_FLAGS after stage0 snapshot
-RUSTFLAGS_STAGE1 += -C no-rpath
-RUSTFLAGS_STAGE2 += -C no-rpath
-RUSTFLAGS_STAGE3 += -C no-rpath
+CFG_RUSTC_FLAGS += -C no-rpath
endif
# The executables crated during this compilation process have no need to include
# snapshot will be generated with a statically linked rustc so we only have to
# worry about the distribution of one file (with its native dynamic
# dependencies)
-#
-# NOTE: after a snapshot (stage0), put this on stage0 as well
+RUSTFLAGS_STAGE0 += -C prefer-dynamic
RUSTFLAGS_STAGE1 += -C prefer-dynamic
# platform-specific auto-configuration
#[deny(missing_doc)];
extern mod sync;
-#[cfg(not(stage0))]
extern mod serialize;
extern mod collections;
-#[cfg(stage0)]
-pub mod serialize {
- #[allow(missing_doc)];
- // Temp re-export until after a snapshot
- extern mod serialize = "serialize";
- pub use self::serialize::{Encoder, Decoder, Encodable, Decodable,
- EncoderHelpers, DecoderHelpers};
-}
-
// Utility modules
pub mod c_vec;
}
/// Destroys all managed memory (i.e. @ boxes) held by the current task.
-#[cfg(stage0)]
-pub unsafe fn annihilate() {
- use rt::local_heap::local_free;
-
- let mut n_total_boxes = 0u;
-
- // Pass 1: Make all boxes immortal.
- //
- // In this pass, nothing gets freed, so it does not matter whether
- // we read the next field before or after the callback.
- each_live_alloc(true, |alloc| {
- n_total_boxes += 1;
- (*alloc).ref_count = RC_IMMORTAL;
- true
- });
-
- // Pass 2: Drop all boxes.
- //
- // In this pass, unique-managed boxes may get freed, but not
- // managed boxes, so we must read the `next` field *after* the
- // callback, as the original value may have been freed.
- each_live_alloc(false, |alloc| {
- let tydesc = (*alloc).type_desc;
- let data = &(*alloc).data as *();
- ((*tydesc).drop_glue)(data as *i8);
- true
- });
-
- // Pass 3: Free all boxes.
- //
- // In this pass, managed boxes may get freed (but not
- // unique-managed boxes, though I think that none of those are
- // left), so we must read the `next` field before, since it will
- // not be valid after.
- each_live_alloc(true, |alloc| {
- local_free(alloc as *u8);
- true
- });
-
- if debug_mem() {
- // We do logging here w/o allocation.
- debug!("total boxes annihilated: {}", n_total_boxes);
- }
-}
-
-/// Destroys all managed memory (i.e. @ boxes) held by the current task.
-#[cfg(not(stage0))]
pub unsafe fn annihilate() {
use rt::local_heap::local_free;
self.align_to::<&'static u8>();
true
}
-
- // NOTE Remove after next snapshot.
- #[cfg(stage0)]
- fn visit_type(&mut self) -> bool {
- if ! self.inner.visit_type() { return false; }
- true
- }
}
fn visit_param(&mut self, _i: uint) -> bool { true }
fn visit_self(&mut self) -> bool { true }
-
- // NOTE Remove after next snapshot.
- #[cfg(stage0)]
- fn visit_type(&mut self) -> bool { true }
}
pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
use libc::{c_void, size_t, free, malloc, realloc};
use ptr::{RawPtr, mut_null};
-#[cfg(stage0)]
-use unstable::intrinsics::TyDesc;
use unstable::intrinsics::abort;
use unstable::raw;
use mem::size_of;
}
// FIXME: #7496
-#[cfg(not(test), stage0)]
-#[lang="closure_exchange_malloc"]
-#[inline]
-pub unsafe fn closure_exchange_malloc_(td: *u8, size: uint) -> *u8 {
- closure_exchange_malloc(td, size)
-}
-
-// FIXME: #7496
-#[cfg(not(test), not(stage0))]
+#[cfg(not(test))]
#[lang="closure_exchange_malloc"]
#[inline]
pub unsafe fn closure_exchange_malloc_(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
}
#[inline]
-#[cfg(stage0)]
-pub unsafe fn closure_exchange_malloc(td: *u8, size: uint) -> *u8 {
- let td = td as *TyDesc;
- let size = size;
-
- assert!(td.is_not_null());
-
- let total_size = get_box_size(size, (*td).align);
- let p = malloc_raw(total_size);
-
- let alloc = p as *mut raw::Box<()>;
- (*alloc).type_desc = td;
-
- alloc as *u8
-}
-
-#[inline]
-#[cfg(not(stage0))]
pub unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
let total_size = get_box_size(size, align);
let p = malloc_raw(total_size);
use rt::global_heap;
use rt::local::Local;
use rt::task::Task;
-#[cfg(stage0)]
-use unstable::intrinsics::TyDesc;
use unstable::raw;
use vec::ImmutableVector;
}
#[inline]
- #[cfg(stage0)]
- pub fn alloc(&mut self, td: *TyDesc, size: uint) -> *mut Box {
- let total_size = global_heap::get_box_size(size, unsafe { (*td).align });
- let alloc = self.memory_region.malloc(total_size);
- {
- // Make sure that we can't use `mybox` outside of this scope
- let mybox: &mut Box = unsafe { cast::transmute(alloc) };
- // Clear out this box, and move it to the front of the live
- // allocations list
- mybox.type_desc = td;
- mybox.ref_count = 1;
- mybox.prev = ptr::mut_null();
- mybox.next = self.live_allocs;
- if !self.live_allocs.is_null() {
- unsafe { (*self.live_allocs).prev = alloc; }
- }
- self.live_allocs = alloc;
- }
- return alloc;
- }
-
- #[inline]
- #[cfg(not(stage0))]
pub fn alloc(&mut self, drop_glue: fn(*mut u8), size: uint, align: uint) -> *mut Box {
let total_size = global_heap::get_box_size(size, align);
let alloc = self.memory_region.malloc(total_size);
}
#[inline]
- #[cfg(stage0)]
- pub fn free(&mut self, alloc: *mut Box) {
- {
- // Make sure that we can't use `mybox` outside of this scope
- let mybox: &mut Box = unsafe { cast::transmute(alloc) };
- assert!(!mybox.type_desc.is_null());
-
- // Unlink it from the linked list
- if !mybox.prev.is_null() {
- unsafe { (*mybox.prev).next = mybox.next; }
- }
- if !mybox.next.is_null() {
- unsafe { (*mybox.next).prev = mybox.prev; }
- }
- if self.live_allocs == alloc {
- self.live_allocs = mybox.next;
- }
-
- // Destroy the box memory-wise
- if self.poison_on_free {
- unsafe {
- let ptr: *mut u8 = cast::transmute(&mybox.data);
- ptr::set_memory(ptr, 0xab, (*mybox.type_desc).size);
- }
- }
- mybox.prev = ptr::mut_null();
- mybox.next = ptr::mut_null();
- mybox.type_desc = ptr::null();
- }
-
- self.memory_region.free(alloc);
- }
-
- #[inline]
- #[cfg(not(stage0))]
pub fn free(&mut self, alloc: *mut Box) {
{
// Make sure that we can't use `mybox` outside of this scope
}
#[inline]
-#[cfg(stage0)]
-pub unsafe fn local_malloc(td: *u8, size: uint) -> *u8 {
- // FIXME: Unsafe borrow for speed. Lame.
- let task: Option<*mut Task> = Local::try_unsafe_borrow();
- match task {
- Some(task) => {
- (*task).heap.alloc(td as *TyDesc, size) as *u8
- }
- None => rtabort!("local malloc outside of task")
- }
-}
-
-#[inline]
-#[cfg(not(stage0))]
pub unsafe fn local_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
// FIXME: Unsafe borrow for speed. Lame.
let task: Option<*mut Task> = Local::try_unsafe_borrow();
fn visit_trait(&mut self, name: &str) -> bool;
fn visit_param(&mut self, i: uint) -> bool;
fn visit_self(&mut self) -> bool;
-
- // NOTE Remove after next snapshot.
- #[cfg(stage0)]
- fn visit_type(&mut self) -> bool;
}
extern "rust-intrinsic" {
}
#[lang="malloc"]
-#[cfg(stage0)]
-#[inline]
-pub unsafe fn local_malloc(td: *u8, size: uint) -> *u8 {
- ::rt::local_heap::local_malloc(td, size)
-}
-
-#[lang="malloc"]
-#[cfg(not(stage0))]
#[inline]
pub unsafe fn local_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
::rt::local_heap::local_malloc(drop_glue, size, align)
// except according to those terms.
use cast;
-#[cfg(stage0)]
-use unstable::intrinsics::TyDesc;
/// The representation of a Rust managed box
-#[cfg(stage0)]
-pub struct Box<T> {
- ref_count: uint,
- type_desc: *TyDesc,
- prev: *mut Box<T>,
- next: *mut Box<T>,
- data: T
-}
-
-/// The representation of a Rust managed box
-#[cfg(not(stage0))]
pub struct Box<T> {
ref_count: uint,
drop_glue: fn(ptr: *mut u8),
+S 2014-02-12 c62f6ce
+ freebsd-x86_64 737a423c5f803119ff5a692eac432fa9d0c595a8
+ linux-i386 a7e90e27e8b6a3fa79ddc15f0ed217ccbade875d
+ linux-x86_64 8f5fdf9f07b2afbc55d8d8c06c60aeb532b5ea83
+ macos-i386 57bb225f45bc57fef4c34552a2d5814ab4913087
+ macos-x86_64 d37b62478aa1c1dd1babb19d1df494d2aaf59c4c
+ winnt-i386 2c5c5f7228140cd79f120201805504a9e07ad245
+
S 2014-02-03 346d378
freebsd-x86_64 d369c1a83a2be6eb42bd0e550a1adc38ffed0804
linux-i386 a6d4ab441f5b285d7aecbb940fa733526b413f34