[llvm-commits] CVS: llvm/lib/Target/X86/X86JITInfo.cpp

Nate Begeman natebegeman at mac.com
Tue Apr 25 13:54:39 PDT 2006



Changes in directory llvm/lib/Target/X86:

X86JITInfo.cpp updated: 1.15 -> 1.16
---
Log message:

Keep the stack from on darwin 16-byte aligned.  This fixes many JIT
failres.


---
Diffs of the changes:  (+13 -2)

 X86JITInfo.cpp |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/X86/X86JITInfo.cpp
diff -u llvm/lib/Target/X86/X86JITInfo.cpp:1.15 llvm/lib/Target/X86/X86JITInfo.cpp:1.16
--- llvm/lib/Target/X86/X86JITInfo.cpp:1.15	Thu Jan 26 13:55:20 2006
+++ llvm/lib/Target/X86/X86JITInfo.cpp	Tue Apr 25 15:54:26 2006
@@ -59,8 +59,19 @@
     "movl    %esp, %ebp\n"    // Standard prologue
     "pushl   %eax\n"
     "pushl   %edx\n"          // save EAX/EDX
-#if defined(__CYGWIN__) || defined(__APPLE__)
-    "call _X86CompilationCallback2\n"
+#if defined(__CYGWIN__)
+    "call    _X86CompilationCallback2\n"
+#elif defined(__APPLE__)
+    "movl    4(%ebp), %eax\n" // load the address of return address
+    "movl    $24, %edx\n"     // if the opcode of the instruction at the
+    "cmpb    $-51, (%eax)\n"  // return address is our 0xCD marker, then
+    "movl    $12, %eax\n"     // subtract 24 from %esp to realign it to 16
+    "cmovne  %eax, %edx\n"    // bytes after the push of edx, the amount to.
+    "subl    %edx, %esp\n"    // the push of edx to keep it aligned.
+    "pushl   %edx\n"          // subtract.  Otherwise, subtract 12 bytes after
+    "call    _X86CompilationCallback2\n"
+    "popl    %edx\n"
+    "addl    %edx, %esp\n"
 #else
     "call X86CompilationCallback2\n"
 #endif






More information about the llvm-commits mailing list