Skip to content

Commit 8d8044e

Browse files
committed
---
yaml --- r: 6578 b: refs/heads/master c: 98cd96c h: refs/heads/master v: v3
1 parent 88f76b8 commit 8d8044e

File tree

4 files changed

+138
-4
lines changed

4 files changed

+138
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1720bc2e81c274b463d84bec7484dbc5da87333f
2+
refs/heads/master: 98cd96ce96c8be7248e3d375053938354c82878a

trunk/src/rt/rust_upcall.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,22 @@ upcall_dynastack_free(void *ptr) {
209209
return rust_scheduler::get_task()->dynastack.free(ptr);
210210
}
211211

212+
extern "C" void record_sp(void *limit);
213+
212214
/**
213-
* Allocates |nbytes| bytes in the C stack and returns a pointer to the start
214-
* of the allocated space.
215+
* Switch to the C stack and call the given function, passing a single pointer
216+
* argument.
215217
*/
216218
extern "C" CDECL void
217219
upcall_call_shim_on_c_stack(void *args, void *fn_ptr) {
218-
rust_scheduler *sched = rust_scheduler::get_task()->sched;
220+
// FIXME (1226) - The shim functions generated by rustc contain the
221+
// morestack prologue, so we need to let them know they have enough
222+
// stack.
223+
record_sp(0);
224+
rust_task *task = rust_scheduler::get_task();
225+
rust_scheduler *sched = task->sched;
219226
sched->c_context.call_shim_on_c_stack(args, fn_ptr);
227+
task->record_stack_limit();
220228
}
221229

222230
struct rust_new_stack2_args {

trunk/src/test/run-pass/morestack4.rs

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// xfail-test
2+
// compile-flags:--stack-growth
3+
4+
// This is testing for stack frames greater than 256 bytes,
5+
// for which function prologues are generated differently
6+
7+
type biggy = {
8+
a00: u64,
9+
a01: u64,
10+
a02: u64,
11+
a03: u64,
12+
a04: u64,
13+
a05: u64,
14+
a06: u64,
15+
a07: u64,
16+
a08: u64,
17+
a09: u64,
18+
a10: u64,
19+
a11: u64,
20+
a12: u64,
21+
a13: u64,
22+
a14: u64,
23+
a15: u64,
24+
a16: u64,
25+
a17: u64,
26+
a18: u64,
27+
a19: u64,
28+
a20: u64,
29+
a21: u64,
30+
a22: u64,
31+
a23: u64,
32+
a24: u64,
33+
a25: u64,
34+
a26: u64,
35+
a27: u64,
36+
a28: u64,
37+
a29: u64,
38+
a30: u64,
39+
a31: u64,
40+
a32: u64,
41+
a33: u64,
42+
a34: u64,
43+
a35: u64,
44+
a36: u64,
45+
a37: u64,
46+
a38: u64,
47+
a39: u64,
48+
};
49+
50+
51+
fn getbig(i: biggy) {
52+
if i.a00 != 0u64 {
53+
getbig({a00: i.a00 - 1u64 with i});
54+
}
55+
}
56+
57+
fn main() {
58+
getbig({
59+
a00: 100000u64,
60+
a01: 100000u64,
61+
a02: 100000u64,
62+
a03: 100000u64,
63+
a04: 100000u64,
64+
a05: 100000u64,
65+
a06: 100000u64,
66+
a07: 100000u64,
67+
a08: 100000u64,
68+
a09: 100000u64,
69+
a10: 100000u64,
70+
a11: 100000u64,
71+
a12: 100000u64,
72+
a13: 100000u64,
73+
a14: 100000u64,
74+
a15: 100000u64,
75+
a16: 100000u64,
76+
a17: 100000u64,
77+
a18: 100000u64,
78+
a19: 100000u64,
79+
a20: 100000u64,
80+
a21: 100000u64,
81+
a22: 100000u64,
82+
a23: 100000u64,
83+
a24: 100000u64,
84+
a25: 100000u64,
85+
a26: 100000u64,
86+
a27: 100000u64,
87+
a28: 100000u64,
88+
a29: 100000u64,
89+
a30: 100000u64,
90+
a31: 100000u64,
91+
a32: 100000u64,
92+
a33: 100000u64,
93+
a34: 100000u64,
94+
a35: 100000u64,
95+
a36: 100000u64,
96+
a37: 100000u64,
97+
a38: 100000u64,
98+
a39: 100000u64,
99+
});
100+
}

trunk/src/test/run-pass/morestack5.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// xfail-test
2+
// compile-flags:--stack-growth
3+
4+
// This test will call __morestack with various minimum stack sizes
5+
6+
use std;
7+
import std::task;
8+
9+
native mod rustrt {
10+
fn set_min_stack(size: uint);
11+
}
12+
13+
fn getbig(&&i: int) {
14+
if i != 0 {
15+
getbig(i - 1);
16+
}
17+
}
18+
19+
fn main() {
20+
let sz = 400u;
21+
while sz < 500u {
22+
rustrt::set_min_stack(sz);
23+
task::join(task::spawn_joinable(200, getbig));
24+
sz += 1u;
25+
}
26+
}

0 commit comments

Comments
 (0)