Skip to content

Commit 1ff2217

Browse files
committed
---
yaml --- r: 6509 b: refs/heads/master c: afb8f01 h: refs/heads/master i: 6507: 8c241e4 v: v3
1 parent 49a2d8a commit 1ff2217

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 9675343dc975a0159d5f7b52e4a7f72737f0549c
2+
refs/heads/master: afb8f0174170cb9f23ec0b8a93f4bb8dd4514603

trunk/src/rt/arch/x86_64/morestack.S

+4-3
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ MORESTACK:
7676
pushq %r8
7777
pushq %r9
7878

79-
// Calculate the address of the stack arguments
79+
// Calculate the address of the stack arguments.
80+
// We have the base pointer, __morestack's return address,
81+
// and __morestack's caller's return address to skip
8082
movq %rbp, %rcx
81-
addq $16, %rcx // Add the saved %rbp, and return address
82-
addq %r11, %rcx // Add the size of stack arguments
83+
addq $24, %rcx // Base pointer, return address x2
8384

8485
pushq %rbp // Save the Rust stack pointer
8586
pushq %r11 // Size of stack arguments

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

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// xfail-test
2+
// compile-flags:--stack-growth
3+
4+
// Here we're testing that all of the argument registers, argument
5+
// stack slots, and return value are preserved across split stacks.
6+
fn getbig(a0: int,
7+
a1: int,
8+
a2: int,
9+
a3: int,
10+
a4: int,
11+
a5: int,
12+
a6: int,
13+
a7: int,
14+
a8: int,
15+
a9: int) -> int {
16+
17+
assert a0 + 1 == a1;
18+
assert a1 + 1 == a2;
19+
assert a2 + 1 == a3;
20+
assert a3 + 1 == a4;
21+
assert a4 + 1 == a5;
22+
assert a5 + 1 == a6;
23+
assert a6 + 1 == a7;
24+
assert a7 + 1 == a8;
25+
assert a8 + 1 == a9;
26+
if a0 != 0 {
27+
let j = getbig(a0 - 1,
28+
a1 - 1,
29+
a2 - 1,
30+
a3 - 1,
31+
a4 - 1,
32+
a5 - 1,
33+
a6 - 1,
34+
a7 - 1,
35+
a8 - 1,
36+
a9 - 1);
37+
assert j == a0 - 1;
38+
}
39+
ret a0;
40+
}
41+
42+
fn main() {
43+
let a = 1000000;
44+
getbig(a, a+1, a+2, a+3, a+4, a+5, a+6, a+7, a+8, a+9);
45+
}

0 commit comments

Comments
 (0)