[MLton-commit] r4717

Matthew Fluet fluet at mlton.org
Wed Oct 4 18:37:54 PDT 2006


Don't use a function local variable to hold the true value of %esp, as a function local variable is likely to be addressed via %esp.
----------------------------------------------------------------------

U   mlton/trunk/include/x86-main.h

----------------------------------------------------------------------

Modified: mlton/trunk/include/x86-main.h
===================================================================
--- mlton/trunk/include/x86-main.h	2006-10-04 23:06:34 UTC (rev 4716)
+++ mlton/trunk/include/x86-main.h	2006-10-05 01:37:54 UTC (rev 4717)
@@ -16,6 +16,7 @@
 Word32 checkTemp;
 Word32 cReturnTemp[16];
 Word32 c_stackP;
+Word32 c_stackPTrue;
 Word32 divTemp;
 Word32 eq1Temp;
 Word32 eq2Temp;
@@ -64,11 +65,12 @@
 #define Main(al, mg, mfs, mmc, pk, ps, ml, reserveEsp)                  \
 void MLton_jumpToSML (pointer jump) {                                   \
         Word c_stackPLast;                                              \
-        Word c_stackPThis;                                              \
+        Word c_stackPLastTrue;                                          \
                                                                         \
         if (DEBUG_X86CODEGEN)                                           \
                 fprintf (stderr, "MLton_jumpToSML(0x%08x) starting\n", (uint)jump); \
         c_stackPLast = c_stackP;                                        \
+        c_stackPLastTrue = c_stackPTrue;                                \
         if (reserveEsp)                                                 \
                 __asm__ __volatile__                                    \
                 ("pusha\n\t"                                            \
@@ -81,7 +83,7 @@
                  ".global "ReturnToC"\n"ReturnToC":\n\t"                \
                  "movl %0,%%esp\n\t"                                    \
                  "popa\n"                                               \
-                 : "=o" (c_stackPThis), "=o" (c_stackP)                 \
+                 : "=o" (c_stackPTrue), "=o" (c_stackP)                 \
                 : "o" (gcState.stackTop), "o" (gcState.frontier), "r" (jump) \
                 );                                                      \
         else                                                            \
@@ -96,10 +98,11 @@
                  ".global "ReturnToC"\n"ReturnToC":\n\t"                \
                  "movl %0,%%esp\n\t"                                    \
                  "popa\n"                                               \
-                 : "=o" (c_stackPThis), "=o" (c_stackP)                 \
+                 : "=o" (c_stackPTrue), "=o" (c_stackP)                 \
                 : "o" (gcState.stackTop), "o" (gcState.frontier), "r" (jump) \
                 );                                                      \
         c_stackP = c_stackPLast;                                        \
+        c_stackPTrue = c_stackPLastTrue;                                \
         if (DEBUG_X86CODEGEN)                                           \
                 fprintf (stderr, "MLton_jumpToSML(0x%08x) done\n", (uint)jump); \
         return;                                                         \




More information about the MLton-commit mailing list