Skip to content

Commit

Permalink
core: Turn off the local heap in newsched in stage0 to work around wi…
Browse files Browse the repository at this point in the history
…ndows bustage

core won't compile in stage0 without.
  • Loading branch information
brson committed Apr 29, 2013
1 parent abc49fd commit 6818e24
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/libcore/unstable/lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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 => {
Expand Down

0 comments on commit 6818e24

Please sign in to comment.