about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2011-03-30 14:10:06 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-03-30 14:10:06 -0700
commita154c5b656ea215f136a6f4c3120b315686f4bc5 (patch)
treef2887f040b335f6dcfff931d496db7661b23c2a5
parent3e7b991d4957a13e8049c1a4d1893a685f47d9ae (diff)
Um, that'd be, align the word *before* retpc. Addresses point to the low part of a word. Un-XFAIL nbody on Darwin.
-rw-r--r--Makefile.in3
-rw-r--r--src/rt/rust_task.cpp14
2 files changed, 7 insertions, 10 deletions
diff --git a/Makefile.in b/Makefile.in
index e08138badb2..97c70c699d2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -587,9 +587,6 @@ ifdef CFG_WINDOWSY
 TEST_XFAILS_BOOT += $(S)src/test/run-pass/native-mod.rc
 TEST_XFAILS_STAGE0 += $(S)src/test/run-pass/native-mod.rc
 endif
-ifeq ($(CFG_OSTYPE), Darwin)
-TEST_XFAILS_STAGE0 += $(S)src/test/bench/shootout/nbody.rs
-endif
 
 BENCH_RS = $(wildcard $(S)src/test/bench/shootout/*.rs) \
             $(wildcard $(S)src/test/bench/99-bottles/*.rs)
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index febfd85162c..df7dd2a3531 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -150,8 +150,8 @@ rust_task::start(uintptr_t exit_task_glue,
     rust_sp -= sizeof(uintptr_t);
 
     // NB: Darwin needs "16-byte aligned" stacks *at the point of the call
-    // instruction in the caller*. This means that the address at which a
-    // retpc is pushed must always be 16-byte aligned.
+    // instruction in the caller*. This means that the address at which the
+    // word before retpc is pushed must always be 16-byte aligned.
     //
     // see: "Mac OS X ABI Function Call Guide"
 
@@ -168,11 +168,11 @@ rust_task::start(uintptr_t exit_task_glue,
 
 
     // The exit_task_glue frame we synthesize above the frame we activate:
-    make_aligned_room_for_bytes(spp, 3 * sizeof(uintptr_t));
+    make_aligned_room_for_bytes(spp, 2 * sizeof(uintptr_t));
     *spp-- = (uintptr_t) 0;          // closure-or-obj
     *spp-- = (uintptr_t) this;       // task
-    *spp-- = (uintptr_t) 0x0;        // output
     I(dom, spp == align_down(spp));
+    *spp-- = (uintptr_t) 0x0;        // output
     *spp-- = (uintptr_t) 0x0;        // retpc
 
     uintptr_t exit_task_frame_base;
@@ -198,9 +198,9 @@ rust_task::start(uintptr_t exit_task_glue,
 
     I(dom, args);
     if (spawnee_abi == ABI_X86_RUSTBOOT_CDECL)
-        make_aligned_room_for_bytes(spp, callsz);
+        make_aligned_room_for_bytes(spp, callsz - sizeof(uintptr_t));
     else
-        make_aligned_room_for_bytes(spp, callsz - 2 * sizeof(uintptr_t));
+        make_aligned_room_for_bytes(spp, callsz - 3 * sizeof(uintptr_t));
 
     // Copy args from spawner to spawnee.
     uintptr_t *src = (uintptr_t *)args;
@@ -233,7 +233,7 @@ rust_task::start(uintptr_t exit_task_glue,
         I(dom, spawnee_abi == ABI_X86_RUSTC_FASTCALL);
     }
 
-    I(dom, spp == align_down(spp));
+    I(dom, spp+1 == align_down(spp+1));
     *spp-- = (uintptr_t) exit_task_glue;  // retpc
 
     // The context the activate_glue needs to switch stack.