Skip to content

Commit

Permalink
Register new snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Feb 13, 2014
1 parent 44e6883 commit 1c5295c
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 202 deletions.
8 changes: 2 additions & 6 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ ifdef TRACE
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
Expand All @@ -140,8 +137,7 @@ endif
# 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
Expand Down
10 changes: 0 additions & 10 deletions src/libextra/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,10 @@ Rust extras are part of the standard Rust distribution.
#[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;
Expand Down
47 changes: 0 additions & 47 deletions src/libstd/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,53 +57,6 @@ fn debug_mem() -> bool {
}

/// 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;

Expand Down
7 changes: 0 additions & 7 deletions src/libstd/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,4 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
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
}
}
4 changes: 0 additions & 4 deletions src/libstd/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,6 @@ impl<'a> TyVisitor for ReprVisitor<'a> {

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<()> {
Expand Down
30 changes: 1 addition & 29 deletions src/libstd/rt/global_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

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;
Expand Down Expand Up @@ -75,40 +73,14 @@ pub unsafe fn exchange_malloc(size: uint) -> *u8 {
}

// 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 {
closure_exchange_malloc(drop_glue, size, align)
}

#[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);
Expand Down
74 changes: 0 additions & 74 deletions src/libstd/rt/local_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ use rt::env;
use rt::global_heap;
use rt::local::Local;
use rt::task::Task;
#[cfg(stage0)]
use unstable::intrinsics::TyDesc;
use unstable::raw;
use vec::ImmutableVector;

Expand Down Expand Up @@ -61,29 +59,6 @@ impl LocalHeap {
}

#[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);
Expand Down Expand Up @@ -126,41 +101,6 @@ impl LocalHeap {
}

#[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
Expand Down Expand Up @@ -339,20 +279,6 @@ impl Drop for MemoryRegion {
}

#[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();
Expand Down
4 changes: 0 additions & 4 deletions src/libstd/unstable/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ pub trait TyVisitor {
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" {
Expand Down
8 changes: 0 additions & 8 deletions src/libstd/unstable/lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ pub fn fail_bounds_check(file: *u8, line: uint, index: uint, len: uint) -> ! {
}

#[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)
Expand Down
13 changes: 0 additions & 13 deletions src/libstd/unstable/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,8 @@
// 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),
Expand Down
8 changes: 8 additions & 0 deletions src/snapshots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
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
Expand Down

0 comments on commit 1c5295c

Please sign in to comment.