Skip to content

Commit 0a03ce9

Browse files
committed
Implement black box inside test file
1 parent 1f0706c commit 0a03ce9

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

src/arch/i686.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ GLOBAL(__stacker_stack_pointer):
66
mov %esp, %eax
77
ret
88

9-
GLOBAL(__stacker_black_box):
10-
ret
11-
129
GLOBAL(__stacker_switch_stacks):
1310
// CFI instructions tells the unwinder how to unwind this function
1411
// This enables unwinding through our extended stacks and also

src/arch/windows.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include <windows.h>
22

3-
void __stacker_black_box() {}
4-
53
PVOID __stacker_get_current_fiber() {
64
return GetCurrentFiber();
75
}

src/arch/x86_64.S

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
.text
44

5-
GLOBAL(__stacker_black_box):
6-
ret
75
GLOBAL(__stacker_stack_pointer):
86
movq %rsp, %rax
97
ret

tests/smoke.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@ extern crate stacker;
33
use std::sync::mpsc;
44
use std::thread;
55

6-
extern {
7-
fn __stacker_black_box(t: *const u8);
8-
}
6+
#[inline(never)]
7+
fn __stacker_black_box(_: *const u8) {}
98

109
#[test]
1110
fn deep() {
1211
fn foo(n: usize, s: &mut [u8]) {
13-
unsafe { __stacker_black_box(s.as_ptr()); }
12+
__stacker_black_box(s.as_ptr());
1413
if n > 0 {
1514
stacker::maybe_grow(64 * 1024, 1024 * 1024, || {
1615
let mut s = [0u8; 1024];
1716
foo(n - 1, &mut s);
18-
unsafe { __stacker_black_box(s.as_ptr()); }
17+
__stacker_black_box(s.as_ptr());
1918
})
2019
} else {
2120
println!("bottom");
@@ -28,12 +27,12 @@ fn deep() {
2827
#[test]
2928
fn panic() {
3029
fn foo(n: usize, s: &mut [u8]) {
31-
unsafe { __stacker_black_box(s.as_ptr()); }
30+
__stacker_black_box(s.as_ptr());
3231
if n > 0 {
3332
stacker::maybe_grow(64 * 1024, 1024 * 1024, || {
3433
let mut s = [0u8; 1024];
3534
foo(n - 1, &mut s);
36-
unsafe { __stacker_black_box(s.as_ptr()); }
35+
__stacker_black_box(s.as_ptr());
3736
})
3837
} else {
3938
panic!("bottom");
@@ -84,4 +83,4 @@ fn catch_panic_leaf() {
8483
let panic_result = std::panic::catch_unwind(|| panic!());
8584
assert!(panic_result.is_err());
8685
});
87-
}
86+
}

0 commit comments

Comments
 (0)