[MLton-commit] r4711
Matthew Fluet
fluet at mlton.org
Wed Sep 27 15:02:41 PDT 2006
Most of patch from Eric McCorkle <eric at shadowsun.net> for x86-darwin
support; haven't applied the more extensive changes to
include/x86-main.h, as I'm hoping that they are not needed with the
previous fix to the C calling convention code.
----------------------------------------------------------------------
U mlton/trunk/include/x86-main.h
U mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun
U mlton/trunk/mlton/codegen/x86-codegen/x86.fun
U mlton/trunk/mlton/main/main.fun
U mlton/trunk/runtime/platform/darwin.c
----------------------------------------------------------------------
Modified: mlton/trunk/include/x86-main.h
===================================================================
--- mlton/trunk/include/x86-main.h 2006-09-27 17:28:04 UTC (rev 4710)
+++ mlton/trunk/include/x86-main.h 2006-09-27 22:02:38 UTC (rev 4711)
@@ -49,7 +49,7 @@
#define DEBUG_X86CODEGEN FALSE
#endif
-#if (defined (__CYGWIN__) || defined (__MSVCRT__))
+#if (defined (__CYGWIN__) || defined (__Darwin__) || defined (__MSVCRT__))
#define ReturnToC "_Thread_returnToC"
#elif (defined (__FreeBSD__) || defined (__linux__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__sun__))
#define ReturnToC "Thread_returnToC"
Modified: mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun
===================================================================
--- mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun 2006-09-27 17:28:04 UTC (rev 4710)
+++ mlton/trunk/mlton/codegen/x86-codegen/x86-generate-transfers.fun 2006-09-27 22:02:38 UTC (rev 4711)
@@ -1155,6 +1155,22 @@
(AppendList.append (assembly_arg, assembly_args),
size_arg + size_args)
end)
+ val (pushArgs, size_args) =
+ let
+ val space = 16 - (size_args mod 16)
+ in
+ if space = 16
+ then (pushArgs, size_args)
+ else (AppendList.append
+ (AppendList.single
+ (Assembly.instruction_binal
+ {oper = Instruction.SUB,
+ dst = c_stackP,
+ src = Operand.immediate_const_int space,
+ size = pointerSize}),
+ pushArgs),
+ size_args + space)
+ end
val flush =
case frameInfo of
SOME (FrameInfo.T {size, ...}) =>
Modified: mlton/trunk/mlton/codegen/x86-codegen/x86.fun
===================================================================
--- mlton/trunk/mlton/codegen/x86-codegen/x86.fun 2006-09-27 17:28:04 UTC (rev 4710)
+++ mlton/trunk/mlton/codegen/x86-codegen/x86.fun 2006-09-27 22:02:38 UTC (rev 4711)
@@ -3509,7 +3509,7 @@
=> seq [str ".long ",
seq (separate(List.map (ls, Immediate.layout), ","))]
| String ss
- => seq [str ".string ",
+ => seq [str ".ascii ",
seq (separate(List.map
(ss,
fn s => seq [str "\"",
@@ -3517,7 +3517,7 @@
str "\""]),
","))]
| Global l
- => seq [str ".global ",
+ => seq [str ".globl ",
Label.layout l]
| Local l
=> seq [str ".local ",
Modified: mlton/trunk/mlton/main/main.fun
===================================================================
--- mlton/trunk/mlton/main/main.fun 2006-09-27 17:28:04 UTC (rev 4710)
+++ mlton/trunk/mlton/main/main.fun 2006-09-27 22:02:38 UTC (rev 4711)
@@ -566,6 +566,7 @@
val () =
Control.labelsHaveExtra_ := (case targetOS of
Cygwin => true
+ | Darwin => true
| MinGW => true
| _ => false)
val OSStr = String.toLower (MLton.Platform.OS.toString targetOS)
Modified: mlton/trunk/runtime/platform/darwin.c
===================================================================
--- mlton/trunk/runtime/platform/darwin.c 2006-09-27 17:28:04 UTC (rev 4710)
+++ mlton/trunk/runtime/platform/darwin.c 2006-09-27 22:02:38 UTC (rev 4711)
@@ -10,7 +10,11 @@
#include "use-mmap.c"
static void catcher (int sig, siginfo_t *sip, ucontext_t *ucp) {
+#if (defined(__powerpc__) || defined(__ppc__))
GC_handleSigProf ((pointer) ucp->uc_mcontext->ss.srr0);
+#elif (defined(__i386__))
+ GC_handleSigProf ((pointer) ucp->uc_mcontext->ss.eip);
+#endif
}
void setSigProfHandler (struct sigaction *sa) {
More information about the MLton-commit
mailing list