From 6818e241b49c03c0fe0994dbe8340e2d8f482f09 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 29 Apr 2013 16:44:21 -0700 Subject: [PATCH] core: Turn off the local heap in newsched in stage0 to work around windows bustage core won't compile in stage0 without. --- src/libcore/unstable/lang.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs index bf3bf5adc0a..cb3f399f591 100644 --- a/src/libcore/unstable/lang.rs +++ b/src/libcore/unstable/lang.rs @@ -90,6 +90,14 @@ pub unsafe fn exchange_free(ptr: *c_char) { #[lang="malloc"] #[inline(always)] +#[cfg(stage0)] // For some reason this isn't working on windows in stage0 +pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char { + return rustrt::rust_upcall_malloc_noswitch(td, size); +} + +#[lang="malloc"] +#[inline(always)] +#[cfg(not(stage0))] pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char { match context() { OldTaskContext => { @@ -110,6 +118,17 @@ pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char { // problem occurs, call exit instead. #[lang="free"] #[inline(always)] +#[cfg(stage0)] +pub unsafe fn local_free(ptr: *c_char) { + rustrt::rust_upcall_free_noswitch(ptr); +} + +// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from +// inside a landing pad may corrupt the state of the exception handler. If a +// problem occurs, call exit instead. +#[lang="free"] +#[inline(always)] +#[cfg(not(stage0))] pub unsafe fn local_free(ptr: *c_char) { match context() { OldTaskContext => {