Skip to content

Commit 6818e24

Browse files
committed
core: Turn off the local heap in newsched in stage0 to work around windows bustage
core won't compile in stage0 without.
1 parent abc49fd commit 6818e24

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/libcore/unstable/lang.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ pub unsafe fn exchange_free(ptr: *c_char) {
9090

9191
#[lang="malloc"]
9292
#[inline(always)]
93+
#[cfg(stage0)] // For some reason this isn't working on windows in stage0
94+
pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
95+
return rustrt::rust_upcall_malloc_noswitch(td, size);
96+
}
97+
98+
#[lang="malloc"]
99+
#[inline(always)]
100+
#[cfg(not(stage0))]
93101
pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
94102
match context() {
95103
OldTaskContext => {
@@ -110,6 +118,17 @@ pub unsafe fn local_malloc(td: *c_char, size: uintptr_t) -> *c_char {
110118
// problem occurs, call exit instead.
111119
#[lang="free"]
112120
#[inline(always)]
121+
#[cfg(stage0)]
122+
pub unsafe fn local_free(ptr: *c_char) {
123+
rustrt::rust_upcall_free_noswitch(ptr);
124+
}
125+
126+
// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
127+
// inside a landing pad may corrupt the state of the exception handler. If a
128+
// problem occurs, call exit instead.
129+
#[lang="free"]
130+
#[inline(always)]
131+
#[cfg(not(stage0))]
113132
pub unsafe fn local_free(ptr: *c_char) {
114133
match context() {
115134
OldTaskContext => {

0 commit comments

Comments
 (0)