Ticket #21743: ocaml.diff

File ocaml.diff, 10.3 KB (added by avsm@…, 15 years ago)

svn diff of the changes

  • files/patch-asmcomp-amd64-emit.mlp.diff

     
     1--- asmcomp/amd64/emit.mlp.orig 2009-03-29 00:10:04.000000000 +0900
     2+++ asmcomp/amd64/emit.mlp      2009-10-01 19:29:16.000000000 +0900
     3@@ -10,7 +10,7 @@
     4 (*                                                                     *)
     5 (***********************************************************************)
     6 
     7-(* $Id: emit.mlp,v 1.16.2.4 2009/03/28 15:10:04 xleroy Exp $ *)
     8+(* $Id: emit.mlp,v 1.16.2.7 2009-09-18 13:49:21 xleroy Exp $ *)
     9 
     10 (* Emission of x86-64 (AMD 64) assembly code *)
     11 
     12@@ -576,33 +576,26 @@
     13             end
     14     | Lswitch jumptbl ->
     15         let lbl = new_label() in
     16-        if !pic_code || !Clflags.dlcode then begin
     17-          (* PR#4424: r11 is known to be clobbered by the Lswitch,
     18-             meaning that no variable that is live across the Lswitch
     19-             is assigned to r11.  However, the argument to Lswitch
     20-             can still be assigned to r11, so we need to special-case
     21-             this situation. *)
     22-          if i.arg.(0).loc = Reg 9 (* ie r11, cf amd64/proc.ml *) then begin
     23-            `  salq    $3, %r11\n`;
     24-            `  pushq   %r11\n`;
     25-            `  leaq    {emit_label lbl}(%rip), %r11\n`;
     26-            `  addq    0(%rsp), %r11\n`;
     27-            `  addq    $8, %rsp\n`;
     28-            `  jmp     *(%r11)\n`
     29-          end else begin
     30-            `  leaq    {emit_label lbl}(%rip), %r11\n`;
     31-            `  jmp     *(%r11, {emit_reg i.arg.(0)}, 8)\n`
     32-          end
     33-        end else begin
     34-          `    jmp     *{emit_label lbl}(, {emit_reg i.arg.(0)}, 8)\n`
     35-        end;
     36+        (* rax and rdx are clobbered by the Lswitch,
     37+           meaning that no variable that is live across the Lswitch
     38+           is assigned to rax or rdx.  However, the argument to Lswitch
     39+           can still be assigned to one of these two registers, so
     40+           we must be careful not to clobber it before use. *)
     41+        let (tmp1, tmp2) =
     42+          if i.arg.(0).loc = Reg 0 (* rax *)
     43+          then (phys_reg 4 (*rdx*), phys_reg 0 (*rax*))
     44+          else (phys_reg 0 (*rax*), phys_reg 4 (*rdx*)) in
     45+        `      leaq    {emit_label lbl}(%rip), {emit_reg tmp1}\n`;
     46+        `      movslq  ({emit_reg tmp1}, {emit_reg i.arg.(0)}, 4), {emit_reg tmp2}\n`;
     47+        `      addq    {emit_reg tmp2}, {emit_reg tmp1}\n`;
     48+        `      jmp     *{emit_reg tmp1}\n`;
     49         if macosx
     50         then ` .const\n`
     51         else ` .section .rodata\n`;
     52-        emit_align 8;
     53+        emit_align 4;
     54         `{emit_label lbl}:`;
     55         for i = 0 to Array.length jumptbl - 1 do
     56-          `    .quad   {emit_label jumptbl.(i)}\n`
     57+          `    .long   {emit_label jumptbl.(i)} - {emit_label lbl}\n`
     58         done;
     59         `      .text\n`
     60     | Lsetuptrap lbl ->
     61@@ -668,7 +661,9 @@
     62   bound_error_call := 0;
     63   `    .text\n`;
     64   emit_align 16;
     65-  if macosx && is_generic_function fundecl.fun_name
     66+  if macosx
     67+  && not !Clflags.output_c_object
     68+  && is_generic_function fundecl.fun_name
     69   then (* PR#4690 *)
     70     `  .private_extern {emit_symbol fundecl.fun_name}\n`
     71   else
     72@@ -713,9 +708,9 @@
     73   | Cint n ->
     74       `        .quad   {emit_nativeint n}\n`
     75   | Csingle f ->
     76-      `        .float  {emit_string f}\n`
     77+      emit_float32_directive ".long" f
     78   | Cdouble f ->
     79-      `        .double {emit_string f}\n`
     80+      emit_float64_directive ".quad" f
     81   | Csymbol_address s ->
     82       `        .quad   {emit_symbol s}\n`
     83   | Clabel_address lbl ->
  • files/patch-asmcomp-amd64-proc.ml.diff

     
     1--- asmcomp/amd64/proc.ml.orig  2009-03-29 00:52:13.000000000 +0900
     2+++ asmcomp/amd64/proc.ml       2009-10-01 19:29:29.000000000 +0900
     3@@ -10,7 +10,7 @@
     4 (*                                                                     *)
     5 (***********************************************************************)
     6 
     7-(* $Id: proc.ml,v 1.5.4.1 2009/03/28 15:52:13 xleroy Exp $ *)
     8+(* $Id: proc.ml,v 1.5.4.2 2009-09-18 13:49:21 xleroy Exp $ *)
     9 
     10 (* Description of the AMD64 processor *)
     11 
     12@@ -92,7 +92,6 @@
     13 let rax = phys_reg 0
     14 let rcx = phys_reg 5
     15 let rdx = phys_reg 4
     16-let r11 = phys_reg 9
     17 let rxmm15 = phys_reg 115
     18 
     19 let stack_slot slot ty =
     20@@ -170,7 +169,7 @@
     21   | Iop(Istore(Single, _)) -> [| rxmm15 |]
     22   | Iop(Ialloc _ | Iintop(Icomp _) | Iintop_imm((Idiv|Imod|Icomp _), _))
     23         -> [| rax |]
     24-  | Iswitch(_, _) when !pic_code || !Clflags.dlcode -> [| r11 |]
     25+  | Iswitch(_, _) -> [| rax; rdx |]
     26   | _ -> [||]
     27 
     28 let destroyed_at_raise = all_phys_regs
  • files/patch-asmcomp-emitaux.ml.diff

     
     1--- asmcomp/emitaux.ml.orig     2009-01-27 02:06:10.000000000 +0900
     2+++ asmcomp/emitaux.ml  2009-10-01 20:03:55.000000000 +0900
     3@@ -10,7 +10,7 @@
     4 (*                                                                     *)
     5 (***********************************************************************)
     6 
     7-(* $Id: emitaux.ml,v 1.12.12.1 2009/01/26 17:06:10 xleroy Exp $ *)
     8+(* $Id: emitaux.ml,v 1.12.12.2 2009-07-15 12:14:39 xleroy Exp $ *)
     9 
     10 (* Common functions for emitting assembly code *)
     11 
     12@@ -93,6 +93,27 @@
     13    done;
     14    if !pos > 0 then emit_char '\n'
     15 
     16+(* PR#4813: assemblers do strange things with float literals indeed,
     17+   so we convert to IEEE representation ourselves and emit float
     18+   literals as 32- or 64-bit integers. *)
     19+
     20+let emit_float64_directive directive f =
     21+  let x = Int64.bits_of_float (float_of_string f) in
     22+  emit_printf "\t%s\t0x%Lx\n" directive x
     23+
     24+let emit_float64_split_directive directive f =
     25+  let x = Int64.bits_of_float (float_of_string f) in
     26+  let lo = Int64.logand x 0xFFFF_FFFFL
     27+  and hi = Int64.shift_right_logical x 32 in
     28+  emit_printf "\t%s\t0x%Lx, 0x%Lx\n"
     29+    directive
     30+    (if Arch.big_endian then hi else lo)
     31+    (if Arch.big_endian then lo else hi)
     32+
     33+let emit_float32_directive directive f =
     34+  let x = Int32.bits_of_float (float_of_string f) in
     35+  emit_printf "\t%s\t0x%lx\n" directive x
     36+
     37 (* Record live pointers at call points *)
     38 
     39 type frame_descr =
  • files/patch-configure.diff

     
     1--- configure.orig      2009-05-21 00:33:09.000000000 +0900
     2+++ configure   2009-10-01 19:35:54.000000000 +0900
     3@@ -373,7 +373,7 @@
     4 echo "#define SIZEOF_PTR $3" >> m.h
     5 echo "#define SIZEOF_SHORT $4" >> m.h
     6 
     7-if test $2 = 8; then
     8+if test $2 = 8 && $system != macosx; then
     9      echo "#define ARCH_INT64_TYPE long" >> m.h
     10      echo "#define ARCH_UINT64_TYPE unsigned long" >> m.h
     11      echo '#define ARCH_INT64_PRINTF_FORMAT "l"' >> m.h
  • files/patch-asmcomp-emitaux.mli.diff

     
     1--- asmcomp/emitaux.mli.orig    2009-01-27 02:06:10.000000000 +0900
     2+++ asmcomp/emitaux.mli 2009-10-01 20:03:59.000000000 +0900
     3@@ -10,7 +10,7 @@
     4 (*                                                                     *)
     5 (***********************************************************************)
     6 
     7-(* $Id: emitaux.mli,v 1.12.12.1 2009/01/26 17:06:10 xleroy Exp $ *)
     8+(* $Id: emitaux.mli,v 1.12.12.2 2009-07-15 12:14:39 xleroy Exp $ *)
     9 
     10 (* Common functions for emitting assembly code *)
     11 
     12@@ -25,6 +25,9 @@
     13 val emit_string_literal: string -> unit
     14 val emit_string_directive: string -> string -> unit
     15 val emit_bytes_directive: string -> string -> unit
     16+val emit_float64_directive: string -> string -> unit
     17+val emit_float64_split_directive: string -> string -> unit
     18+val emit_float32_directive: string -> string -> unit
     19 
     20 type frame_descr =
     21   { fd_lbl: int;                        (* Return address *)
  • files/patch-asmcomp-i386-emit.mlp.diff

     
     1--- asmcomp/i386/emit.mlp.orig  2009-03-29 00:10:04.000000000 +0900
     2+++ asmcomp/i386/emit.mlp       2009-10-01 19:30:07.000000000 +0900
     3@@ -10,7 +10,7 @@
     4 (*                                                                     *)
     5 (***********************************************************************)
     6 
     7-(* $Id: emit.mlp,v 1.41.2.4 2009/03/28 15:10:04 xleroy Exp $ *)
     8+(* $Id: emit.mlp,v 1.41.2.6 2009-09-13 16:48:19 xleroy Exp $ *)
     9 
     10 (* Emission of Intel 386 assembly code *)
     11 
     12@@ -888,7 +888,9 @@
     13   bound_error_call := 0;
     14   `    .text\n`;
     15   emit_align 16;
     16-  if macosx && is_generic_function fundecl.fun_name
     17+  if macosx
     18+  && not !Clflags.output_c_object
     19+  && is_generic_function fundecl.fun_name
     20   then (* PR#4690 *)
     21     `  .private_extern {emit_symbol fundecl.fun_name}\n`
     22   else
     23@@ -928,9 +930,9 @@
     24   | Cint n ->
     25       `        .long   {emit_nativeint n}\n`
     26   | Csingle f ->
     27-      `        .float  {emit_string f}\n`
     28+      emit_float32_directive ".long" f
     29   | Cdouble f ->
     30-      `        .double {emit_string f}\n`
     31+      emit_float64_split_directive ".long" f
     32   | Csymbol_address s ->
     33       `        .long   {emit_symbol s}\n`
     34   | Clabel_address lbl ->
  • Portfile

     
    44
    55name                    ocaml
    66version                 3.11.1
     7revision                1
    78set major_vers  [join [lrange [split ${version} .] 0 1] .]
    89platforms               darwin
    910maintainers             kallisys.net:pguyot openmaintainer
     
    3233set doc_distname        ${name}-${major_vers}-refman
    3334set docdir                      ${prefix}/share/doc/${name}-${version}
    3435
     36# Patchfiles.
     37patchfiles                 patch-asmcomp-amd64-emit.mlp.diff \
     38        patch-asmcomp-amd64-proc.ml.diff \
     39        patch-asmcomp-emitaux.ml.diff \
     40        patch-asmcomp-emitaux.mli.diff \
     41        patch-asmcomp-i386-emit.mlp.diff \
     42        patch-configure.diff
     43
    3544# Configure.
    3645configure.pre_args      -prefix ${prefix}
    3746configure.args          -no-tk -cc ${configure.cc} -aspp \"${configure.cc} -c\"