auto merge of #8705 : brson/rust/lesscxx, r=graydon

This commit is contained in:
bors 2013-08-23 18:41:30 -07:00
commit f9979247d1
25 changed files with 116 additions and 838 deletions

View file

@ -40,12 +40,10 @@ impl LocalHeap {
#[fixed_stack_segment] #[inline(never)]
pub fn new() -> LocalHeap {
unsafe {
// Don't need synchronization for the single-threaded local heap
let synchronized = false as uintptr_t;
// XXX: These usually come from the environment
let detailed_leaks = false as uintptr_t;
let poison_on_free = false as uintptr_t;
let region = rust_new_memory_region(synchronized, detailed_leaks, poison_on_free);
let region = rust_new_memory_region(detailed_leaks, poison_on_free);
assert!(region.is_not_null());
let boxed = rust_new_boxed_region(region, poison_on_free);
assert!(boxed.is_not_null());
@ -109,8 +107,7 @@ pub fn live_allocs() -> *raw::Box<()> {
extern {
#[fast_ffi]
fn rust_new_memory_region(synchronized: uintptr_t,
detailed_leaks: uintptr_t,
fn rust_new_memory_region(detailed_leaks: uintptr_t,
poison_on_free: uintptr_t) -> *MemoryRegion;
#[fast_ffi]
fn rust_delete_memory_region(region: *MemoryRegion);

View file

@ -224,10 +224,7 @@ pub fn init(argc: int, argv: **u8, crate_map: *u8) {
args::init(argc, argv);
env::init();
logging::init(crate_map);
rust_update_gc_metadata(crate_map);
}
externfn!(fn rust_update_gc_metadata(crate_map: *u8));
}
/// One-time runtime cleanup.

View file

@ -14,6 +14,7 @@ use libc;
use option::{Some, None};
use os;
use str::StrSlice;
use unstable::atomics::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
#[cfg(target_os="macos")]
use unstable::running_on_valgrind;
@ -129,24 +130,12 @@ memory and partly incapable of presentation to others.",
}
}
pub fn set_exit_status(code: int) {
#[fixed_stack_segment]; #[inline(never)];
unsafe {
return rust_set_exit_status_newrt(code as libc::uintptr_t);
}
static mut EXIT_STATUS: AtomicInt = INIT_ATOMIC_INT;
extern {
fn rust_set_exit_status_newrt(code: libc::uintptr_t);
}
pub fn set_exit_status(code: int) {
unsafe { EXIT_STATUS.store(code, SeqCst) }
}
pub fn get_exit_status() -> int {
#[fixed_stack_segment]; #[inline(never)];
unsafe {
return rust_get_exit_status_newrt() as int;
}
extern {
fn rust_get_exit_status_newrt() -> libc::uintptr_t;
}
unsafe { EXIT_STATUS.load(SeqCst) }
}