Skip to content

Commit eda8665

Browse files
committed
---
yaml --- r: 118577 b: refs/heads/try c: 051abae h: refs/heads/master i: 118575: 6a5a3c6 v: v3
1 parent 79a4f61 commit eda8665

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: b1646cbfd908dc948b251e362669af421100647a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d6736a1440d42f6af967a8a20ab8d73522112b72
5-
refs/heads/try: 4cd932f94e76046500e180bc941e36a2a17cade8
5+
refs/heads/try: 051abae802318d8401c9b5e6baa9ffc863f7f8eb
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/liballoc/heap.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
130130

131131
#[cfg(jemalloc)]
132132
mod imp {
133-
use core::intrinsics::abort;
134133
use core::option::{None, Option};
135134
use core::ptr::{RawPtr, mut_null, null};
136135
use core::num::Bitwise;
@@ -163,7 +162,7 @@ mod imp {
163162
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
164163
let ptr = je_mallocx(size as size_t, mallocx_align(align)) as *mut u8;
165164
if ptr.is_null() {
166-
abort()
165+
::oom()
167166
}
168167
ptr
169168
}
@@ -174,7 +173,7 @@ mod imp {
174173
let ptr = je_rallocx(ptr as *mut c_void, size as size_t,
175174
mallocx_align(align)) as *mut u8;
176175
if ptr.is_null() {
177-
abort()
176+
::oom()
178177
}
179178
ptr
180179
}

branches/try/src/liballoc/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ pub mod owned;
9494
pub mod arc;
9595
pub mod rc;
9696

97+
/// Common OOM routine used by liballoc
98+
fn oom() -> ! {
99+
// FIXME(#14674): This really needs to do something other than just abort
100+
// here, but any printing done must be *guaranteed* to not
101+
// allocate.
102+
unsafe { core::intrinsics::abort() }
103+
}
104+
97105
// FIXME(#14344): When linking liballoc with libstd, this library will be linked
98106
// as an rlib (it only exists as an rlib). It turns out that an
99107
// optimized standard library doesn't actually use *any* symbols

branches/try/src/liballoc/libc_heap.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
1414
use libc::{c_void, size_t, free, malloc, realloc};
1515
use core::ptr::{RawPtr, mut_null};
16-
use core::intrinsics::abort;
1716

1817
/// A wrapper around libc::malloc, aborting on out-of-memory
1918
#[inline]
@@ -25,8 +24,7 @@ pub unsafe fn malloc_raw(size: uint) -> *mut u8 {
2524
} else {
2625
let p = malloc(size as size_t);
2726
if p.is_null() {
28-
// we need a non-allocating way to print an error here
29-
abort();
27+
::oom();
3028
}
3129
p as *mut u8
3230
}
@@ -43,8 +41,7 @@ pub unsafe fn realloc_raw(ptr: *mut u8, size: uint) -> *mut u8 {
4341
} else {
4442
let p = realloc(ptr as *mut c_void, size as size_t);
4543
if p.is_null() {
46-
// we need a non-allocating way to print an error here
47-
abort();
44+
::oom();
4845
}
4946
p as *mut u8
5047
}

0 commit comments

Comments
 (0)