Skip to content

Commit a154c5b

Browse files
committed
Um, that'd be, align the word *before* retpc. Addresses point to the low part of a word. Un-XFAIL nbody on Darwin.
1 parent 3e7b991 commit a154c5b

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Makefile.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,6 @@ ifdef CFG_WINDOWSY
587587
TEST_XFAILS_BOOT += $(S)src/test/run-pass/native-mod.rc
588588
TEST_XFAILS_STAGE0 += $(S)src/test/run-pass/native-mod.rc
589589
endif
590-
ifeq ($(CFG_OSTYPE), Darwin)
591-
TEST_XFAILS_STAGE0 += $(S)src/test/bench/shootout/nbody.rs
592-
endif
593590

594591
BENCH_RS = $(wildcard $(S)src/test/bench/shootout/*.rs) \
595592
$(wildcard $(S)src/test/bench/99-bottles/*.rs)

src/rt/rust_task.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ rust_task::start(uintptr_t exit_task_glue,
150150
rust_sp -= sizeof(uintptr_t);
151151

152152
// NB: Darwin needs "16-byte aligned" stacks *at the point of the call
153-
// instruction in the caller*. This means that the address at which a
154-
// retpc is pushed must always be 16-byte aligned.
153+
// instruction in the caller*. This means that the address at which the
154+
// word before retpc is pushed must always be 16-byte aligned.
155155
//
156156
// see: "Mac OS X ABI Function Call Guide"
157157

@@ -168,11 +168,11 @@ rust_task::start(uintptr_t exit_task_glue,
168168

169169

170170
// The exit_task_glue frame we synthesize above the frame we activate:
171-
make_aligned_room_for_bytes(spp, 3 * sizeof(uintptr_t));
171+
make_aligned_room_for_bytes(spp, 2 * sizeof(uintptr_t));
172172
*spp-- = (uintptr_t) 0; // closure-or-obj
173173
*spp-- = (uintptr_t) this; // task
174-
*spp-- = (uintptr_t) 0x0; // output
175174
I(dom, spp == align_down(spp));
175+
*spp-- = (uintptr_t) 0x0; // output
176176
*spp-- = (uintptr_t) 0x0; // retpc
177177

178178
uintptr_t exit_task_frame_base;
@@ -198,9 +198,9 @@ rust_task::start(uintptr_t exit_task_glue,
198198

199199
I(dom, args);
200200
if (spawnee_abi == ABI_X86_RUSTBOOT_CDECL)
201-
make_aligned_room_for_bytes(spp, callsz);
201+
make_aligned_room_for_bytes(spp, callsz - sizeof(uintptr_t));
202202
else
203-
make_aligned_room_for_bytes(spp, callsz - 2 * sizeof(uintptr_t));
203+
make_aligned_room_for_bytes(spp, callsz - 3 * sizeof(uintptr_t));
204204

205205
// Copy args from spawner to spawnee.
206206
uintptr_t *src = (uintptr_t *)args;
@@ -233,7 +233,7 @@ rust_task::start(uintptr_t exit_task_glue,
233233
I(dom, spawnee_abi == ABI_X86_RUSTC_FASTCALL);
234234
}
235235

236-
I(dom, spp == align_down(spp));
236+
I(dom, spp+1 == align_down(spp+1));
237237
*spp-- = (uintptr_t) exit_task_glue; // retpc
238238

239239
// The context the activate_glue needs to switch stack.

0 commit comments

Comments
 (0)