[MLton-commit] r4716
Matthew Fluet
fluet at mlton.org
Wed Oct 4 16:06:35 PDT 2006
Applied a varition of the patch from Eric McCorkle <eric at shadowsun.net>
for x86-darwin support that changes include/x86-main.h. This assumes
that gcc leaves %esp pointing to the top but of the stack, but not
necessarily 16-byte aligned. Not tested extensively yet.
----------------------------------------------------------------------
U mlton/trunk/include/x86-main.h
----------------------------------------------------------------------
Modified: mlton/trunk/include/x86-main.h
===================================================================
--- mlton/trunk/include/x86-main.h 2006-09-30 02:03:32 UTC (rev 4715)
+++ mlton/trunk/include/x86-main.h 2006-10-04 23:06:34 UTC (rev 4716)
@@ -63,24 +63,43 @@
#define Main(al, mg, mfs, mmc, pk, ps, ml, reserveEsp) \
void MLton_jumpToSML (pointer jump) { \
- Word lc_stackP; \
+ Word c_stackPLast; \
+ Word c_stackPThis; \
\
if (DEBUG_X86CODEGEN) \
fprintf (stderr, "MLton_jumpToSML(0x%08x) starting\n", (uint)jump); \
- lc_stackP = c_stackP; \
+ c_stackPLast = c_stackP; \
if (reserveEsp) \
__asm__ __volatile__ \
- ("pusha\nmovl %%esp,%0\nmovl %1,%%ebp\nmovl %2,%%edi\njmp *%3\n.global "ReturnToC"\n"ReturnToC":\nmovl %0,%%esp\npopa" \
- : "=o" (c_stackP) \
+ ("pusha\n\t" \
+ "movl %%esp,%0\n\t" \
+ "andl $-16,%%esp\n\t" \
+ "movl %%esp,%1\n\t" \
+ "movl %2,%%ebp\n\t" \
+ "movl %3,%%edi\n\t" \
+ "jmp *%4\n" \
+ ".global "ReturnToC"\n"ReturnToC":\n\t" \
+ "movl %0,%%esp\n\t" \
+ "popa\n" \
+ : "=o" (c_stackPThis), "=o" (c_stackP) \
: "o" (gcState.stackTop), "o" (gcState.frontier), "r" (jump) \
); \
else \
__asm__ __volatile__ \
- ("pusha\nmovl %%esp,%0\nmovl %1,%%ebp\nmovl %2,%%esp\njmp *%3\n.global "ReturnToC"\n"ReturnToC":\nmovl %0,%%esp\npopa" \
- : "=o" (c_stackP) \
+ ("pusha\n\t" \
+ "movl %%esp,%0\n\t" \
+ "andl $-16,%%esp\n\t" \
+ "movl %%esp,%1\n\t" \
+ "movl %2,%%ebp\n\t" \
+ "movl %3,%%esp\n\t" \
+ "jmp *%4\n" \
+ ".global "ReturnToC"\n"ReturnToC":\n\t" \
+ "movl %0,%%esp\n\t" \
+ "popa\n" \
+ : "=o" (c_stackPThis), "=o" (c_stackP) \
: "o" (gcState.stackTop), "o" (gcState.frontier), "r" (jump) \
); \
- c_stackP = lc_stackP; \
+ c_stackP = c_stackPLast; \
if (DEBUG_X86CODEGEN) \
fprintf (stderr, "MLton_jumpToSML(0x%08x) done\n", (uint)jump); \
return; \
More information about the MLton-commit
mailing list