Imported Upstream version 3.11.0~rc1
authorStephane Glondu <steph@glondu.net>
Sat, 29 Nov 2008 10:16:28 +0000 (11:16 +0100)
committerStephane Glondu <steph@glondu.net>
Sat, 29 Nov 2008 10:16:28 +0000 (11:16 +0100)
116 files changed:
Changes
INSTALL
Makefile
Makefile.nt
VERSION
_tags
asmcomp/amd64/emit.mlp
asmcomp/amd64/selection.ml
asmcomp/i386/emit.mlp
asmrun/.depend
asmrun/amd64.S
asmrun/signals_osdep.h
asmrun/startup.c
boot/myocamlbuild.boot
boot/ocamlc
boot/ocamldep
boot/ocamllex
build/.cvsignore [new file with mode: 0644]
build/buildbot
build/camlp4-byte-only.sh
build/camlp4-native-only.sh
build/distclean.sh
build/fastworld.sh
build/mixed-boot.sh [new file with mode: 0755]
build/ocamlbuild-byte-only.sh
build/ocamlbuild-native-only.sh
build/ocamlbuildlib-native-only.sh
build/partial-boot.sh [deleted file]
build/world.sh
byterun/.depend
byterun/Makefile
byterun/config.h
byterun/freelist.c
byterun/freelist.h
byterun/gc_ctrl.c
byterun/major_gc.c
byterun/memory.c
byterun/memory.h
byterun/startup.c
camlp4/Camlp4/PreCast.ml
camlp4/Camlp4/Printers/DumpCamlp4Ast.ml
camlp4/Camlp4/Printers/DumpOCamlAst.ml
camlp4/Camlp4/Printers/Null.ml
camlp4/Camlp4/Printers/OCaml.ml
camlp4/Camlp4/Printers/OCamlr.ml
camlp4/Camlp4/Sig.ml
camlp4/Camlp4/Struct/AstFilters.ml
camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.mli
camlp4/Camlp4/Struct/DynLoader.ml
camlp4/Camlp4/Struct/Grammar/Fold.ml
camlp4/Camlp4/Struct/Grammar/Fold.mli
camlp4/Camlp4/Struct/Grammar/Parser.mli
camlp4/Camlp4/Struct/Lexer.mll
camlp4/Camlp4/Struct/Quotation.ml
camlp4/Camlp4Bin.ml
camlp4/Camlp4Filters/Camlp4AstLifter.ml
camlp4/Camlp4Filters/Camlp4ExceptionTracer.ml
camlp4/Camlp4Filters/Camlp4FoldGenerator.ml
camlp4/Camlp4Filters/Camlp4LocationStripper.ml
camlp4/Camlp4Filters/Camlp4MapGenerator.ml
camlp4/Camlp4Filters/Camlp4Profiler.ml
camlp4/Camlp4Filters/Camlp4TrashRemover.ml
camlp4/Camlp4Parsers/Camlp4AstLoader.ml
camlp4/Camlp4Parsers/Camlp4DebugParser.ml
camlp4/Camlp4Parsers/Camlp4GrammarParser.ml
camlp4/Camlp4Parsers/Camlp4ListComprehension.ml
camlp4/Camlp4Parsers/Camlp4MacroParser.ml
camlp4/Camlp4Parsers/Camlp4OCamlParser.ml
camlp4/Camlp4Parsers/Camlp4OCamlParserParser.ml
camlp4/Camlp4Parsers/Camlp4OCamlReloadedParser.ml
camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.ml
camlp4/Camlp4Parsers/Camlp4OCamlRevisedParserParser.ml
camlp4/Camlp4Parsers/Camlp4QuotationCommon.ml
camlp4/Camlp4Parsers/Camlp4QuotationExpander.ml
camlp4/Camlp4Top/Rprint.ml
camlp4/Camlp4Top/Top.ml
camlp4/Makefile
camlp4/boot/Camlp4.ml
camlp4/boot/Makefile
camlp4/boot/camlp4boot.ml
camlp4/man/Makefile
camlp4/mkcamlp4.ml
config/Makefile.mingw
config/Makefile.msvc
configure
driver/optcompile.ml
emacs/caml.el
man/ocamlc.m
man/ocamlopt.m
man/ocamlrun.m
myocamlbuild.ml
ocamlbuild/display.ml
ocamlbuild/main.ml
ocamlbuild/ocaml_specific.ml
ocamlbuild/plugin.ml
ocamldoc/odoc_html.ml
ocamldoc/odoc_man.ml
ocamldoc/odoc_ocamlhtml.mll
otherlibs/bigarray/bigarray.h
otherlibs/bigarray/bigarray_stubs.c
otherlibs/labltk/browser/Makefile.nt
otherlibs/labltk/browser/Makefile.shared
otherlibs/labltk/browser/winmain.c
otherlibs/win32unix/select.c
stdlib/filename.ml
stdlib/gc.ml
stdlib/gc.mli
stdlib/string.ml
stdlib/weak.mli
tools/make-package-macosx
toplevel/opttopdirs.ml
toplevel/topdirs.ml
typing/ctype.mli
typing/includecore.ml
utils/ccomp.ml

diff --git a/Changes b/Changes
index 64cfa97bde653052dc1af4c83dbd9cfd7c174d6b..85ea121793366ef5b9ec1d8d5cc86ab2788c4411 100644 (file)
--- a/Changes
+++ b/Changes
@@ -8,6 +8,8 @@ Language features:
   after forcing, match the pattern <pat>.
 - Introduction of private abbreviation types "type t = private <type-expr>",
   for abstracting the actual manifest type in type abbreviations.
+- Subtyping is now allowed between a private abbreviation and its definition,
+  and between a polymorphic method and its monomorphic instance.
 
 Compilers:
 - The file name for a compilation unit should correspond to a valid
@@ -34,6 +36,7 @@ Compilers:
    float fields).
 
 Native-code compiler:
+- New port: Mac OS X / Intel in 64-bit mode (configure with -cc "gcc -m64").
 - A new option "-shared" to produce a plugin that can be dynamically
   loaded with the native version of Dynlink.
 - A new option "-nodynlink" to enable optimizations valid only for code
@@ -42,9 +45,8 @@ Native-code compiler:
 - Can select which assembler and asm options to use at configuration time.
 
 Run-time system:
-- Changes in freelist management to reduce fragmentation.
-- New implementation of the page table describing the heap (a sparse
-  hashtable replaces a dense bitvector), fixes issues with address
+- New implementation of the page table describing the heap (two-level
+  array in 32 bits, sparse hashtable in 64 bits), fixes issues with address
   space randomization on 64-bit OS (PR#4448).
 - New "generational" API for registering global memory roots with the GC,
   enables faster scanning of global roots.
@@ -54,6 +56,9 @@ Run-time system:
 - Changes in implementation of dynamic linking of C code:
   under Win32, use Alain Frisch's flexdll implementation of the dlopen
   API; under MacOSX, use dlopen API instead of MacOSX bundle API.
+- Programs may now choose a first-fit allocation policy instead of
+  the default next-fit.  First-fit reduces fragmentation but is
+  slightly slower in some cases.
 
 Standard library:
 - Parsing library: new function "set_trace" to programmatically turn
@@ -86,8 +91,8 @@ Other libraries:
 
 Tools:
 - ocamldebug now supported under Windows (MSVC and Mingw ports),
-  but without the replay feature.  (Contributed by Sylvain Le Gall
-  at OCamlCore with support from Lexifi.)
+  but without the replay feature.  (Contributed by Dmitry Bely
+  and Sylvain Le Gall at OCamlCore with support from Lexifi.)
 - ocamldoc: new option -no-module-constraint-filter to include functions
   hidden by signature constraint in documentation.
 - ocamlmklib and ocamldep.opt now available under Windows ports.
@@ -112,11 +117,12 @@ Bug fixes:
 - PR#4564: add note "stack is not executable" to object files generated by
   ocamlopt (Linux/x86, Linux/AMD64).
 - PR#4566: bug in Ratio.approx_ratio_fix and Num.approx_num_fix.
-- PR#4582: weird behaviour of String.index_from and String.rindex_from.
+- PR#4582: clarified the documentation of functions in the String module.
 - PR#4583: stack overflow in "ocamlopt -g" during closure conversion pass.
 - PR#4585: ocamldoc and "val virtual" declarations.
 - PR#4587: ocamldoc and escaped @ characters.
-- PR#4605: Buffer.add_substitute was sometime wrong when target string had backslashes.
+- PR#4605: Buffer.add_substitute was sometime wrong when target string had
+           backslashes.
 - PR#4614: Inconsistent declaration of CamlCBCmd in LablTk library.
 
 
@@ -2378,12 +2384,4 @@ Caml Special Light 1.06:
 
 * First public release.
 
-<<<<<<< Changes
-<<<<<<< Changes
-$Id: Changes,v 1.183.2.1 2008/10/15 13:12:58 doligez Exp $
-=======
-$Id: Changes,v 1.183.2.1 2008/10/15 13:12:58 doligez Exp $
->>>>>>> 1.168.2.7
-=======
-$Id: Changes,v 1.183.2.1 2008/10/15 13:12:58 doligez Exp $
->>>>>>> 1.168.2.13
+$Id: Changes,v 1.183.2.7 2008/11/18 10:24:31 doligez Exp $
diff --git a/INSTALL b/INSTALL
index c1d84570862ebd5f438a4e8a4e4430b6bebd28f9..cdb3436fbd925549ba74f45a42a2d9c1c9092359 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -5,11 +5,13 @@ PREREQUISITES
 
 * The GNU C compiler gcc is recommended, as the bytecode
   interpreter takes advantage of gcc-specific features to enhance
-  performance.
+  performance.  gcc is the standard compiler under Linux, MacOS X,
+  and many other systems.
 
-* Under HP/UX, the GNU C compiler gcc, the GNU assembler gas, and GNU make
-  are all *required*.  The vendor-provided compiler, assembler and make
-  have major problems.
+* Under MacOS X 10.5, you need version 3.1 or later of the XCode
+  development tools.  The version of XCode found on MacOS X 10.5
+  installation media causes linking problems.  XCode updates
+  are available free of charge at http://developer.apple.com/tools/xcode/
 
 * Under MacOS X up to version 10.2.8, you must raise the limit on the
   stack size with one of the following commands:
@@ -20,6 +22,10 @@ PREREQUISITES
 * If you do not have write access to /tmp, you should set the environment
   variable TMPDIR to the name of some other temporary directory.
 
+* Under HP/UX, the GNU C compiler gcc, the GNU assembler gas, and GNU make
+  are all *required*.  The vendor-provided compiler, assembler and make
+  have major problems.
+
 
 INSTALLATION INSTRUCTIONS
 
@@ -120,7 +126,8 @@ Examples:
   Installation in /usr, man pages in section "l":
     ./configure -bindir /usr/bin -libdir /usr/lib/ocaml -mandir /usr/man/manl
 
-  On a MacOSX/PowerPC host, to build a 64-bit version of OCaml:
+  On a MacOSX/Intel Core 2 or MacOSX/PowerPC host, to build a 64-bit version
+  of OCaml:
     ./configure -cc "gcc -m64"
 
   On a Linux x86/64 bits host, to build a 32-bit version of OCaml:
index 8199776e7d5b9f07f582199c00f6867df0c6de9f..5a015ee36f108ceb2617148af290ad60ca8396ba 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@
 #                                                                       #
 #########################################################################
 
-# $Id: Makefile,v 1.222 2008/07/14 12:59:21 weis Exp $
+# $Id: Makefile,v 1.222.2.2 2008/10/23 15:29:11 ertai Exp $
 
 # The main Makefile
 
@@ -289,7 +289,7 @@ install:
        cp toplevel/toploop.cmi toplevel/topdirs.cmi toplevel/topmain.cmi \
           $(LIBDIR)
        cd tools; $(MAKE) install
-       -cd man; $(MAKE) install
+       -$(MAKE) -C man install
        for i in $(OTHERLIBRARIES); do \
           (cd otherlibs/$$i; $(MAKE) install) || exit $$?; \
         done
@@ -680,24 +680,24 @@ alldepend::
 
 # Camlp4
 
-camlp4out: ocamlc otherlibraries ocamlbuild-partial-boot ocamlbuild.byte
+camlp4out: ocamlc otherlibraries ocamlbuild-mixed-boot ocamlbuild.byte
        ./build/camlp4-byte-only.sh
 
-camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-partial-boot ocamlbuild.native
+camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot ocamlbuild.native
        ./build/camlp4-native-only.sh
 
 # Ocamlbuild
 
-ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-partial-boot
+ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-mixed-boot
        ./build/ocamlbuild-byte-only.sh
 
-ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
+ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot
        ./build/ocamlbuild-native-only.sh
-ocamlbuildlib.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
+ocamlbuildlib.native: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot
        ./build/ocamlbuildlib-native-only.sh
 
-ocamlbuild-partial-boot: ocamlc otherlibraries
-       ./build/partial-boot.sh
+ocamlbuild-mixed-boot: ocamlc otherlibraries
+       ./build/mixed-boot.sh
 
 partialclean::
        rm -rf _build
@@ -763,7 +763,7 @@ distclean:
 .PHONY: partialclean beforedepend alldepend cleanboot coldstart
 .PHONY: compare core coreall
 .PHONY: coreboot defaultentry depend distclean install installopt
-.PHONY: library library-cross libraryopt ocamlbuild-partial-boot
+.PHONY: library library-cross libraryopt ocamlbuild-mixed-boot
 .PHONY: ocamlbuild.byte ocamlbuild.native ocamldebugger ocamldoc
 .PHONY: ocamldoc.opt ocamllex ocamllex.opt ocamltools ocamltools.opt
 .PHONY: ocamlyacc opt-core opt opt.opt otherlibraries
index 81c9708556e47cf4d79d396a381bbf1bf3f5ebb8..4a6051399af6bf1da0bd1b318fca1cedd738745a 100644 (file)
@@ -10,7 +10,7 @@
 #                                                                       #
 #########################################################################
 
-# $Id: Makefile.nt,v 1.113 2008/07/29 08:31:41 xleroy Exp $
+# $Id: Makefile.nt,v 1.113.2.1 2008/11/10 16:13:20 ertai Exp $
 
 # The main Makefile
 
@@ -594,24 +594,24 @@ alldepend::
 
 # Camlp4
 
-camlp4out: ocamlc otherlibraries ocamlbuild-partial-boot ocamlbuild.byte
+camlp4out: ocamlc otherlibraries ocamlbuild-mixed-boot ocamlbuild.byte
        ./build/camlp4-byte-only.sh
-camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-partial-boot ocamlbuild.native
+camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot ocamlbuild.native
        ./build/camlp4-native-only.sh
 
 # Ocamlbuild
 
-ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-partial-boot
+ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-mixed-boot
        ./build/ocamlbuild-byte-only.sh
-ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
+ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot
        ./build/ocamlbuild-native-only.sh
-ocamlbuildlib.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
+ocamlbuildlib.native: ocamlopt otherlibrariesopt ocamlbuild-mixed-boot
        ./build/ocamlbuildlib-native-only.sh
 
 
-.PHONY: ocamlbuild-partial-boot
-ocamlbuild-partial-boot:
-       ./build/partial-boot.sh
+.PHONY: ocamlbuild-mixed-boot
+ocamlbuild-mixed-boot:
+       ./build/mixed-boot.sh
 partialclean::
        rm -rf _build
 
diff --git a/VERSION b/VERSION
index f9d9a8201fb3879d579c5a77b01d6325178828cf..8e10f978b83ba7825cb2485a900c4a19c153f3e4 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
-3.11.0+beta1
+3.11.0+rc1
 
 # The version string is the first line of this file.
 # It must be in the format described in stdlib/sys.mli
 
-# $Id: VERSION,v 1.26.2.2 2008/10/15 13:12:58 doligez Exp $
+# $Id: VERSION,v 1.26.2.6 2008/11/24 16:30:40 doligez Exp $
diff --git a/_tags b/_tags
index 111c3bf0ca15537b76142c6f7ff60f84b889fbef..47121f86152e3c438ec10f470b4665bbfda5acbc 100644 (file)
--- a/_tags
+++ b/_tags
@@ -33,7 +33,7 @@ true: use_stdlib
 <camlp4/Camlp4_{config,import}.ml*>: -camlp4boot
 "camlp4/Camlp4_import.ml": -warn_Ale
 <camlp4/build/*> or <camlp4/boot/*> or "camlp4/Camlp4/Struct/Lexer.ml": -camlp4boot, -warn_Ale, warn_a
-<camlp4/Camlp4Bin.{byte,native}> or "camlp4/camlp4lib.cma" or <camlp4/{mkcamlp4,boot/camlp4boot}.byte>: use_dynlink
+<camlp4/Camlp4Bin.{byte,native}> or <camlp4/{mkcamlp4,boot/camlp4boot}.byte>: use_dynlink
 "camlp4/Camlp4/Printers/OCaml.ml" or "camlp4/Camlp4/Printers/OCamlr.ml": warn_Alezv
 <camlp4/Camlp4Printers/**.ml>: include_unix
 "camlp4/Camlp4/Struct/DynLoader.ml" or "camlp4/boot/Camlp4.ml": include_dynlink
index f31155177af77c597bbbd5af1f4d54e0710c787e..4516178a7a5f2a57eccab29caa5583fb1a02c112 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: emit.mlp,v 1.16 2008/08/01 08:04:57 xleroy Exp $ *)
+(* $Id: emit.mlp,v 1.16.2.2 2008/11/08 16:08:09 xleroy Exp $ *)
 
 (* Emission of x86-64 (AMD 64) assembly code *)
 
@@ -23,6 +23,12 @@ open Mach
 open Linearize
 open Emitaux
 
+let macosx =
+  match Config.system with
+  | "macosx" -> true
+  | _ -> false
+
+
 (* Tradeoff between code size and code speed *)
 
 let fastcode_flag = ref true
@@ -54,15 +60,16 @@ let slot_offset loc cl =
 (* Symbols *)
 
 let emit_symbol s =
-  Emitaux.emit_symbol '$' s
+    if macosx then emit_string "_"; 
+    Emitaux.emit_symbol '$' s
 
 let emit_call s =
-  if !Clflags.dlcode
+  if !Clflags.dlcode && not macosx
   then `call   {emit_symbol s}@PLT`
   else `call   {emit_symbol s}`
 
 let emit_jump s =
-  if !Clflags.dlcode
+  if !Clflags.dlcode && not macosx
   then `jmp    {emit_symbol s}@PLT`
   else `jmp    {emit_symbol s}`
 
@@ -82,6 +89,7 @@ let emit_label lbl =
 (* Output a .align directive. *)
 
 let emit_align n =
+    let n = if macosx then Misc.log2 n else n in
   `    .align  {emit_int n}\n`
 
 let emit_Llabel fallthrough lbl =
@@ -588,7 +596,9 @@ let emit_instr fallthrough i =
         end else begin
           `    jmp     *{emit_label lbl}(, {emit_reg i.arg.(0)}, 8)\n`
         end;
-        `      .section .rodata\n`;
+        if macosx
+        then ` .const\n`
+        else ` .section .rodata\n`;
         emit_align 8;
         `{emit_label lbl}:`;
         for i = 0 to Array.length jumptbl - 1 do
@@ -670,9 +680,16 @@ let fundecl fundecl =
   List.iter emit_call_gc !call_gc_sites;
   emit_call_bound_errors ();
   if !float_constants <> [] then begin
-    `  .section        .rodata.cst8,\"a\",@progbits\n`;
+    if macosx
+    then `     .literal8\n`
+    else `     .section        .rodata.cst8,\"a\",@progbits\n`;
     List.iter emit_float_constant !float_constants
-  end
+  end;
+  match Config.system with
+    "linux" | "gnu" ->
+      `        .type   {emit_symbol fundecl.fun_name},@function\n`;
+      `        .size   {emit_symbol fundecl.fun_name},.-{emit_symbol fundecl.fun_name}\n`
+  | _ -> ()
 
 (* Emission of data *)
 
@@ -715,11 +732,19 @@ let data l =
 let begin_assembly() =
   if !Clflags.dlcode then begin
     (* from amd64.S; could emit these constants on demand *)
-    `  .section        .rodata.cst8,\"a\",@progbits\n`;
-    `  .align  16\n`;
-    `caml_negf_mask:   .quad   0x8000000000000000, 0\n`;
-    `  .align  16\n`;
-    `caml_absf_mask:   .quad   0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF\n`;
+    if macosx then begin
+        `      .literal16\n`;
+        `      .align  4\n`;
+        `caml_negf_mask:       .quad   0x8000000000000000, 0\n`;
+        `      .align  4\n`;
+        `caml_absf_mask:       .quad   0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF\n`;
+    end else begin
+        `      .section        .rodata.cst8,\"a\",@progbits\n`;
+        `      .align  16\n`;
+        `caml_negf_mask:       .quad   0x8000000000000000, 0\n`;
+        `      .align  16\n`;
+        `caml_absf_mask:       .quad   0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF\n`;
+    end;
   end;
   let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
   `    .data\n`;
@@ -733,6 +758,7 @@ let begin_assembly() =
 let end_assembly() =
   let lbl_end = Compilenv.make_symbol (Some "code_end") in
   `    .text\n`;
+  if macosx then `     NOP\n`; (* suppress "ld warning: atom sorting error" *)
   `    .globl  {emit_symbol lbl_end}\n`;
   `{emit_symbol lbl_end}:\n`;
   `    .data\n`;
@@ -749,8 +775,17 @@ let end_assembly() =
       efa_32 = (fun n -> `     .long   {emit_int32 n}\n`);
       efa_word = (fun n -> `   .quad   {emit_int n}\n`);
       efa_align = emit_align;
-      efa_label_rel = (fun lbl ofs ->
-                           `   .long   ({emit_label lbl} - .) + {emit_int32 ofs}\n`);
+      efa_label_rel =
+        if macosx then begin
+          let setcnt = ref 0 in
+          fun lbl ofs ->
+            incr setcnt;
+            `  .set    L$set${emit_int !setcnt}, ({emit_label lbl} - .) + {emit_int32 ofs}\n`;
+            `  .long L$set${emit_int !setcnt}\n`
+        end else begin
+         fun lbl ofs ->
+             ` .long   ({emit_label lbl} - .) + {emit_int32 ofs}\n`
+       end;
       efa_def_label = (fun l -> `{emit_label l}:\n`);
       efa_string = (fun s -> emit_string_directive "   .asciz  " s) };
   if Config.system = "linux" then
index 58bb84506404b824145ae6ff9139682735c5aaca..0d5acf843bb9d8ac9490206b3601fc59bfa10b1b 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: selection.ml,v 1.7 2007/11/06 15:16:55 frisch Exp $ *)
+(* $Id: selection.ml,v 1.7.4.1 2008/10/29 14:32:01 xleroy Exp $ *)
 
 (* Instruction selection for the AMD64 *)
 
@@ -122,17 +122,21 @@ method is_immediate n = n <= 0x7FFFFFFF && n >= -0x80000000
 method is_immediate_natint n = n <= 0x7FFFFFFFn && n >= -0x80000000n
 
 method select_addressing exp =
-  match select_addr exp with
-    (Asymbol s, d) ->
-      (Ibased(s, d), Ctuple [])
-  | (Alinear e, d) ->
-      (Iindexed d, e)
-  | (Aadd(e1, e2), d) ->
-      (Iindexed2 d, Ctuple[e1; e2])
-  | (Ascale(e, scale), d) ->
-      (Iscaled(scale, d), e)
-  | (Ascaledadd(e1, e2, scale), d) ->
-      (Iindexed2scaled(scale, d), Ctuple[e1; e2])
+  let (a, d) = select_addr exp in
+  (* PR#4625: displacement must be a signed 32-bit immediate *)
+  if d < -0x8000_0000 || d > 0x7FFF_FFFF
+  then (Iindexed 0, exp)
+  else match a with
+    | Asymbol s ->
+        (Ibased(s, d), Ctuple [])
+    | Alinear e ->
+        (Iindexed d, e)
+    | Aadd(e1, e2) ->
+        (Iindexed2 d, Ctuple[e1; e2])
+    | Ascale(e, scale) ->
+        (Iscaled(scale, d), e)
+    | Ascaledadd(e1, e2, scale) ->
+        (Iindexed2scaled(scale, d), Ctuple[e1; e2])
 
 method select_store addr exp =
   match exp with
index 2ce4edcaa7a8712e956d908533a8c82fd1876b6d..13af98155c0607ec916c07e271a3821b1c75e721 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: emit.mlp,v 1.41 2008/08/01 08:04:57 xleroy Exp $ *)
+(* $Id: emit.mlp,v 1.41.2.2 2008/11/08 16:08:09 xleroy Exp $ *)
 
 (* Emission of Intel 386 assembly code *)
 
@@ -875,15 +875,6 @@ let emit_profile () =
       `        popl    %eax\n`
   | _ -> () (*unsupported yet*)
 
-(* Declare a global function symbol *)
-
-let declare_function_symbol name =
-  `    .globl  {emit_symbol name}\n`;
-  match Config.system with
-    "linux_elf" | "bsd_elf" | "gnu" ->
-      `        .type   {emit_symbol name},@function\n`
-  | _ -> ()
-
 (* Emission of a function declaration *)
 
 let fundecl fundecl =
@@ -897,7 +888,7 @@ let fundecl fundecl =
   bound_error_call := 0;
   `    .text\n`;
   emit_align 16;
-  declare_function_symbol fundecl.fun_name;
+  `    .globl  {emit_symbol fundecl.fun_name}\n`;
   `{emit_symbol fundecl.fun_name}:\n`;
   if !Clflags.gprofile then emit_profile();
   let n = frame_size() - 4 in
@@ -907,7 +898,13 @@ let fundecl fundecl =
   emit_all true fundecl.fun_body;
   List.iter emit_call_gc !call_gc_sites;
   emit_call_bound_errors ();
-  List.iter emit_float_constant !float_constants
+  List.iter emit_float_constant !float_constants;
+  match Config.system with
+    "linux_elf" | "bsd_elf" | "gnu" ->
+      `        .type   {emit_symbol fundecl.fun_name},@function\n`;
+      `        .size   {emit_symbol fundecl.fun_name},.-{emit_symbol fundecl.fun_name}\n`
+  | _ -> ()
+
 
 (* Emission of data *)
 
@@ -962,6 +959,7 @@ let begin_assembly() =
 let end_assembly() =
   let lbl_end = Compilenv.make_symbol (Some "code_end") in
   `    .text\n`;
+  if macosx then `     NOP\n`; (* suppress "ld warning: atom sorting error" *)
   `    .globl  {emit_symbol lbl_end}\n`;
   `{emit_symbol lbl_end}:\n`;
   `    .data\n`;
index 25c6776357316fc045dff9a61c487f1a7b9308fa..6b66a0c3a77ea0cc9bf493c96431915e394da2f2 100644 (file)
@@ -337,14 +337,14 @@ startup.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
   ../byterun/misc.h ../byterun/config.h ../byterun/backtrace.h \
   ../byterun/mlvalues.h ../byterun/custom.h ../byterun/mlvalues.h \
   ../byterun/fail.h ../byterun/misc.h ../byterun/mlvalues.h \
+  ../byterun/freelist.h ../byterun/misc.h ../byterun/mlvalues.h \
   ../byterun/gc.h ../byterun/mlvalues.h ../byterun/gc_ctrl.h \
   ../byterun/misc.h ../byterun/memory.h ../byterun/config.h \
   ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \
-  ../byterun/misc.h ../byterun/mlvalues.h ../byterun/misc.h \
-  ../byterun/minor_gc.h ../byterun/misc.h ../byterun/misc.h \
-  ../byterun/mlvalues.h ../byterun/osdeps.h ../byterun/misc.h \
-  ../byterun/printexc.h ../byterun/misc.h ../byterun/mlvalues.h \
-  ../byterun/sys.h ../byterun/misc.h natdynlink.h
+  ../byterun/misc.h ../byterun/minor_gc.h ../byterun/misc.h \
+  ../byterun/misc.h ../byterun/mlvalues.h ../byterun/osdeps.h \
+  ../byterun/misc.h ../byterun/printexc.h ../byterun/misc.h \
+  ../byterun/mlvalues.h ../byterun/sys.h ../byterun/misc.h natdynlink.h
 str.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
   ../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
   ../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
@@ -725,14 +725,14 @@ startup.d.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
   ../byterun/misc.h ../byterun/config.h ../byterun/backtrace.h \
   ../byterun/mlvalues.h ../byterun/custom.h ../byterun/mlvalues.h \
   ../byterun/fail.h ../byterun/misc.h ../byterun/mlvalues.h \
+  ../byterun/freelist.h ../byterun/misc.h ../byterun/mlvalues.h \
   ../byterun/gc.h ../byterun/mlvalues.h ../byterun/gc_ctrl.h \
   ../byterun/misc.h ../byterun/memory.h ../byterun/config.h \
   ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \
-  ../byterun/misc.h ../byterun/mlvalues.h ../byterun/misc.h \
-  ../byterun/minor_gc.h ../byterun/misc.h ../byterun/misc.h \
-  ../byterun/mlvalues.h ../byterun/osdeps.h ../byterun/misc.h \
-  ../byterun/printexc.h ../byterun/misc.h ../byterun/mlvalues.h \
-  ../byterun/sys.h ../byterun/misc.h natdynlink.h
+  ../byterun/misc.h ../byterun/minor_gc.h ../byterun/misc.h \
+  ../byterun/misc.h ../byterun/mlvalues.h ../byterun/osdeps.h \
+  ../byterun/misc.h ../byterun/printexc.h ../byterun/misc.h \
+  ../byterun/mlvalues.h ../byterun/sys.h ../byterun/misc.h natdynlink.h
 str.d.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
   ../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
   ../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
@@ -1113,14 +1113,14 @@ startup.p.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \
   ../byterun/misc.h ../byterun/config.h ../byterun/backtrace.h \
   ../byterun/mlvalues.h ../byterun/custom.h ../byterun/mlvalues.h \
   ../byterun/fail.h ../byterun/misc.h ../byterun/mlvalues.h \
+  ../byterun/freelist.h ../byterun/misc.h ../byterun/mlvalues.h \
   ../byterun/gc.h ../byterun/mlvalues.h ../byterun/gc_ctrl.h \
   ../byterun/misc.h ../byterun/memory.h ../byterun/config.h \
   ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \
-  ../byterun/misc.h ../byterun/mlvalues.h ../byterun/misc.h \
-  ../byterun/minor_gc.h ../byterun/misc.h ../byterun/misc.h \
-  ../byterun/mlvalues.h ../byterun/osdeps.h ../byterun/misc.h \
-  ../byterun/printexc.h ../byterun/misc.h ../byterun/mlvalues.h \
-  ../byterun/sys.h ../byterun/misc.h natdynlink.h
+  ../byterun/misc.h ../byterun/minor_gc.h ../byterun/misc.h \
+  ../byterun/misc.h ../byterun/mlvalues.h ../byterun/osdeps.h \
+  ../byterun/misc.h ../byterun/printexc.h ../byterun/misc.h \
+  ../byterun/mlvalues.h ../byterun/sys.h ../byterun/misc.h natdynlink.h
 str.p.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
   ../byterun/../config/m.h ../byterun/../config/s.h ../byterun/mlvalues.h \
   ../byterun/config.h ../byterun/misc.h ../byterun/fail.h \
index 6af0c54c94a68389b490a21a2a3c21ccec8b2a1c..c9ce59d06d7b6d5c9771772c5d4592f6c57c8fe9 100644 (file)
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: amd64.S,v 1.12 2008/08/01 08:04:57 xleroy Exp $ */
+/* $Id: amd64.S,v 1.12.2.1 2008/11/07 10:34:16 xleroy Exp $ */
 
 /* Asm part of the runtime system, AMD64 processor */
 /* Must be preprocessed by cpp */
 
-#define FUNCTION_ALIGN 4
+#ifdef SYS_macosx
+
+#define G(r) _##r
+#define FUNCTION_ALIGN 2
+#define EIGHT_ALIGN 3
+#define SIXTEEN_ALIGN 4
+#define FUNCTION(name) \
+        .globl name; \
+        .align FUNCTION_ALIGN; \
+        name:
 
+#else
+
+#define G(r) r
+#define FUNCTION_ALIGN 4
+#define EIGHT_ALIGN 8
+#define SIXTEEN_ALIGN 16
 #define FUNCTION(name) \
         .globl name; \
-        .type  name,@function; \
+        .type name,@function; \
         .align FUNCTION_ALIGN; \
         name:
 
+#endif
+
+
         .text
 
 /* Allocation */
 
-FUNCTION(caml_call_gc)
+FUNCTION(G(caml_call_gc))
     /* Record lowest stack address and return address */
         movq    0(%rsp), %rax
-        movq    %rax, caml_last_return_address(%rip)
+        movq    %rax, G(caml_last_return_address)(%rip)
         leaq    8(%rsp), %rax
-        movq    %rax, caml_bottom_of_stack(%rip)
+        movq    %rax, G(caml_bottom_of_stack)(%rip)
 .L105:  
     /* Save caml_young_ptr, caml_exception_pointer */
-       movq    %r15, caml_young_ptr(%rip)
-       movq    %r14, caml_exception_pointer(%rip)
+       movq    %r15, G(caml_young_ptr)(%rip)
+       movq    %r14, G(caml_exception_pointer)(%rip)
     /* Build array of registers, save it into caml_gc_regs */
         pushq   %r13
         pushq   %r12
@@ -52,7 +70,7 @@ FUNCTION(caml_call_gc)
         pushq   %rdi
         pushq   %rbx
         pushq   %rax
-        movq    %rsp, caml_gc_regs(%rip)
+        movq    %rsp, G(caml_gc_regs)(%rip)
     /* Save floating-point registers */
         subq    $(16*8), %rsp
         movlpd  %xmm0, 0*8(%rsp)
@@ -72,7 +90,7 @@ FUNCTION(caml_call_gc)
         movlpd  %xmm14, 14*8(%rsp)
         movlpd  %xmm15, 15*8(%rsp)
     /* Call the garbage collector */
-        call    caml_garbage_collection
+        call    G(caml_garbage_collection)
     /* Restore all regs used by the code generator */
         movlpd  0*8(%rsp), %xmm0
         movlpd  1*8(%rsp), %xmm1
@@ -105,92 +123,92 @@ FUNCTION(caml_call_gc)
         popq    %r12
         popq    %r13
     /* Restore caml_young_ptr, caml_exception_pointer */
-       movq    caml_young_ptr(%rip), %r15
-       movq    caml_exception_pointer(%rip), %r14
+       movq    G(caml_young_ptr)(%rip), %r15
+       movq    G(caml_exception_pointer)(%rip), %r14
     /* Return to caller */
         ret
 
-FUNCTION(caml_alloc1)
+FUNCTION(G(caml_alloc1))
         subq    $16, %r15
-        cmpq    caml_young_limit(%rip), %r15
+        cmpq    G(caml_young_limit)(%rip), %r15
         jb      .L100
         ret
 .L100:
         movq    0(%rsp), %rax
-        movq    %rax, caml_last_return_address(%rip)
+        movq    %rax, G(caml_last_return_address)(%rip)
         leaq    8(%rsp), %rax
-        movq    %rax, caml_bottom_of_stack(%rip)
+        movq    %rax, G(caml_bottom_of_stack)(%rip)
        subq    $8, %rsp
         call    .L105
        addq    $8, %rsp
-        jmp     caml_alloc1
+        jmp     G(caml_alloc1)
 
-FUNCTION(caml_alloc2)
+FUNCTION(G(caml_alloc2))
         subq    $24, %r15
-        cmpq    caml_young_limit(%rip), %r15
+        cmpq    G(caml_young_limit)(%rip), %r15
         jb      .L101
         ret
 .L101:
         movq    0(%rsp), %rax
-        movq    %rax, caml_last_return_address(%rip)
+        movq    %rax, G(caml_last_return_address)(%rip)
         leaq    8(%rsp), %rax
-        movq    %rax, caml_bottom_of_stack(%rip)
+        movq    %rax, G(caml_bottom_of_stack)(%rip)
        subq    $8, %rsp
         call    .L105
        addq    $8, %rsp
-        jmp     caml_alloc2
+        jmp     G(caml_alloc2)
 
-FUNCTION(caml_alloc3)
+FUNCTION(G(caml_alloc3))
         subq    $32, %r15
-        cmpq    caml_young_limit(%rip), %r15
+        cmpq    G(caml_young_limit)(%rip), %r15
         jb      .L102
         ret
 .L102:
         movq    0(%rsp), %rax
-        movq    %rax, caml_last_return_address(%rip)
+        movq    %rax, G(caml_last_return_address)(%rip)
         leaq    8(%rsp), %rax
-        movq    %rax, caml_bottom_of_stack(%rip)
+        movq    %rax, G(caml_bottom_of_stack)(%rip)
        subq    $8, %rsp
         call    .L105
        addq    $8, %rsp
-        jmp     caml_alloc3
+        jmp     G(caml_alloc3)
 
-FUNCTION(caml_allocN)
+FUNCTION(G(caml_allocN))
         subq    %rax, %r15
-        cmpq    caml_young_limit(%rip), %r15
+        cmpq    G(caml_young_limit)(%rip), %r15
         jb      .L103
         ret
 .L103:
         pushq   %rax                       /* save desired size */
         movq    8(%rsp), %rax
-        movq    %rax, caml_last_return_address(%rip)
+        movq    %rax, G(caml_last_return_address)(%rip)
         leaq    16(%rsp), %rax
-        movq    %rax, caml_bottom_of_stack(%rip)
+        movq    %rax, G(caml_bottom_of_stack)(%rip)
         call    .L105
         popq    %rax                      /* recover desired size */
-        jmp     caml_allocN
+        jmp     G(caml_allocN)
 
 /* Call a C function from Caml */
 
-FUNCTION(caml_c_call)
+FUNCTION(G(caml_c_call))
     /* Record lowest stack address and return address */
         popq    %r12
-        movq    %r12, caml_last_return_address(%rip)
-        movq    %rsp, caml_bottom_of_stack(%rip)
+        movq    %r12, G(caml_last_return_address)(%rip)
+        movq    %rsp, G(caml_bottom_of_stack)(%rip)
     /* Make the exception handler and alloc ptr available to the C code */
-       movq    %r15, caml_young_ptr(%rip)
-       movq    %r14, caml_exception_pointer(%rip)
+       movq    %r15, G(caml_young_ptr)(%rip)
+       movq    %r14, G(caml_exception_pointer)(%rip)
     /* Call the function (address in %rax) */
         call    *%rax
     /* Reload alloc ptr */
-       movq    caml_young_ptr(%rip), %r15
+       movq    G(caml_young_ptr)(%rip), %r15
     /* Return to caller */
        pushq   %r12
        ret
 
 /* Start the Caml program */
 
-FUNCTION(caml_start_program)
+FUNCTION(G(caml_start_program))
     /* Save callee-save registers */
         pushq   %rbx
         pushq   %rbp
@@ -199,18 +217,18 @@ FUNCTION(caml_start_program)
         pushq   %r14
         pushq   %r15
        subq    $8, %rsp        /* stack 16-aligned */
-    /* Initial entry point is caml_program */
-        leaq    caml_program(%rip), %r12
+    /* Initial entry point is G(caml_program) */
+        leaq    G(caml_program)(%rip), %r12
     /* Common code for caml_start_program and caml_callback* */
 .L106:
     /* Build a callback link */
        subq    $8, %rsp        /* stack 16-aligned */
-        pushq   caml_gc_regs(%rip)
-        pushq   caml_last_return_address(%rip)
-        pushq   caml_bottom_of_stack(%rip)
+        pushq   G(caml_gc_regs)(%rip)
+        pushq   G(caml_last_return_address)(%rip)
+        pushq   G(caml_bottom_of_stack)(%rip)
     /* Setup alloc ptr and exception ptr */
-       movq    caml_young_ptr(%rip), %r15
-       movq    caml_exception_pointer(%rip), %r14
+       movq    G(caml_young_ptr)(%rip), %r15
+       movq    G(caml_exception_pointer)(%rip), %r14
     /* Build an exception handler */
         lea     .L108(%rip), %r13
         pushq   %r13
@@ -224,12 +242,12 @@ FUNCTION(caml_start_program)
         popq    %r12    /* dummy register */
 .L109:
     /* Update alloc ptr and exception ptr */
-       movq    %r15, caml_young_ptr(%rip)
-       movq    %r14, caml_exception_pointer(%rip)
+       movq    %r15, G(caml_young_ptr)(%rip)
+       movq    %r14, G(caml_exception_pointer)(%rip)
     /* Pop the callback link, restoring the global variables */
-        popq    caml_bottom_of_stack(%rip)
-        popq    caml_last_return_address(%rip)
-        popq    caml_gc_regs(%rip)
+        popq    G(caml_bottom_of_stack)(%rip)
+        popq    G(caml_last_return_address)(%rip)
+        popq    G(caml_gc_regs)(%rip)
        addq    $8, %rsp
     /* Restore callee-save registers. */
        addq    $8, %rsp
@@ -249,8 +267,8 @@ FUNCTION(caml_start_program)
 
 /* Raise an exception from Caml */
 
-FUNCTION(caml_raise_exn)
-        testl   $1, caml_backtrace_active(%rip)
+FUNCTION(G(caml_raise_exn))
+        testl   $1, G(caml_backtrace_active)(%rip)
         jne     .L110
         movq    %r14, %rsp
         popq    %r14
@@ -261,7 +279,7 @@ FUNCTION(caml_raise_exn)
         movq    0(%rsp), %rsi         /* arg 2: pc of raise */
         leaq    8(%rsp), %rdx         /* arg 3: sp of raise */
         movq    %r14, %rcx            /* arg 4: sp of handler */
-        call    caml_stash_backtrace
+        call    G(caml_stash_backtrace)
         movq    %r12, %rax            /* Recover exception bucket */
         movq    %r14, %rsp
         popq    %r14
@@ -269,30 +287,30 @@ FUNCTION(caml_raise_exn)
 
 /* Raise an exception from C */
 
-FUNCTION(caml_raise_exception)
-        testl   $1, caml_backtrace_active(%rip)
+FUNCTION(G(caml_raise_exception))
+        testl   $1, G(caml_backtrace_active)(%rip)
         jne     .L111
         movq    %rdi, %rax
-        movq    caml_exception_pointer(%rip), %rsp
+        movq    G(caml_exception_pointer)(%rip), %rsp
         popq    %r14                  /* Recover previous exception handler */
-        movq    caml_young_ptr(%rip), %r15 /* Reload alloc ptr */
+        movq    G(caml_young_ptr)(%rip), %r15 /* Reload alloc ptr */
         ret
 .L111:
         movq    %rdi, %r12            /* Save exception bucket */
                                       /* arg 1: exception bucket */
-        movq    caml_last_return_address(%rip), %rsi /* arg 2: pc of raise */
-        movq    caml_bottom_of_stack(%rip), %rdx /* arg 3: sp of raise */
-        movq    caml_exception_pointer(%rip), %rcx /* arg 4: sp of handler */
-        call    caml_stash_backtrace
+        movq    G(caml_last_return_address)(%rip), %rsi /* arg 2: pc of raise */
+        movq    G(caml_bottom_of_stack)(%rip), %rdx /* arg 3: sp of raise */
+        movq    G(caml_exception_pointer)(%rip), %rcx /* arg 4: sp of handler */
+        call    G(caml_stash_backtrace)
         movq    %r12, %rax            /* Recover exception bucket */
-        movq    caml_exception_pointer(%rip), %rsp
+        movq    G(caml_exception_pointer)(%rip), %rsp
         popq    %r14                  /* Recover previous exception handler */
-        movq    caml_young_ptr(%rip), %r15 /* Reload alloc ptr */
+        movq    G(caml_young_ptr)(%rip), %r15 /* Reload alloc ptr */
         ret
 
 /* Callback from C to Caml */
 
-FUNCTION(caml_callback_exn)
+FUNCTION(G(caml_callback_exn))
     /* Save callee-save registers */
         pushq   %rbx
         pushq   %rbp
@@ -307,7 +325,7 @@ FUNCTION(caml_callback_exn)
         movq    0(%rbx), %r12   /* code pointer */
         jmp     .L106
 
-FUNCTION(caml_callback2_exn)
+FUNCTION(G(caml_callback2_exn))
     /* Save callee-save registers */
         pushq   %rbx
         pushq   %rbp
@@ -320,10 +338,10 @@ FUNCTION(caml_callback2_exn)
         /* closure stays in %rdi */
         movq    %rsi, %rax               /* first argument */
         movq    %rdx, %rbx               /* second argument */
-        leaq    caml_apply2(%rip), %r12  /* code pointer */
+        leaq    G(caml_apply2)(%rip), %r12  /* code pointer */
         jmp     .L106
 
-FUNCTION(caml_callback3_exn)
+FUNCTION(G(caml_callback3_exn))
     /* Save callee-save registers */
         pushq   %rbx
         pushq   %rbp
@@ -337,34 +355,35 @@ FUNCTION(caml_callback3_exn)
         movq    %rdx, %rbx               /* second argument */
         movq    %rdi, %rsi               /* closure */
         movq    %rcx, %rdi               /* third argument */
-        leaq    caml_apply3(%rip), %r12  /* code pointer */
+        leaq    G(caml_apply3)(%rip), %r12  /* code pointer */
         jmp     .L106
 
-FUNCTION(caml_ml_array_bound_error)
-        leaq    caml_array_bound_error(%rip), %rax
-        jmp     caml_c_call
+FUNCTION(G(caml_ml_array_bound_error))
+        leaq    G(caml_array_bound_error)(%rip), %rax
+        jmp     G(caml_c_call)
 
         .data
-        .globl  caml_system__frametable
-        .type   caml_system__frametable,@object
-        .align  8
-caml_system__frametable:
+        .globl  G(caml_system__frametable)
+        .align  EIGHT_ALIGN
+G(caml_system__frametable):
         .quad   1           /* one descriptor */
         .quad   .L107       /* return address into callback */
         .value  -1          /* negative frame size => use callback link */
         .value  0           /* no roots here */
-        .align  8
+        .align  EIGHT_ALIGN
 
-       .section        .rodata.cst8,"a",@progbits
-        .globl  caml_negf_mask
-        .type   caml_negf_mask,@object
-        .align  16
-caml_negf_mask:
+#ifdef SYS_macosx
+       .literal16
+#else
+       .section    .rodata.cst8,"a",@progbits
+#endif
+        .globl  G(caml_negf_mask)
+        .align  SIXTEEN_ALIGN
+G(caml_negf_mask):
        .quad   0x8000000000000000, 0
-        .globl  caml_absf_mask
-        .type   caml_absf_mask,@object
-        .align  16
-caml_absf_mask:
+        .globl  G(caml_absf_mask)
+        .align  SIXTEEN_ALIGN
+G(caml_absf_mask):
        .quad   0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF
 
 #if defined(SYS_linux)
index 7f32583ca6ba032e1626865657d97f211e15bec7..919ff4521f71000b67047c7fb13f63827fdf3357 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: signals_osdep.h,v 1.11 2008/01/11 16:13:11 doligez Exp $ */
+/* $Id: signals_osdep.h,v 1.11.4.1 2008/11/07 10:34:16 xleroy Exp $ */
 
 /* Processor- and OS-dependent signal interface */
 
   #define CONTEXT_YOUNG_PTR (context->uc_mcontext.gregs[REG_R15])
   #define CONTEXT_FAULTING_ADDRESS ((char *) context->uc_mcontext.gregs[REG_CR2])
 
+/****************** AMD64, MacOSX */
+
+#elif defined(TARGET_amd64) && defined (SYS_macosx)
+
+  #define DECLARE_SIGNAL_HANDLER(name) \
+    static void name(int sig, siginfo_t * info, void * context)
+
+  #define SET_SIGACT(sigact,name) \
+     sigact.sa_sigaction = (name); \
+     sigact.sa_flags = SA_SIGINFO | SA_64REGSET
+
+  #include <sys/ucontext.h>
+  #include <AvailabilityMacros.h>
+
+#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+    #define CONTEXT_REG(r) r
+  #else
+    #define CONTEXT_REG(r) __##r
+  #endif
+
+  #define CONTEXT_STATE (((ucontext_t *)context)->uc_mcontext->CONTEXT_REG(ss))
+  #define CONTEXT_PC (CONTEXT_STATE.CONTEXT_REG(rip))
+  #define CONTEXT_EXCEPTION_POINTER (CONTEXT_STATE.CONTEXT_REG(r14))
+  #define CONTEXT_YOUNG_PTR (CONTEXT_STATE.CONTEXT_REG(r15))
+  #define CONTEXT_SP (CONTEXT_STATE.CONTEXT_REG(rsp))
+  #define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
+
 /****************** I386, Linux */
 
 #elif defined(TARGET_i386) && defined(SYS_linux_elf)
index 19eda78f356a2a5cb505e8c59874d4e3bf31ab42..b708c1e39cb5c4e8783bcf223cee48cabace62a5 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: startup.c,v 1.36 2008/03/14 13:47:13 xleroy Exp $ */
+/* $Id: startup.c,v 1.36.2.1 2008/11/18 10:24:31 doligez Exp $ */
 
 /* Start-up code */
 
@@ -21,6 +21,7 @@
 #include "backtrace.h"
 #include "custom.h"
 #include "fail.h"
+#include "freelist.h"
 #include "gc.h"
 #include "gc_ctrl.h"
 #include "memory.h"
@@ -55,7 +56,7 @@ static void init_atoms(void)
     caml_fatal_error("Fatal error: not enough memory for the initial page table");
 
   for (i = 0; caml_data_segments[i].begin != 0; i++) {
-    if (caml_page_table_add(In_static_data, 
+    if (caml_page_table_add(In_static_data,
                             caml_data_segments[i].begin,
                             caml_data_segments[i].end) != 0)
       caml_fatal_error("Fatal error: not enough memory for the initial page table");
@@ -106,6 +107,7 @@ static void scanmult (char *opt, uintnat *var)
 static void parse_camlrunparam(void)
 {
   char *opt = getenv ("OCAMLRUNPARAM");
+  uintnat p;
 
   if (opt == NULL) opt = getenv ("CAMLRUNPARAM");
 
@@ -121,6 +123,7 @@ static void parse_camlrunparam(void)
       case 'v': scanmult (opt, &caml_verb_gc); break;
       case 'b': caml_record_backtrace(Val_true); break;
       case 'p': caml_parser_trace = 1; break;
+      case 'a': scanmult (opt, &p); caml_set_allocation_policy (p); break;
       }
     }
   }
index c97932a1dbf505ef59f7fbed91d9aab0f74ba79d..2ee22ef5dfbd950ec21c3f782b463785fb9229ea 100755 (executable)
Binary files a/boot/myocamlbuild.boot and b/boot/myocamlbuild.boot differ
index 9246af41de7ff52ed817a21a868a2d5adfef388d..eb8e6485b249c782f0954a685a3e977820a7470e 100755 (executable)
Binary files a/boot/ocamlc and b/boot/ocamlc differ
index 61bbe7d579896466fd17d36163359126c61b2ac9..66696d9facda888306bf1b25ecfa1579dfe5b1fb 100755 (executable)
Binary files a/boot/ocamldep and b/boot/ocamldep differ
index 8be5a7bfda91f85c2ee79f90eec93a35be446fcd..bafc89c2da063cf2b435193538cdba7379853eb8 100755 (executable)
Binary files a/boot/ocamllex and b/boot/ocamllex differ
diff --git a/build/.cvsignore b/build/.cvsignore
new file mode 100644 (file)
index 0000000..274c6e5
--- /dev/null
@@ -0,0 +1 @@
+ocamlbuild_mixed_mode
index e9b2579eb083b6595777029619ce960e00073308..f337e3f6d75aec52f822d838e56c550bceecee9e 100755 (executable)
@@ -72,7 +72,7 @@ esac
 
 ( ./build/distclean.sh || : ) 2>&1 | log distclean
 
-(cvs -q up -dP -r release310 || bad) 2>&1 | log cvs up
+(cvs -q up -dP -r release311 || bad) 2>&1 | log cvs up
 finish_if_bad
 
 case "$opt_win" in
index 2caf64c6b8ddd3822f5d65e3b874c1f286a04df8..2ebf42d7c9a58f4572efd9eb83821d753e4c3b7a 100755 (executable)
@@ -1,9 +1,7 @@
 #!/bin/sh
-# $Id: camlp4-byte-only.sh,v 1.3 2007/10/08 14:19:34 doligez Exp $
+# $Id: camlp4-byte-only.sh,v 1.3.4.1 2008/10/23 15:29:11 ertai Exp $
 set -e
-OCAMLBUILD_PARTIAL="true"
-export OCAMLBUILD_PARTIAL
 cd `dirname $0`/..
 . build/targets.sh
 set -x
-$OCAMLBUILD $@ byte_stdlib_partial_mode $OCAMLC_BYTE $OCAMLLEX_BYTE $CAMLP4_BYTE
+$OCAMLBUILD $@ byte_stdlib_mixed_mode $OCAMLC_BYTE $OCAMLLEX_BYTE $CAMLP4_BYTE
index 8ad480487fe9c638c0a9b8472f55e8df7d0badeb..ce70333c9c62aa0330910039cdc29e7499a98c29 100755 (executable)
@@ -1,9 +1,7 @@
 #!/bin/sh
-# $Id: camlp4-native-only.sh,v 1.3 2007/10/08 14:19:34 doligez Exp $
+# $Id: camlp4-native-only.sh,v 1.3.4.1 2008/10/23 15:29:11 ertai Exp $
 set -e
-OCAMLBUILD_PARTIAL="true"
-export OCAMLBUILD_PARTIAL
 cd `dirname $0`/..
 . build/targets.sh
 set -x
-$OCAMLBUILD $@ native_stdlib_partial_mode $OCAMLOPT_BYTE $OCAMLLEX_BYTE $CAMLP4_NATIVE
+$OCAMLBUILD $@ native_stdlib_mixed_mode $OCAMLOPT_BYTE $OCAMLLEX_BYTE $CAMLP4_NATIVE
index 16c9b20f96d0fff2915ac2105f03710bce9d71b7..145899e8930a191f1144fb49fbb60bb623a0f9e0 100755 (executable)
 #                                                                       #
 #########################################################################
 
-# $Id: distclean.sh,v 1.7 2008/01/11 16:13:16 doligez Exp $
+# $Id: distclean.sh,v 1.7.4.1 2008/10/23 15:29:11 ertai Exp $
 
 cd `dirname $0`/..
 set -ex
 (cd byterun && make clean) || :
 (cd asmrun && make clean)  || :
 (cd yacc && make clean)    || :
+rm -f build/ocamlbuild_mixed_mode
 rm -rf _build
 rm -f boot/ocamlrun boot/ocamlrun.exe boot/camlheader \
       boot/myocamlbuild boot/myocamlbuild.native boot/myocamlbuild.native.exe \
index 4a82407e9b0087883c26cb86ea1546ee66b97450..905f37fd7d8ca5dd9fc3f5cebcae02deb816b854 100755 (executable)
@@ -1,7 +1,12 @@
 #!/bin/sh
-# $Id: fastworld.sh,v 1.3 2007/10/08 14:19:34 doligez Exp $
+# $Id: fastworld.sh,v 1.3.4.1 2008/10/23 15:29:11 ertai Exp $
 cd `dirname $0`
 set -e
+if [ -e ocamlbuild_mixed_mode ]; then
+  echo ocamlbuild mixed mode detected
+  echo 'please cleanup and re-launch (make clean ; ./build/distclean.sh)'
+  exit 1
+fi
 ./mkconfig.sh
 ./mkmyocamlbuild_config.sh
 . ../config/config.sh
diff --git a/build/mixed-boot.sh b/build/mixed-boot.sh
new file mode 100755 (executable)
index 0000000..122ff41
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#########################################################################
+#                                                                       #
+#                            Objective Caml                             #
+#                                                                       #
+#       Nicolas Pouillard, projet Gallium, INRIA Rocquencourt           #
+#                                                                       #
+#   Copyright 2007 Institut National de Recherche en Informatique et    #
+#   en Automatique.  All rights reserved.  This file is distributed     #
+#   under the terms of the Q Public License version 1.0.                #
+#                                                                       #
+#########################################################################
+
+set -ex
+cd `dirname $0`/..
+touch build/ocamlbuild_mixed_mode
+mkdir -p _build
+cp -rf boot _build/
+./build/mkconfig.sh
+./build/mkmyocamlbuild_config.sh
+./build/boot.sh
index 19b0b98feef764ac60e485fb88c89250a0ad7369..84a2d913ea2c29592ff6a5ce120dfdfdee8b3106 100755 (executable)
@@ -1,9 +1,7 @@
 #!/bin/sh
-# $Id: ocamlbuild-byte-only.sh,v 1.3 2007/10/08 14:19:34 doligez Exp $
+# $Id: ocamlbuild-byte-only.sh,v 1.3.4.1 2008/10/23 15:29:11 ertai Exp $
 set -e
-OCAMLBUILD_PARTIAL="true"
-export OCAMLBUILD_PARTIAL
 cd `dirname $0`/..
 . build/targets.sh
 set -x
-$OCAMLBUILD $@ byte_stdlib_partial_mode $OCAMLC_BYTE $OCAMLLEX_BYTE $OCAMLBUILD_BYTE
+$OCAMLBUILD $@ byte_stdlib_mixed_mode $OCAMLC_BYTE $OCAMLLEX_BYTE $OCAMLBUILD_BYTE
index f0f75bfc8c3ea0144b733f5bdf152c604b07c202..c5669276c95f5754984708fa340f9033a3314c40 100755 (executable)
@@ -1,9 +1,7 @@
 #!/bin/sh
-# $Id: ocamlbuild-native-only.sh,v 1.3 2007/10/08 14:19:34 doligez Exp $
+# $Id: ocamlbuild-native-only.sh,v 1.3.4.1 2008/10/23 15:29:11 ertai Exp $
 set -e
-OCAMLBUILD_PARTIAL="true"
-export OCAMLBUILD_PARTIAL
 cd `dirname $0`/..
 . build/targets.sh
 set -x
-$OCAMLBUILD $@ native_stdlib_partial_mode $OCAMLOPT_BYTE $OCAMLLEX_BYTE $OCAMLBUILD_NATIVE
+$OCAMLBUILD $@ native_stdlib_mixed_mode $OCAMLOPT_BYTE $OCAMLLEX_BYTE $OCAMLBUILD_NATIVE
index f7f700aee37ffaa9a7528db13b7d544219fa889d..bde15ca462d02c26aa9f3896f3a5d5aa574213cc 100755 (executable)
@@ -1,9 +1,7 @@
 #!/bin/sh
-# $Id: ocamlbuildlib-native-only.sh,v 1.2 2007/11/27 12:21:53 ertai Exp $
+# $Id: ocamlbuildlib-native-only.sh,v 1.2.4.1 2008/10/23 15:29:11 ertai Exp $
 set -e
-OCAMLBUILD_PARTIAL="true"
-export OCAMLBUILD_PARTIAL
 cd `dirname $0`/..
 . build/targets.sh
 set -x
-$OCAMLBUILD $@ native_stdlib_partial_mode $OCAMLOPT_BYTE $OCAMLLEX_BYTE $OCAMLBUILDLIB_NATIVE
+$OCAMLBUILD $@ native_stdlib_mixed_mode $OCAMLOPT_BYTE $OCAMLLEX_BYTE $OCAMLBUILDLIB_NATIVE
diff --git a/build/partial-boot.sh b/build/partial-boot.sh
deleted file mode 100755 (executable)
index 79e0d62..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-#########################################################################
-#                                                                       #
-#                            Objective Caml                             #
-#                                                                       #
-#       Nicolas Pouillard, projet Gallium, INRIA Rocquencourt           #
-#                                                                       #
-#   Copyright 2007 Institut National de Recherche en Informatique et    #
-#   en Automatique.  All rights reserved.  This file is distributed     #
-#   under the terms of the Q Public License version 1.0.                #
-#                                                                       #
-#########################################################################
-
-# $Id: partial-boot.sh,v 1.5 2008/01/11 16:13:16 doligez Exp $
-
-set -ex
-cd `dirname $0`/..
-OCAMLBUILD_PARTIAL="true"
-export OCAMLBUILD_PARTIAL
-mkdir -p _build
-cp -rf boot _build/
-./build/mkconfig.sh
-./build/mkmyocamlbuild_config.sh
-./build/boot.sh
index 925e2d236e9fdb2a1a8d31d5b74be7371910eff7..0a9ab27f4f1cfc99440a1cbb7305fa318a604266 100755 (executable)
@@ -1,7 +1,12 @@
 #!/bin/sh
-# $Id: world.sh,v 1.3 2007/10/08 14:19:34 doligez Exp $
+# $Id: world.sh,v 1.3.4.1 2008/10/23 15:29:11 ertai Exp $
 cd `dirname $0`
-set -ex
+set -e
+if [ -e ocamlbuild_mixed_mode ]; then
+  echo ocamlbuild mixed mode detected
+  echo 'please cleanup and re-launch (make clean ; ./build/distclean.sh)'
+  exit 1
+fi
 ./mkconfig.sh
 ./mkmyocamlbuild_config.sh
 . ../config/config.sh
index dce39f11acfeb23fade02f0960ea38ac8e23a6d2..b92cc6de2ac0e687d4ee646b28f3ea4a5d3b0d22 100644 (file)
@@ -117,8 +117,8 @@ stacks.o: stacks.c config.h ../config/m.h ../config/s.h compatibility.h \
   minor_gc.h
 startup.o: startup.c config.h ../config/m.h ../config/s.h compatibility.h \
   alloc.h misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
-  dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
-  intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
+  dynlink.h exec.h fail.h fix_code.h freelist.h gc_ctrl.h instrtrace.h \
+  interp.h intext.h io.h memory.h gc.h major_gc.h minor_gc.h osdeps.h \
   prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h \
   version.h
 str.o: str.c alloc.h compatibility.h misc.h config.h ../config/m.h \
@@ -255,8 +255,8 @@ stacks.d.o: stacks.c config.h ../config/m.h ../config/s.h compatibility.h \
   minor_gc.h
 startup.d.o: startup.c config.h ../config/m.h ../config/s.h compatibility.h \
   alloc.h misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
-  dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
-  intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
+  dynlink.h exec.h fail.h fix_code.h freelist.h gc_ctrl.h instrtrace.h \
+  interp.h intext.h io.h memory.h gc.h major_gc.h minor_gc.h osdeps.h \
   prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h \
   version.h
 str.d.o: str.c alloc.h compatibility.h misc.h config.h ../config/m.h \
@@ -391,8 +391,8 @@ stacks.pic.o: stacks.c config.h ../config/m.h ../config/s.h compatibility.h \
   minor_gc.h
 startup.pic.o: startup.c config.h ../config/m.h ../config/s.h compatibility.h \
   alloc.h misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
-  dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
-  intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
+  dynlink.h exec.h fail.h fix_code.h freelist.h gc_ctrl.h instrtrace.h \
+  interp.h intext.h io.h memory.h gc.h major_gc.h minor_gc.h osdeps.h \
   prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h \
   version.h
 str.pic.o: str.c alloc.h compatibility.h misc.h config.h ../config/m.h \
index 1a56dd1084bdc84b629ccd079287d4bc584eb4aa..a22c069d91f432e39d800c51618aacf3ee02fe62 100644 (file)
@@ -11,7 +11,7 @@
 #                                                                       #
 #########################################################################
 
-# $Id: Makefile,v 1.64 2008/09/10 05:51:11 weis Exp $
+# $Id: Makefile,v 1.64.2.1 2008/11/08 16:29:02 xleroy Exp $
 
 include Makefile.common
 
@@ -48,7 +48,7 @@ libcamlrund.a: $(DOBJS)
        $(RANLIB) libcamlrund.a
 
 libcamlrun_shared.so: $(PICOBJS)
-       $(MKDLL) -o libcamlrun_shared.so $(PICOBJS)
+       $(MKDLL) -o libcamlrun_shared.so $(PICOBJS) $(BYTECCLIBS)
 
 .SUFFIXES: .d.o .pic.o
 
index 2c4eb0aa28ee0f3efc470f46c22a73eaa363e202..265d92a474ade6d781a384129de815a2d8ad113b 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: config.h,v 1.42 2008/01/03 09:37:09 xleroy Exp $ */
+/* $Id: config.h,v 1.42.4.1 2008/11/02 14:30:05 xleroy Exp $ */
 
 #ifndef CAML_CONFIG_H
 #define CAML_CONFIG_H
@@ -107,7 +107,7 @@ typedef struct { uint32 l, h; } uint64, int64;
 /* Memory model parameters */
 
 /* The size of a page for memory management (in bytes) is [1 << Page_log].
-   It must be a multiple of [sizeof (value)] and >= 8. */
+   It must be a multiple of [sizeof (value)] and >= 8 and <= 20. */
 #define Page_log 12             /* A page is 4 kilobytes. */
 
 /* Initial size of stack (bytes). */
index e8f111a8f3416fe0ff5e846ede819f7a7e2ba901..ae9f4ce17918d5350b388bd288296897981609f2 100644 (file)
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: freelist.c,v 1.20 2008/02/29 14:21:22 doligez Exp $ */
+/* $Id: freelist.c,v 1.20.4.1 2008/11/18 10:24:42 doligez Exp $ */
+
+#define FREELIST_DEBUG 0
+#if FREELIST_DEBUG
+#include <stdio.h>
+#endif
 
 #include <string.h>
 
@@ -43,6 +48,7 @@ static struct {
 } sentinel = {0, Make_header (0, 0, Caml_blue), 0, 0};
 
 #define Fl_head ((char *) (&(sentinel.first_bp)))
+static char *fl_prev = Fl_head;  /* Current allocation pointer. */
 static char *fl_last = NULL;     /* Last block in the list.  Only valid
                                  just after [caml_fl_allocate] returns NULL. */
 char *caml_fl_merge = Fl_head;   /* Current insertion pointer.  Managed
@@ -57,13 +63,17 @@ static char *beyond = NULL;
 
 #define Next(b) (((block *) (b))->next_bp)
 
+#define Policy_next_fit 0
+#define Policy_first_fit 1
+uintnat caml_allocation_policy = Policy_next_fit;
+#define policy caml_allocation_policy
+
 #ifdef DEBUG
 static void fl_check (void)
 {
   char *cur, *prev;
-  int merge_found = 0;
+  int prev_found = 0, flp_found = 0, merge_found = 0;
   uintnat size_found = 0;
-  int flp_found = 0;
   int sz = 0;
 
   prev = Fl_head;
@@ -71,7 +81,8 @@ static void fl_check (void)
   while (cur != NULL){
     size_found += Whsize_bp (cur);
     Assert (Is_in_heap (cur));
-    if (Wosize_bp (cur) > sz){
+    if (cur == fl_prev) prev_found = 1;
+    if (policy == Policy_first_fit && Wosize_bp (cur) > sz){
       sz = Wosize_bp (cur);
       if (flp_found < flp_size){
         Assert (Next (flp[flp_found]) == cur);
@@ -84,7 +95,8 @@ static void fl_check (void)
     prev = cur;
     cur = Next (prev);
   }
-  Assert (flp_found == flp_size);
+  if (policy == Policy_next_fit) Assert (prev_found || fl_prev == Fl_head);
+  if (policy == Policy_first_fit) Assert (flp_found == flp_size);
   Assert (merge_found || caml_fl_merge == Fl_head);
   Assert (size_found == caml_fl_cur_size);
 }
@@ -121,16 +133,19 @@ static char *allocate_block (mlsize_t wh_sz, int flpi, char *prev, char *cur)
          In case 0, it gives an invalid header to the block.  The function
          calling [caml_fl_allocate] will overwrite it. */
     Hd_op (cur) = Make_header (0, 0, Caml_white);
-    if (flpi + 1 < flp_size && flp[flpi + 1] == cur){
-      flp[flpi + 1] = prev;
-    }else if (flpi == flp_size - 1){
-      beyond = (prev == Fl_head) ? NULL : prev;
-      -- flp_size;
+    if (policy == Policy_first_fit){
+      if (flpi + 1 < flp_size && flp[flpi + 1] == cur){
+        flp[flpi + 1] = prev;
+      }else if (flpi == flp_size - 1){
+        beyond = (prev == Fl_head) ? NULL : prev;
+        -- flp_size;
+      }
     }
   }else{                                                        /* Case 2. */
     caml_fl_cur_size -= wh_sz;
     Hd_op (cur) = Make_header (Wosize_hd (h) - wh_sz, 0, Caml_blue);
   }
+  if (policy == Policy_next_fit) fl_prev = prev;
   return cur + Bosize_hd (h) - Bsize_wsize (wh_sz);
 }
 
@@ -145,124 +160,180 @@ char *caml_fl_allocate (mlsize_t wo_sz)
   mlsize_t sz, prevsz;
                                   Assert (sizeof (char *) == sizeof (value));
                                   Assert (wo_sz >= 1);
-  /* Search in the flp array. */
-  for (i = 0; i < flp_size; i++){
-    sz = Wosize_bp (Next (flp[i]));
-    if (sz >= wo_sz){
-      result = allocate_block (Whsize_wosize (wo_sz), i, flp[i], Next (flp[i]));
-      goto update_flp;
+  switch (policy){
+  case Policy_next_fit:
+                                  Assert (fl_prev != NULL);
+    /* Search from [fl_prev] to the end of the list. */
+    prev = fl_prev;
+    cur = Next (prev);
+    while (cur != NULL){                             Assert (Is_in_heap (cur));
+      if (Wosize_bp (cur) >= wo_sz){
+        return allocate_block (Whsize_wosize (wo_sz), 0, prev, cur);
+      }
+      prev = cur;
+      cur = Next (prev);
     }
-  }
-  /* Extend the flp array. */
-  if (flp_size == 0){
+    fl_last = prev;
+    /* Search from the start of the list to [fl_prev]. */
     prev = Fl_head;
-    prevsz = 0;
-  }else{
-    prev = Next (flp[flp_size - 1]);
-    prevsz = Wosize_bp (prev);
-    if (beyond != NULL) prev = beyond;
-  }
-  while (flp_size < FLP_MAX){
     cur = Next (prev);
-    if (cur == NULL){
-      fl_last = prev;
-      beyond = (prev == Fl_head) ? NULL : prev;
-      return NULL;
-    }else{
-      sz = Wosize_bp (cur);
-      if (sz > prevsz){
-        flp[flp_size] = prev;
-        ++ flp_size;
-        if (sz >= wo_sz){
-          beyond = cur;
-          i = flp_size - 1;
-          result = allocate_block (Whsize_wosize (wo_sz), flp_size - 1, prev,
-                                   cur);
-          goto update_flp;
-        }
-        prevsz = sz;
+    while (prev != fl_prev){
+      if (Wosize_bp (cur) >= wo_sz){
+        return allocate_block (Whsize_wosize (wo_sz), 0, prev, cur);
       }
+      prev = cur;
+      cur = Next (prev);
     }
-    prev = cur;
-  }
-  beyond = cur;
-
-  /* The flp table is full.  Do a slow first-fit search. */
-
-  if (beyond != NULL){
-    prev = beyond;
-  }else{
-    prev = flp[flp_size - 1];
-  }
-  prevsz = Wosize_bp (Next (flp[FLP_MAX-1]));
-  Assert (prevsz < wo_sz);
-  cur = Next (prev);
-  while (cur != NULL){
-    Assert (Is_in_heap (cur));
-    sz = Wosize_bp (cur);
-    if (sz < prevsz){
-      beyond = cur;
-    }else if (sz >= wo_sz){
-      return allocate_block (Whsize_wosize (wo_sz), flp_size, prev, cur);
+    /* No suitable block was found. */
+    return NULL;
+    break;
+
+  case Policy_first_fit: {
+    /* Search in the flp array. */
+    for (i = 0; i < flp_size; i++){
+      sz = Wosize_bp (Next (flp[i]));
+      if (sz >= wo_sz){
+#if FREELIST_DEBUG
+        if (i > 5) fprintf (stderr, "FLP: found at %d  size=%d\n", i, wo_sz);
+#endif
+        result = allocate_block (Whsize_wosize (wo_sz), i, flp[i], Next(flp[i]));
+        goto update_flp;
+      }
     }
-    prev = cur;
-    cur = Next (prev);
-  }
-  fl_last = prev;
-  return NULL;
-
- update_flp: /* (i, sz) */
-  /* The block at [i] was removed or reduced.  Update the table. */
-  Assert (0 <= i && i < flp_size + 1);
-  if (i < flp_size){
-    if (i > 0){
-      prevsz = Wosize_bp (Next (flp[i-1]));
-    }else{
+    /* Extend the flp array. */
+    if (flp_size == 0){
+      prev = Fl_head;
       prevsz = 0;
+    }else{
+      prev = Next (flp[flp_size - 1]);
+      prevsz = Wosize_bp (prev);
+      if (beyond != NULL) prev = beyond;
     }
-    if (i == flp_size - 1){
-      if (Wosize_bp (Next (flp[i])) <= prevsz){
-        beyond = Next (flp[i]);
-        -- flp_size;
+    while (flp_size < FLP_MAX){
+      cur = Next (prev);
+      if (cur == NULL){
+        fl_last = prev;
+        beyond = (prev == Fl_head) ? NULL : prev;
+        return NULL;
       }else{
-        beyond = NULL;
-      }
-    }else{
-      char *buf [FLP_MAX];
-      int j = 0;
-      mlsize_t oldsz = sz;
-
-      prev = flp[i];
-      while (prev != flp[i+1]){
-        cur = Next (prev);
         sz = Wosize_bp (cur);
         if (sz > prevsz){
-          buf[j++] = prev;
-          prevsz = sz;
-          if (sz >= oldsz){
-            Assert (sz == oldsz);
-            break;
+          flp[flp_size] = prev;
+          ++ flp_size;
+          if (sz >= wo_sz){
+            beyond = cur;
+            i = flp_size - 1;
+#if FREELIST_DEBUG
+            if (flp_size > 5){
+              fprintf (stderr, "FLP: extended to %d\n", flp_size);
+            }
+#endif
+            result = allocate_block (Whsize_wosize (wo_sz), flp_size - 1, prev,
+                                     cur);
+            goto update_flp;
           }
+          prevsz = sz;
         }
-        prev = cur;
       }
-      if (FLP_MAX >= flp_size + j - 1){
-        memmove (&flp[i+j], &flp[i+1], sizeof (block *) * (flp_size - i - 1));
-        memmove (&flp[i], &buf[0], sizeof (block *) * j);
-        flp_size += j - 1;
+      prev = cur;
+    }
+    beyond = cur;
+
+    /* The flp table is full.  Do a slow first-fit search. */
+#if FREELIST_DEBUG
+    fprintf (stderr, "FLP: table is full -- slow first-fit\n");
+#endif
+    if (beyond != NULL){
+      prev = beyond;
+    }else{
+      prev = flp[flp_size - 1];
+    }
+    prevsz = Wosize_bp (Next (flp[FLP_MAX-1]));
+    Assert (prevsz < wo_sz);
+    cur = Next (prev);
+    while (cur != NULL){
+      Assert (Is_in_heap (cur));
+      sz = Wosize_bp (cur);
+      if (sz < prevsz){
+        beyond = cur;
+      }else if (sz >= wo_sz){
+        return allocate_block (Whsize_wosize (wo_sz), flp_size, prev, cur);
+      }
+      prev = cur;
+      cur = Next (prev);
+    }
+    fl_last = prev;
+    return NULL;
+
+  update_flp: /* (i, sz) */
+    /* The block at [i] was removed or reduced.  Update the table. */
+    Assert (0 <= i && i < flp_size + 1);
+    if (i < flp_size){
+      if (i > 0){
+        prevsz = Wosize_bp (Next (flp[i-1]));
+      }else{
+        prevsz = 0;
+      }
+      if (i == flp_size - 1){
+        if (Wosize_bp (Next (flp[i])) <= prevsz){
+          beyond = Next (flp[i]);
+          -- flp_size;
+        }else{
+          beyond = NULL;
+        }
       }else{
-        if (FLP_MAX > i + j){
-          memmove (&flp[i+j], &flp[i+1], sizeof (block *) * (FLP_MAX - i - j));
-          memmove (&flp[i], &buf[0], sizeof (block *) * j);
+        char *buf [FLP_MAX];
+        int j = 0;
+        mlsize_t oldsz = sz;
+
+        prev = flp[i];
+        while (prev != flp[i+1]){
+          cur = Next (prev);
+          sz = Wosize_bp (cur);
+          if (sz > prevsz){
+            buf[j++] = prev;
+            prevsz = sz;
+            if (sz >= oldsz){
+              Assert (sz == oldsz);
+              break;
+            }
+          }
+          prev = cur;
+        }
+#if FREELIST_DEBUG
+        if (j > 2) fprintf (stderr, "FLP: update; buf size = %d\n", j);
+#endif
+        if (FLP_MAX >= flp_size + j - 1){
+          if (j != 1){
+            memmove (&flp[i+j], &flp[i+1], sizeof (block *) * (flp_size-i-1));
+          }
+          if (j > 0) memmove (&flp[i], &buf[0], sizeof (block *) * j);
+          flp_size += j - 1;
         }else{
-          memmove (&flp[i], &buf[0], sizeof (block *) * (FLP_MAX - i));
+          if (FLP_MAX > i + j){
+            if (j != 1){
+              memmove (&flp[i+j], &flp[i+1], sizeof (block *) * (FLP_MAX-i-j));
+            }
+            if (j > 0) memmove (&flp[i], &buf[0], sizeof (block *) * j);
+          }else{
+            if (i != FLP_MAX){
+              memmove (&flp[i], &buf[0], sizeof (block *) * (FLP_MAX - i));
+            }
+          }
+          flp_size = FLP_MAX - 1;
+          beyond = Next (flp[FLP_MAX - 1]);
         }
-        flp_size = FLP_MAX - 1;
-        beyond = Next (flp[FLP_MAX - 1]);
       }
     }
+    return result;
+  }
+  break;
+
+  default:
+    Assert (0);   /* unknown policy */
+    break;
   }
-  return result;
+  return NULL;  /* NOT REACHED */
 }
 
 static char *last_fragment;
@@ -291,7 +362,17 @@ static void truncate_flp (char *changed)
 void caml_fl_reset (void)
 {
   Next (Fl_head) = NULL;
-  truncate_flp (Fl_head);
+  switch (policy){
+  case Policy_next_fit:
+    fl_prev = Fl_head;
+    break;
+  case Policy_first_fit:
+    truncate_flp (Fl_head);
+    break;
+  default:
+    Assert (0);
+    break;
+  }
   caml_fl_cur_size = 0;
   caml_fl_init_merge ();
 }
@@ -316,7 +397,7 @@ char *caml_fl_merge_block (char *bp)
   Assert (prev < bp || prev == Fl_head);
   Assert (cur > bp || cur == NULL);
 
-  truncate_flp (prev);
+  if (policy == Policy_first_fit) truncate_flp (prev);
 
   /* If [last_fragment] and [bp] are adjacent, merge them. */
   if (last_fragment == Hp_bp (bp)){
@@ -338,6 +419,7 @@ char *caml_fl_merge_block (char *bp)
 
     if (Wosize_hd (hd) + cur_whsz <= Max_wosize){
       Next (prev) = next_cur;
+      if (policy == Policy_next_fit && fl_prev == cur) fl_prev = prev;
       hd = Make_header (Wosize_hd (hd) + cur_whsz, 0, Caml_blue);
       Hd_bp (bp) = hd;
       adj = bp + Bosize_hd (hd);
@@ -395,7 +477,9 @@ void caml_fl_add_blocks (char *bp)
     if (fl_last == caml_fl_merge && bp < caml_gc_sweep_hp){
       caml_fl_merge = (char *) Field (bp, 1);
     }
-    if (flp_size < FLP_MAX) flp [flp_size++] = fl_last;
+    if (policy == Policy_first_fit && flp_size < FLP_MAX){
+      flp [flp_size++] = fl_last;
+    }
   }else{
     char *cur, *prev;
 
@@ -415,7 +499,7 @@ void caml_fl_add_blocks (char *bp)
     if (prev == caml_fl_merge && bp < caml_gc_sweep_hp){
       caml_fl_merge = (char *) Field (bp, 1);
     }
-    truncate_flp (bp);
+    if (policy == Policy_first_fit) truncate_flp (bp);
   }
 }
 
@@ -442,3 +526,20 @@ void caml_make_free_blocks (value *p, mlsize_t size, int do_merge)
     p += sz;
   }
 }
+
+void caml_set_allocation_policy (uintnat p)
+{
+  switch (p){
+  case Policy_next_fit:
+    fl_prev = Fl_head;
+    break;
+  case Policy_first_fit:
+    flp_size = 0;
+    beyond = NULL;
+    break;
+  default:
+    Assert (0);
+    break;
+  }
+  policy = p;
+}
index ad84a338bb3b81a3854cedaa41eea4fed1f972e9..1ec93e9184549a724fd660495c9d4a043312a35e 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: freelist.h,v 1.13 2008/02/29 12:56:15 doligez Exp $ */
+/* $Id: freelist.h,v 1.13.4.1 2008/11/18 10:24:43 doligez Exp $ */
 
 /* Free lists of heap blocks. */
 
@@ -30,6 +30,7 @@ void caml_fl_reset (void);
 char *caml_fl_merge_block (char *);
 void caml_fl_add_blocks (char *);
 void caml_make_free_blocks (value *, mlsize_t, int);
+void caml_set_allocation_policy (uintnat);
 
 
 #endif /* CAML_FREELIST_H */
index d87912bbfd70e6bd0c72da348b1be418e53b11ee..69114da66a115b445d5c93ef9434ab01cbbc657d 100644 (file)
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: gc_ctrl.c,v 1.53 2008/02/29 12:56:15 doligez Exp $ */
+/* $Id: gc_ctrl.c,v 1.53.4.2 2008/11/20 18:33:13 doligez Exp $ */
 
 #include "alloc.h"
 #include "compact.h"
 #include "custom.h"
 #include "finalise.h"
+#include "freelist.h"
 #include "gc.h"
 #include "gc_ctrl.h"
 #include "major_gc.h"
@@ -41,8 +42,9 @@ intnat caml_stat_minor_collections = 0,
        caml_stat_heap_chunks = 0;
 
 extern asize_t caml_major_heap_increment;  /* bytes; see major_gc.c */
-extern uintnat caml_percent_free;    /*        see major_gc.c */
-extern uintnat caml_percent_max;     /*        see compact.c */
+extern uintnat caml_percent_free;          /*        see major_gc.c */
+extern uintnat caml_percent_max;           /*        see compact.c */
+extern uintnat caml_allocation_policy;     /*        see freelist.c */
 
 #define Next(hp) ((hp) + Bhsize_hp (hp))
 
@@ -306,7 +308,7 @@ CAMLprim value caml_gc_get(value v)
   CAMLparam0 ();   /* v is ignored */
   CAMLlocal1 (res);
 
-  res = caml_alloc_tuple (6);
+  res = caml_alloc_tuple (7);
   Store_field (res, 0, Val_long (Wsize_bsize (caml_minor_heap_size)));  /* s */
   Store_field (res, 1,Val_long(Wsize_bsize(caml_major_heap_increment)));/* i */
   Store_field (res, 2, Val_long (caml_percent_free));                   /* o */
@@ -317,6 +319,7 @@ CAMLprim value caml_gc_get(value v)
 #else
   Store_field (res, 5, Val_long (0));
 #endif
+  Store_field (res, 6, Val_long (caml_allocation_policy));              /* a */
   CAMLreturn (res);
 }
 
@@ -347,11 +350,21 @@ static intnat norm_minsize (intnat s)
   return s;
 }
 
+static intnat norm_policy (intnat p)
+{
+  if (p >= 0 && p <= 1){
+    return p;
+  }else{
+    return 1;
+  }
+}
+
 CAMLprim value caml_gc_set(value v)
 {
   uintnat newpf, newpm;
   asize_t newheapincr;
   asize_t newminsize;
+  uintnat newpolicy;
 
   caml_verb_gc = Long_val (Field (v, 3));
 
@@ -377,6 +390,11 @@ CAMLprim value caml_gc_set(value v)
     caml_gc_message (0x20, "New heap increment size: %luk bytes\n",
                      caml_major_heap_increment/1024);
   }
+  newpolicy = norm_policy (Long_val (Field (v, 6)));
+  if (newpolicy != caml_allocation_policy){
+    caml_gc_message (0x20, "New allocation policy: %d\n", newpolicy);
+    caml_set_allocation_policy (newpolicy);
+  }
 
     /* Minor heap size comes last because it will trigger a minor collection
        (thus invalidating [v]) and it can raise [Out_of_memory]. */
@@ -471,4 +489,6 @@ void caml_init_gc (uintnat minor_size, uintnat major_size,
   caml_gc_message (0x20, "Initial max overhead: %lu%%\n", caml_percent_max);
   caml_gc_message (0x20, "Initial heap increment: %luk bytes\n",
                    caml_major_heap_increment / 1024);
+  caml_gc_message (0x20, "Initial allocation policy: %d\n",
+                   caml_allocation_policy);
 }
index 5f2863f8519b498d2d502c3a937df65df0df89c7..c6aebf3fda7bb4d04f2c368a91059e585797201c 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: major_gc.c,v 1.62 2008/07/28 12:03:55 doligez Exp $ */
+/* $Id: major_gc.c,v 1.62.2.1 2008/11/12 12:53:07 doligez Exp $ */
 
 #include <limits.h>
 
@@ -358,13 +358,25 @@ intnat caml_major_collection_slice (intnat howmuch)
                  MW = caml_stat_heap_size * 100 / (100 + caml_percent_free)
      Amount of sweeping work for the GC cycle:
                  SW = caml_stat_heap_size
-     Amount of marking work for this slice:
-                 MS = P * MW
-                 MS = P * caml_stat_heap_size * 100 / (100 + caml_percent_free)
-     Amount of sweeping work for this slice:
-                 SS = P * SW
-                 SS = P * caml_stat_heap_size
-     This slice will either mark 2*MS words or sweep 2*SS words.
+
+     In order to finish marking with a non-empty free list, we will
+     use 40% of the time for marking, and 60% for sweeping.
+
+     If TW is the total work for this cycle,
+                 MW = 40/100 * TW
+                 SW = 60/100 * TW
+
+     Amount of work to do for this slice:
+                 W  = P * TW
+
+     Amount of marking work for a marking slice:
+                 MS = P * MW / (40/100)
+                 MS = P * caml_stat_heap_size * 250 / (100 + caml_percent_free)
+     Amount of sweeping work for a sweeping slice:
+                 SS = P * SW / (60/100)
+                 SS = P * caml_stat_heap_size * 5 / 3
+
+     This slice will either mark MS words or sweep SS words.
   */
 
   if (caml_gc_phase == Phase_idle) start_cycle ();
@@ -391,10 +403,10 @@ intnat caml_major_collection_slice (intnat howmuch)
                    (uintnat) (p * 1000000));
 
   if (caml_gc_phase == Phase_mark){
-    computed_work = 2 * (intnat) (p * Wsize_bsize (caml_stat_heap_size) * 100
-                                / (100 + caml_percent_free));
+    computed_work = (intnat) (p * Wsize_bsize (caml_stat_heap_size) * 250
+                              / (100 + caml_percent_free));
   }else{
-    computed_work = 2 * (intnat) (p * Wsize_bsize (caml_stat_heap_size));
+    computed_work = (intnat) (p * Wsize_bsize (caml_stat_heap_size) * 5 / 3);
   }
   caml_gc_message (0x40, "ordered work = %ld words\n", howmuch);
   caml_gc_message (0x40, "computed work = %ld words\n", computed_work);
index 9fdf706c50ffe46108786460bcda3e5ef66a3cae..3ab37a42c8e7b3da771e5ceb29f4812012024d5d 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: memory.c,v 1.46 2008/02/29 12:56:15 doligez Exp $ */
+/* $Id: memory.c,v 1.46.4.1 2008/11/02 14:30:05 xleroy Exp $ */
 
 #include <stdlib.h>
 #include <string.h>
@@ -34,7 +34,10 @@ extern uintnat caml_percent_free;                   /* major_gc.c */
 #define Page(p) ((uintnat) (p) >> Page_log)
 #define Page_mask ((uintnat) -1 << Page_log)
 
-/* The page table is represented sparsely as a hash table
+#ifdef ARCH_SIXTYFOUR
+
+/* 64-bit implementation:
+   The page table is represented sparsely as a hash table
    with linear probing */
 
 struct page_table {
@@ -161,6 +164,38 @@ static int caml_page_table_modify(uintnat page, int toclear, int toset)
   return 0;
 }
 
+#else
+
+/* 32-bit implementation:
+   The page table is represented as a 2-level array of unsigned char */
+
+CAMLexport unsigned char * caml_page_table[Pagetable1_size];
+static unsigned char caml_page_table_empty[Pagetable2_size] = { 0, };
+
+int caml_page_table_initialize(mlsize_t bytesize)
+{
+  int i;
+  for (i = 0; i < Pagetable1_size; i++) 
+    caml_page_table[i] = caml_page_table_empty;
+  return 0;
+}
+
+static int caml_page_table_modify(uintnat page, int toclear, int toset)
+{
+  uintnat i = Pagetable_index1(page);
+  uintnat j = Pagetable_index2(page);
+
+  if (caml_page_table[i] == caml_page_table_empty) {
+    unsigned char * new_tbl = calloc(Pagetable2_size, 1);
+    if (new_tbl == 0) return -1;
+    caml_page_table[i] = new_tbl;
+  }
+  caml_page_table[i][j] = (caml_page_table[i][j] & ~toclear) | toset;
+  return 0;
+}
+
+#endif
+
 int caml_page_table_add(int kind, void * start, void * end)
 {
   uintnat pstart = (uintnat) start & Page_mask;
index f17903d097ca17e4be44f7a2a6546a7ec04d9023..fd16351edf91a2426c8c01db830c4ceb0c387f54 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: memory.h,v 1.59 2008/03/10 19:56:39 xleroy Exp $ */
+/* $Id: memory.h,v 1.59.4.1 2008/11/02 14:30:05 xleroy Exp $ */
 
 /* Allocation macros and functions */
 
@@ -55,13 +55,34 @@ color_t caml_allocation_color (void *hp);
 #define In_static_data 4
 #define In_code_area 8
 
+#ifdef ARCH_SIXTYFOUR
+
+/* 64 bits: Represent page table as a sparse hash table */
+int caml_page_table_lookup(void * addr);
 #define Classify_addr(a) (caml_page_table_lookup((void *)(a)))
+
+#else
+
+/* 32 bits: Represent page table as a 2-level array */
+#define Pagetable2_log 11
+#define Pagetable2_size (1 << Pagetable2_log)
+#define Pagetable1_log (Page_log + Pagetable2_log)
+#define Pagetable1_size (1 << (32 - Pagetable1_log))
+CAMLextern unsigned char * caml_page_table[Pagetable1_size];
+
+#define Pagetable_index1(a) (((uintnat)(a)) >> Pagetable1_log)
+#define Pagetable_index2(a) \
+  ((((uintnat)(a)) >> Page_log) & (Pagetable2_size - 1))
+#define Classify_addr(a) \
+  caml_page_table[Pagetable_index1(a)][Pagetable_index2(a)]
+
+#endif
+
 #define Is_in_value_area(a) \
   (Classify_addr(a) & (In_heap | In_young | In_static_data))
 #define Is_in_heap(a) (Classify_addr(a) & In_heap)
 #define Is_in_heap_or_young(a) (Classify_addr(a) & (In_heap | In_young))
 
-int caml_page_table_lookup(void * addr);
 int caml_page_table_add(int kind, void * start, void * end);
 int caml_page_table_remove(int kind, void * start, void * end);
 int caml_page_table_initialize(mlsize_t bytesize);
index bb4d882b5f8adb419a0dcc4e8ae8d885bbf9b2c3..55be64ec90ba60063ac57b891fb21765f4e20d1f 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: startup.c,v 1.70 2008/03/14 13:47:24 xleroy Exp $ */
+/* $Id: startup.c,v 1.70.2.1 2008/11/18 10:24:43 doligez Exp $ */
 
 /* Start-up code */
 
@@ -35,6 +35,7 @@
 #include "exec.h"
 #include "fail.h"
 #include "fix_code.h"
+#include "freelist.h"
 #include "gc_ctrl.h"
 #include "instrtrace.h"
 #include "interp.h"
@@ -298,6 +299,7 @@ static void scanmult (char *opt, uintnat *var)
 static void parse_camlrunparam(void)
 {
   char *opt = getenv ("OCAMLRUNPARAM");
+  uintnat p;
 
   if (opt == NULL) opt = getenv ("CAMLRUNPARAM");
 
@@ -313,6 +315,7 @@ static void parse_camlrunparam(void)
       case 'v': scanmult (opt, &caml_verb_gc); break;
       case 'b': caml_record_backtrace(Val_true); break;
       case 'p': caml_parser_trace = 1; break;
+      case 'a': scanmult (opt, &p); caml_set_allocation_policy (p); break;
       }
     }
   }
@@ -473,4 +476,3 @@ CAMLexport void caml_startup_code(
   if (Is_exception_result(res))
     caml_fatal_uncaught_exception(Extract_exception(res));
 }
-
index 1b191f02d8ba656f3279f2c714a691e968c82f18..527c0c484a1ded3d4f80b2a21512c576ec4461a9 100644 (file)
@@ -19,7 +19,7 @@
 
 module Id = struct
   value name = "Camlp4.PreCast";
-  value version = "$Id: PreCast.ml,v 1.5 2007/10/08 14:19:34 doligez Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 type camlp4_token = Sig.camlp4_token ==
index 77e661da641407091083c402a48a3eb67e4cc4cb..bd220c16d3bf26394a5e96ba1d15bfe80d7052b6 100644 (file)
@@ -19,7 +19,7 @@
 
 module Id = struct
   value name = "Camlp4Printers.DumpCamlp4Ast";
-  value version = "$Id: DumpCamlp4Ast.ml,v 1.7 2007/11/21 17:53:10 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Syntax)
index f82d659c1fb4e68335d236cac47b08e465ce4702..dd6c60f6f98247c7e74dc52abdc3f6da67790394 100644 (file)
@@ -19,7 +19,7 @@
 
 module Id : Sig.Id = struct
   value name = "Camlp4Printers.DumpOCamlAst";
-  value version = "$Id: DumpOCamlAst.ml,v 1.7 2007/11/21 17:53:10 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax)
index 2b00930245da361070c2f631826495a72ac91191..d593f9efc54089ddc6c8501986a4b55f21ad4848 100644 (file)
@@ -19,7 +19,7 @@
 
 module Id = struct
   value name = "Camlp4.Printers.Null";
-  value version = "$Id: Null.ml,v 1.2 2007/02/07 10:09:21 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Syntax) = struct
index 1df2558369986649634819bc1169e4c5b06073a4..b3641718cbad0513616d111572836514a16ceb1b 100644 (file)
@@ -20,7 +20,7 @@ open Format;
 
 module Id = struct
   value name = "Camlp4.Printers.OCaml";
-  value version = "$Id: OCaml.ml,v 1.39 2008/10/05 16:25:28 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index ffe3b16335ebffc70458a109637b2fad0f3167f5..a1aa40c5448a7aabc86267c49efaca3d3bd1abe0 100644 (file)
@@ -20,7 +20,7 @@ open Format;
 
 module Id = struct
   value name = "Camlp4.Printers.OCamlr";
-  value version = "$Id: OCamlr.ml,v 1.23 2008/10/05 16:30:55 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index a03887c25f10923a2e7a82fc99cfe53e8eac6c8a..3e7106e73d83ef3da64ee7419f25b1c007d68e35 100644 (file)
@@ -18,7 +18,7 @@
  * - Nicolas Pouillard: refactoring
  *)
 
-(* $Id: Sig.ml,v 1.7 2008/10/04 10:47:56 ertai Exp $ *)
+
 
 (** Camlp4 signature repository *)
 
@@ -640,9 +640,11 @@ module type AstFilters = sig
 
   value register_sig_item_filter : (filter Ast.sig_item) -> unit;
   value register_str_item_filter : (filter Ast.str_item) -> unit;
+  value register_topphrase_filter : (filter Ast.str_item) -> unit;
 
   value fold_interf_filters : ('a -> filter Ast.sig_item -> 'a) -> 'a -> 'a;
   value fold_implem_filters : ('a -> filter Ast.str_item -> 'a) -> 'a -> 'a;
+  value fold_topphrase_filters : ('a -> filter Ast.str_item -> 'a) -> 'a -> 'a;
 
 end;
 
index 9962d8a1944bf710bd38e5ffc0f5e1e478920653..665e610affacfe12f4860513d05d47ef0fcd85a8 100644 (file)
@@ -28,7 +28,10 @@ module Make (Ast : Sig.Camlp4Ast)
   value fold_interf_filters f i = Queue.fold f i interf_filters;
   value implem_filters = Queue.create ();
   value fold_implem_filters f i = Queue.fold f i implem_filters;
+  value topphrase_filters = Queue.create ();
+  value fold_topphrase_filters f i = Queue.fold f i topphrase_filters;
 
   value register_sig_item_filter f = Queue.add f interf_filters;
   value register_str_item_filter f = Queue.add f implem_filters;
+  value register_topphrase_filter f = Queue.add f topphrase_filters;
 end;
index e41c8153972751617552d823239211fb4ee00a36..fa6deaaad169b4667899612c6e9904660f1c073c 100644 (file)
@@ -18,7 +18,7 @@
  * - Nicolas Pouillard: refactoring
  *)
 
-(* $Id: Camlp4Ast2OCamlAst.ml,v 1.22 2008/10/04 11:11:09 ertai Exp $ *)
+
 
 module Make (Ast : Sig.Camlp4Ast) = struct
   open Format;
index f3c15e29308834b3d9fed68fa7cfb8e56c62bf43..6c284833237a5a7008fe6345b18441276e7f189b 100644 (file)
@@ -18,7 +18,7 @@
  * - Nicolas Pouillard: refactoring
  *)
 
-(* $Id: Camlp4Ast2OCamlAst.mli,v 1.5 2008/01/11 16:13:16 doligez Exp $ *)
+
 
 module Make (Camlp4Ast : Sig.Camlp4Ast) : sig
   open Camlp4Ast;
index f5e4986eec98b9e94761c43ccf3d51d0d770fa8c..f8e8c22fdff56a062177805ca16a18a4f9b0fc90 100644 (file)
@@ -19,7 +19,7 @@
  *)
 
 
-(* $Id: DynLoader.ml,v 1.4 2007/11/06 15:16:56 frisch Exp $ *)
+
 
 type t = Queue.t string;
 
index c6fa82a56ac71a5d0f0256ef005b4df07795b516..6da366f70556b57c7cdc618d6420d6735a48ffc6 100644 (file)
@@ -13,7 +13,7 @@
 (*                                                                          *)
 (****************************************************************************)
 
-(* $Id: Fold.ml,v 1.3 2007/02/07 10:09:21 ertai Exp $ *)
+
 
 (* Authors:
  * - Daniel de Rauglaudre: initial version
index d5ae044850548c13c3b4ade83e1f39cea579b81f..0b9b22b7912959ea8acbb2fa21b4c935eaefe4df 100644 (file)
@@ -13,7 +13,7 @@
 (*                                                                          *)
 (****************************************************************************)
 
-(* $Id: Fold.mli,v 1.2 2006/07/08 17:21:32 pouillar Exp $ *)
+
 
 (* Authors:
  * - Daniel de Rauglaudre: initial version
index 0e6c44c005c689f6016f697509fc4388a4b052e3..695982a3d2b7ba258dc7021c9fb2f386de426624 100644 (file)
@@ -13,7 +13,7 @@
 (*                                                                          *)
 (****************************************************************************)
 
-(* $Id: Parser.mli,v 1.3 2008/10/03 15:18:37 ertai Exp $ *)
+
 
 (* Authors:
  * - Daniel de Rauglaudre: initial version
index 87193bcab8c651f12ca86eb629b2ea2bf4b4c7d7..f024fa4377edffc9180de027c3ed865e1ee1e7d6 100644 (file)
@@ -17,7 +17,7 @@
  * - Nicolas Pouillard: refactoring
  *)
 
-(* $Id: Lexer.mll,v 1.10 2008/01/11 16:13:16 doligez Exp $ *)
+
 
 (* The lexer definition *)
 
index 9401b2590541571df7ee3e8c7e61c7258e8eba44..65202c87512785b4971d22dceffbd74f82727cae 100644 (file)
@@ -18,7 +18,7 @@
  * - Nicolas Pouillard: refactoring
  *)
 
-(* $Id: Quotation.ml,v 1.6 2007/11/21 17:57:54 ertai Exp $ *)
+
 
 module Make (Ast : Sig.Camlp4Ast)
 : Sig.Quotation with module Ast = Ast
index f49bd9147722cdbf1e2757a029f3928fa00822fe..5e9ff0fd4b54f545f4f247cbe3c68304f73c4f4d 100644 (file)
@@ -18,7 +18,7 @@
  * - Nicolas Pouillard: refactoring
  *)
 
-(* $Id: Camlp4Bin.ml,v 1.19 2008/10/03 15:41:24 ertai Exp $ *)
+
 
 open Camlp4;
 open PreCast.Syntax;
index f3a0bbfd743d52a95ab7f26eac58ac3aaf4bae8e..768e4dac9ed2654fdcefecc57481e1edaa9d375d 100644 (file)
@@ -22,7 +22,7 @@ open Camlp4;
 
 module Id = struct
   value name    = "Camlp4AstLifter";
-  value version = "$Id: Camlp4AstLifter.ml,v 1.1 2007/02/07 10:09:22 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
index faccf97ba1167503a9d764bea55d743083aa2321..3d338c41982af60deaed421796c49d0a128841d3 100644 (file)
@@ -22,7 +22,7 @@ open Camlp4;
 
 module Id = struct
   value name    = "Camlp4ExceptionTracer";
-  value version = "$Id: Camlp4ExceptionTracer.ml,v 1.1 2007/02/07 10:09:22 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
index b44f7f16cc50aacdb1857d6c7f20c758d2aedd21..f5efd2c6a8c6be48ef2474b2a47f0f0ca1c26653 100644 (file)
@@ -22,7 +22,7 @@ open Camlp4;
 
 module Id = struct
   value name    = "Camlp4FoldGenerator";
-  value version = "$Id: Camlp4FoldGenerator.ml,v 1.3 2007/11/21 17:51:39 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
index 2c8f407eda98fb3e2f80d492804a343f2991203c..533292de61051f77fad5a369cabef51a2dbbe48c 100644 (file)
@@ -22,7 +22,7 @@ open Camlp4;
 
 module Id = struct
   value name    = "Camlp4LocationStripper";
-  value version = "$Id: Camlp4LocationStripper.ml,v 1.2 2007/10/08 14:19:34 doligez Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
index db5fb5c9dfe0644420422739addb6c94fa557600..52b00eb6a99b624f193e2a55f9394c7535bac164 100644 (file)
@@ -1,5 +1,5 @@
 (* This module is useless now. Camlp4FoldGenerator handles map too. *)
 module Id = struct
   value name    = "Camlp4MapGenerator";
-  value version = "$Id: Camlp4MapGenerator.ml,v 1.4 2008/01/11 16:13:16 doligez Exp $";
+  value version = Sys.ocaml_version;
 end;
index d00e3612eaaa7172ef75929e808121554c194750..1800851607ad1674c000df7e1a8dc4af2e4398e3 100644 (file)
@@ -21,7 +21,7 @@ open Camlp4;
 
 module Id = struct
   value name    = "Camlp4Profiler";
-  value version = "$Id: Camlp4Profiler.ml,v 1.1 2007/02/07 10:09:22 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
index b0005caed40d5efcb0cb53b8be9b03347f4ac1dd..07ead66a83095596fae264203322c6a0bad259bc 100644 (file)
@@ -22,7 +22,7 @@ open Camlp4;
 
 module Id = struct
   value name    = "Camlp4TrashRemover";
-  value version = "$Id: Camlp4TrashRemover.ml,v 1.2 2007/10/08 14:19:34 doligez Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (AstFilters : Camlp4.Sig.AstFilters) = struct
index d5fd144a8f5130e72c25d4646d8d5f0d7f6fe217..67d04edf94bfeac9deaee77b94dcdbfac22344c8 100644 (file)
@@ -20,7 +20,7 @@ open Camlp4;                                       (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4AstLoader";
-  value version = "$Id: Camlp4AstLoader.ml,v 1.1 2007/02/07 10:09:22 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Ast : Camlp4.Sig.Ast) = struct
index 8331e5eb8f89667cc6617d98f8f190493e81ccaf..a815a96a24ef2cf6ebf8cdd7c9f4b3b462929461 100644 (file)
@@ -19,7 +19,7 @@ open Camlp4;                                             (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4DebugParser";
-  value version = "$Id: Camlp4DebugParser.ml,v 1.1 2007/02/07 10:09:22 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index 1b47156ab2eae00d077d1133a4111b69443628ca..50cbdb2bf3effbda06f39ef70b67a6f42eded3b0 100644 (file)
@@ -21,7 +21,7 @@ open Camlp4;                                        (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4GrammarParser";
-  value version = "$Id: Camlp4GrammarParser.ml,v 1.5 2008/01/11 16:13:16 doligez Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index 69d9fe2c96b345e4c502b84b66f36fcec0af2db7..05cfab4725712cfb4f70ef740c9a2531e25c28ae 100644 (file)
@@ -21,7 +21,7 @@ open Camlp4;                                             (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4ListComprenhsion";
-  value version = "$Id: Camlp4ListComprehension.ml,v 1.2 2007/11/21 17:51:16 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index 0995fac3d43a9c9eccd69545a2195cffb34d2c70..ea3591527055079668922dfac1d43b8c99c4cc3f 100644 (file)
@@ -23,7 +23,7 @@ open Camlp4;                                             (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4MacroParser";
-  value version = "$Id: Camlp4MacroParser.ml,v 1.5 2008/10/03 14:19:19 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 (*
index 7dee9d134265853f3a23a1093d811ebbe7ce7559..8a1b53c081560370187c7a4ec98212fda690d2df 100644 (file)
@@ -21,7 +21,7 @@ open Camlp4;                                        (* -*- camlp4r -*- *)
 
 module Id : Sig.Id = struct
   value name = "Camlp4OCamlParser";
-  value version = "$Id: Camlp4OCamlParser.ml,v 1.14 2008/10/05 15:26:54 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index ccc389159519a1e2f3488459be17bcc09ca2fb5a..94a2bdb213e1a1d614616a6a5618364f1cd382c6 100644 (file)
@@ -22,7 +22,7 @@ open Camlp4;
 
 module Id : Sig.Id = struct
   value name = "Camlp4OCamlParserParser";
-  value version = "$Id: Camlp4OCamlParserParser.ml,v 1.1 2007/02/07 10:09:22 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index c9e1e846c24abf1f6a7c22daaf5fcf489c715cc9..e56ab361990d8fa3141de2dd61fcffecd6cdcecf 100644 (file)
@@ -19,7 +19,7 @@ open Camlp4;                                             (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4Reloaded";
-  value version = "$Id: Camlp4OCamlReloadedParser.ml,v 1.2 2007/10/08 14:19:34 doligez Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index 91dbd5758cca18ea90e0c56ee895fa9dca25e63c..f3beee674da7ab7ae8b3c7283cd7f1a51e72fbf7 100644 (file)
@@ -20,7 +20,7 @@ open Camlp4;                                        (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4OCamlRevisedParser";
-  value version = "$Id: Camlp4OCamlRevisedParser.ml,v 1.15 2008/10/05 15:26:54 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index e33772c70569c437f529f89c4c6a1f95121d76b0..4e4d35d856c5278c2dbecac748a95b7004ea9a06 100644 (file)
@@ -21,7 +21,7 @@ open Camlp4;                                        (* -*- camlp4r -*- *)
 
 module Id : Sig.Id = struct
   value name = "Camlp4OCamlRevisedParserParser";
-  value version = "$Id: Camlp4OCamlRevisedParserParser.ml,v 1.4 2008/01/11 16:13:16 doligez Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax) = struct
index bcc8cd7791282c7fa8279a414e74ea23c7506d76..50e57fa1f984c0363927177897785a6ae602afb8 100644 (file)
@@ -19,7 +19,7 @@ open Camlp4;                                             (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4QuotationCommon";
-  value version = "$Id: Camlp4QuotationCommon.ml,v 1.5 2008/01/11 16:13:16 doligez Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax)
index 2f8be4356fec8a29b236d641a6af98b9a4391461..fb225a583d7550f418fce316497b831a3a311efb 100644 (file)
@@ -21,7 +21,7 @@ open Camlp4;                                        (* -*- camlp4r -*- *)
 
 module Id = struct
   value name = "Camlp4QuotationExpander";
-  value version = "$Id: Camlp4QuotationExpander.ml,v 1.1 2007/02/07 10:09:22 ertai Exp $";
+  value version = Sys.ocaml_version;
 end;
 
 module Make (Syntax : Sig.Camlp4Syntax)
index 2e5a5ca9c16e12905742b0efedfeaeb5df24cc70..ff2a7e58c6454dfc08f8d882049f3d31788f4561 100644 (file)
@@ -18,7 +18,7 @@
  * - Nicolas Pouillard: refactoring
  *)
 
-(* $Id: Rprint.ml,v 1.5 2008/01/11 16:13:16 doligez Exp $ *)
+
 
 (* There is a few Obj.magic due to the fact that we no longer have compiler
    files like Parsetree, Location, Longident but Camlp4_import that wrap them to
index f1cd069d19ba3265d3705a345df93b8051ea4f29..4bb92bdc4f71cd6d13108a631263c0fd5d96a5da 100644 (file)
@@ -18,7 +18,7 @@
  * - Nicolas Pouillard: refactoring
  *)
 
-(* $Id: Top.ml,v 1.4.4.1 2008/10/13 13:34:06 ertai Exp $ *)
+
 
 (* There is a few Obj.magic due to the fact that we no longer have compiler
    files like Parsetree, Location, Longident but Camlp4_import that wrap them to
@@ -102,8 +102,13 @@ value wrap parse_fun =
 
 value toplevel_phrase token_stream =
   match Gram.parse_tokens_after_filter Syntax.top_phrase token_stream with
-  [ Some phr -> Ast2pt.phrase phr
-  | None -> raise End_of_file ];
+    [ Some str_item ->
+       let str_item =
+         AstFilters.fold_topphrase_filters (fun t filter -> filter t) str_item
+       in
+       Ast2pt.phrase str_item
+
+    | None -> raise End_of_file ];
 
 value use_file token_stream =
   let (pl0, eoi) =
index 1fbb95f771a54de47ca3ea302973909cae96eb38..8686e25b5b622dc2f9ab17be560ed9efa9cc55b7 100644 (file)
@@ -10,7 +10,7 @@
 #                                                                       #
 #########################################################################
 
-# $Id: Makefile,v 1.40 2007/02/07 10:09:21 ertai Exp $
+
 
 # RELEASE NOTE:
 #   Do not forget to call make genclean to update Makefile.clean before a
index 57104c22ebeb36c20ed27a66b561fec51cb01c5b..ea3f335d08a743910b3c1eb22cb587f01436e9ff 100644 (file)
@@ -372,7 +372,7 @@ module Sig =
  * - Daniel de Rauglaudre: initial version
  * - Nicolas Pouillard: refactoring
  *)
-    (* $Id$ *)
+    
     (** Camlp4 signature repository *)
     (** {6 Basic signatures} *)
     (** Signature with just a type. *)
@@ -17462,7 +17462,7 @@ module Printers =
           struct
             let name = "Camlp4Printers.DumpCamlp4Ast"
               
-            let version = "$Id$"
+            let version = Sys.ocaml_version
               
           end
           
@@ -17505,7 +17505,7 @@ module Printers =
           struct
             let name = "Camlp4Printers.DumpOCamlAst"
               
-            let version = "$Id$"
+            let version = Sys.ocaml_version
               
           end
           
@@ -17556,7 +17556,7 @@ module Printers =
       struct
         module Id =
           struct let name = "Camlp4.Printers.Null"
-                    let version = "$Id$"
+                    let version = Sys.ocaml_version
                        end
           
         module Make (Syntax : Sig.Syntax) =
@@ -17821,7 +17821,7 @@ module Printers =
           
         module Id =
           struct let name = "Camlp4.Printers.OCaml"
-                    let version = "$Id$"
+                    let version = Sys.ocaml_version
                        end
           
         module Make (Syntax : Sig.Camlp4Syntax) =
@@ -19255,7 +19255,7 @@ module Printers =
           
         module Id =
           struct let name = "Camlp4.Printers.OCamlr"
-                    let version = "$Id$"
+                    let version = Sys.ocaml_version
                        end
           
         module Make (Syntax : Sig.Camlp4Syntax) =
@@ -20204,7 +20204,7 @@ module PreCast :
   end =
   struct
     module Id = struct let name = "Camlp4.PreCast"
-                          let version = "$Id$"
+                          let version = Sys.ocaml_version
                              end
       
     type camlp4_token =
index 2cc9f17edd4e07fd3e213c3d0fb4fda58af93a6c..b6a146310b82183e212cf2a793f0d06a27eb96d1 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.2 2006/11/15 14:49:26 doligez Exp $
+
 
 MAX_SAVE = 10
 
index f58725c7a4a742a85bf2555bd7bd57ca1b8bec2d..0167ceffba2fb7f427962b57d44897d16d8e855c 100644 (file)
@@ -22,7 +22,7 @@ module R =
  *)
     module Id =
       struct let name = "Camlp4OCamlRevisedParser"
-                let version = "$Id$"
+                let version = Sys.ocaml_version
                    end
       
     module Make (Syntax : Sig.Camlp4Syntax) =
@@ -8525,7 +8525,7 @@ module Camlp4QuotationCommon =
  *)
     module Id =
       struct let name = "Camlp4QuotationCommon"
-                let version = "$Id$"
+                let version = Sys.ocaml_version
                    end
       
     module Make
@@ -9224,7 +9224,7 @@ module Q =
  *)
     module Id =
       struct let name = "Camlp4QuotationExpander"
-                let version = "$Id$"
+                let version = Sys.ocaml_version
                    end
       
     module Make (Syntax : Sig.Camlp4Syntax) =
@@ -9263,7 +9263,7 @@ module Rp =
  *)
     module Id : Sig.Id =
       struct let name = "Camlp4OCamlRevisedParserParser"
-                let version = "$Id$"
+                let version = Sys.ocaml_version
                   
       end
       
@@ -10194,7 +10194,7 @@ module G =
  *)
     module Id =
       struct let name = "Camlp4GrammarParser"
-                let version = "$Id$"
+                let version = Sys.ocaml_version
                    end
       
     module Make (Syntax : Sig.Camlp4Syntax) =
@@ -12593,7 +12593,7 @@ module M =
  *)
     module Id =
       struct let name = "Camlp4MacroParser"
-                let version = "$Id$"
+                let version = Sys.ocaml_version
                    end
       
     (*
@@ -13648,7 +13648,7 @@ module D =
  *)
     module Id =
       struct let name = "Camlp4DebugParser"
-                let version = "$Id$"
+                let version = Sys.ocaml_version
                    end
       
     module Make (Syntax : Sig.Camlp4Syntax) =
@@ -13841,7 +13841,7 @@ module L =
  *)
     module Id =
       struct let name = "Camlp4ListComprenhsion"
-                let version = "$Id$"
+                let version = Sys.ocaml_version
                    end
       
     module Make (Syntax : Sig.Camlp4Syntax) =
@@ -14216,7 +14216,7 @@ module B =
  * - Daniel de Rauglaudre: initial version
  * - Nicolas Pouillard: refactoring
  *)
-    (* $Id$ *)
+    
     open Camlp4
       
     open PreCast.Syntax
index b2df6374c15be5b32527e8dd2d1683c10a177dda..bf33c7a0513041df3811dbb2886507d3d662f55a 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.7 2006/06/29 08:12:44 pouillar Exp $
+
 
 include ../config/Makefile.cnf
 
index c741f6aa85fee703af7ad0c6f6c1ccbfb12fccdc..e5853503decd40107708df6071747eb07e5ca501 100644 (file)
@@ -17,7 +17,7 @@
  * - Nicolas Pouillard: rewriting in OCaml
  *)
 
-(* $Id: mkcamlp4.ml,v 1.4 2008/10/03 15:50:09 ertai Exp $ *)
+
 
 open Camlp4;
 open Camlp4_config;
index a2e33ff1a48d6c0328ea50096dbf83fd3cc880c5..a94f69326acc284c55ecb98f80421dcba6970aeb 100644 (file)
@@ -11,7 +11,7 @@
 #                                                                       #
 #########################################################################
 
-# $Id: Makefile.mingw,v 1.27 2008/07/29 08:31:41 xleroy Exp $
+# $Id: Makefile.mingw,v 1.27.2.1 2008/11/09 09:44:24 xleroy Exp $
 
 # Configuration for Windows, Mingw compiler
 
@@ -149,8 +149,7 @@ BNG_ASM_LEVEL=1
 # There must be no spaces or special characters in $(TK_ROOT)
 TK_ROOT=c:/tcl
 TK_DEFS=-I$(TK_ROOT)/include
-TK_LINK=$(TK_ROOT)/bin/tk83.dll $(TK_ROOT)/bin/tcl83.dll -lws2_32
-#TK_LINK=$(TK_ROOT)/lib/tk84.lib $(TK_ROOT)/lib/tcl84.lib -lws2_32
+TK_LINK=$(TK_ROOT)/bin/tk84.dll $(TK_ROOT)/bin/tcl84.dll -lws2_32
 
 ############# Aliases for common commands
 
index bfea63cb9a5375e5d5c2ff5e54db243745e1123f..044f4b7cac3bb879ab2c05fb78bbbfc0b6993b2d 100644 (file)
@@ -11,7 +11,7 @@
 #                                                                       #
 #########################################################################
 
-# $Id: Makefile.msvc,v 1.30 2008/07/29 08:31:41 xleroy Exp $
+# $Id: Makefile.msvc,v 1.30.2.1 2008/11/10 15:24:51 xleroy Exp $
 
 # Configuration for Windows, Visual C++ compiler
 
@@ -150,13 +150,12 @@ TK_ROOT=c:/tcl
 TK_DEFS=-I$(TK_ROOT)/include
 # The following definition avoids hard-wiring $(TK_ROOT) in the libraries
 # produced by OCaml, and is therefore required for binary distribution
-# of these libraries.  However, $(TK_ROOT) must be added to the LIB
+# of these libraries.  However, $(TK_ROOT)/lib must be added to the LIB
 # environment variable, as described in README.win32.
-#TK_LINK=tk84.lib tcl84.lib ws2_32.lib
-TK_LINK=tk83.lib tcl83.lib ws2_32.lib
+TK_LINK=tk84.lib tcl84.lib ws2_32.lib
 # An alternative definition that avoids mucking with the LIB variable,
 # but hard-wires the Tcl/Tk location in the binaries
-# TK_LINK=$(TK_ROOT)/tk83.lib $(TK_ROOT)/tcl83.lib ws2_32.lib
+# TK_LINK=$(TK_ROOT)/tk84.lib $(TK_ROOT)/tcl84.lib ws2_32.lib
 
 ############# Aliases for common commands
 
index 748f1cefcdd6ac0ef8ebf4e5979374b35e56a444..503f555652b198df5254f9912f76df252f4fe135 100755 (executable)
--- a/configure
+++ b/configure
@@ -13,7 +13,7 @@
 #                                                                       #
 #########################################################################
 
-# $Id: configure,v 1.266 2008/10/06 13:31:47 doligez Exp $
+# $Id: configure,v 1.266.2.1 2008/11/07 10:34:16 xleroy Exp $
 
 configure_options="$*"
 prefix=/usr/local
@@ -260,8 +260,10 @@ case "$bytecc,$host" in
     bytecccompopts="-fno-defer-pop -no-cpp-precomp $gcc_warnings"
     mathlib=""
     # Tell gcc that we can use 32-bit code addresses for threaded code
-    # even if we compile in 64-bit mode
-    echo "#define ARCH_CODE32" >> m.h;;
+    # unless we are compiled for a shared library (-fPIC option)
+    echo "#ifndef __PIC__" >> m.h
+    echo "#  define ARCH_CODE32" >> m.h
+    echo "#endif" >> m.h;;
   *,*-*-beos*)
     bytecccompopts="-fno-defer-pop $gcc_warnings"
     # No -lm library
@@ -566,20 +568,13 @@ if test $withsharedlibs = "yes"; then
       mksharedlibrpath="-rpath "
       shared_libraries_supported=true;;
     i[3456]86-*-darwin*)
-      dyld=ld
-      if test -f /usr/bin/ld_classic; then
-        # The new linker in Mac OS X 10.5 does not support read_only_relocs
-        # dyld=/usr/bin/ld_classic  XXX FIXME incompatible with X11 libs
-        :
-      fi
-      mksharedlib="$dyld -bundle -flat_namespace -undefined suppress -read_only_relocs suppress"
+      mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress -read_only_relocs suppress"
       bytecccompopts="$dl_defs $bytecccompopts"
       dl_needs_underscore=false
       shared_libraries_supported=true;;
     *-apple-darwin*)
       mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress"
       bytecccompopts="$dl_defs $bytecccompopts"
-      #sharedcccompopts="-fnocommon"
       dl_needs_underscore=false
       shared_libraries_supported=true;;
     m88k-*-openbsd*)
@@ -625,7 +620,11 @@ case "$host" in
   i[3456]86-*-solaris*)         arch=i386; system=solaris;;
   i[3456]86-*-beos*)            arch=i386; system=beos;;
   i[3456]86-*-cygwin*)          arch=i386; system=cygwin;;
-  i[3456]86-*-darwin*)          arch=i386; system=macosx;;
+  i[3456]86-*-darwin*)          if $arch64; then
+                                  arch=amd64; system=macosx
+                                else
+                                  arch=i386; system=macosx
+                                fi;;
   i[3456]86-*-gnu*)             arch=i386; system=gnu;;
   mips-*-irix6*)                arch=mips; system=irix;;
   hppa1.1-*-hpux*)              arch=hppa; system=hpux;;
@@ -647,6 +646,7 @@ case "$host" in
   x86_64-*-freebsd*)            arch=amd64; system=freebsd;;
   x86_64-*-netbsd*)             arch=amd64; system=netbsd;;
   x86_64-*-openbsd*)            arch=amd64; system=openbsd;;
+  x86_64-*-darwin9.5)           arch=amd64; system=macosx;;
 esac
 
 # Some platforms exist both in 32-bit and 64-bit variants, not distinguished
@@ -685,6 +685,7 @@ case "$arch,$nativecc,$system,$host_type" in
   *,*,rhapsody,*)      nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6 $dl_defs"
                        if $arch64; then partialld="ld -r -arch ppc64"; fi;;
   *,gcc*,cygwin,*)     nativecccompopts="$gcc_warnings -U_WIN32";;
+  amd64,gcc*,macosx,*) partialld="ld -r -arch x86_64";;
   *,gcc*,*,*)          nativecccompopts="$gcc_warnings";;
 esac
 
@@ -696,6 +697,8 @@ case "$arch,$model,$system" in
                     asppprofflags='-pg -DPROFILING';;
   alpha,*,*)        as='as'
                     aspp='gcc -c';;
+  amd64,*,macosx)   as='as -arch x86_64'
+                    aspp='gcc -arch x86_64 -c';;
   amd64,*,*)        as='as'
                     aspp='gcc -c';;
   arm,*,*)          as='as';
@@ -734,6 +737,7 @@ case "$arch,$model,$system" in
   i386,*,linux_elf) profiling='prof';;
   i386,*,gnu) profiling='prof';;
   i386,*,bsd_elf) profiling='prof';;
+  amd64,*,macosx) profiling='prof';;
   i386,*,macosx) profiling='prof';;
   sparc,*,solaris)
     profiling='prof'
@@ -1092,27 +1096,27 @@ fi
 # Determine if system stack overflows can be detected
 
 case "$arch,$system" in
-  i386,linux_elf|amd64,linux|power,rhapsody|i386,macosx)
+  i386,linux_elf|amd64,linux|power,rhapsody|amd64,macosx|i386,macosx|amd64,macosx)
     echo "System stack overflow can be detected."
     echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;;
   *)
     echo "Cannot detect system stack overflow.";;
 esac
 
-# Determine the target architecture for the "num" library
-
-case "$host" in
-  alpha*-*-*)    bng_arch=alpha; bng_asm_level=1;;
-  i[3456]86-*-*) bng_arch=ia32
-                 if sh ./trycompile ia32sse2.c
-                 then bng_asm_level=2
-                 else bng_asm_level=1
-                 fi;;
-  mips-*-*)      bng_arch=mips; bng_asm_level=1;;
-  powerpc-*-*)   bng_arch=ppc; bng_asm_level=1;;
-  sparc*-*-*)    bng_arch=sparc; bng_asm_level=1;;
-  x86_64-*-*)    bng_arch=amd64; bng_asm_level=1;;
-  *)             bng_arch=generic; bng_asm_level=0;;
+x# Determine the target architecture for the "num" library
+
+case "$arch" in
+  alpha)    bng_arch=alpha; bng_asm_level=1;;
+  i386)     bng_arch=ia32
+            if sh ./trycompile ia32sse2.c
+            then bng_asm_level=2
+            else bng_asm_level=1
+            fi;;
+  mips)     bng_arch=mips; bng_asm_level=1;;
+  power   bng_arch=ppc; bng_asm_level=1;;
+  sparc)    bng_arch=sparc; bng_asm_level=1;;
+  amd64)    bng_arch=amd64; bng_asm_level=1;;
+  *)        bng_arch=generic; bng_asm_level=0;;
 esac
 
 echo "BNG_ARCH=$bng_arch" >> Makefile
index 096350b9f56d4258b692d9e25d89ce50c563f496..c502c109a3071fc409af26512659f26427e56d55 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: optcompile.ml,v 1.56.2.1 2008/10/08 13:07:13 doligez Exp $ *)
+(* $Id: optcompile.ml,v 1.56.2.2 2008/10/17 14:01:35 doligez Exp $ *)
 
 (* The batch compiler *)
 
@@ -134,11 +134,13 @@ let implementation ppf sourcefile outputprefix =
       Compilenv.save_unit_info cmxfile;
     end;
     Warnings.check_fatal ();
-    Pparse.remove_preprocessed inputfile
+    Pparse.remove_preprocessed inputfile;
+    Stypes.dump (outputprefix ^ ".annot");
   with x ->
     remove_file objfile;
     remove_file cmxfile;
     Pparse.remove_preprocessed_if_ast inputfile;
+    Stypes.dump (outputprefix ^ ".annot");
     raise x
 
 let c_file name =
index 18ec3c33d828838298a2439479d2a8ede916c451..1f3c8f3a1ef4ca4b24d483672e0d9560f8b0d439 100644 (file)
@@ -10,7 +10,7 @@
 ;(*                                                                     *)
 ;(***********************************************************************)
 
-;(* $Id: caml.el,v 1.44 2008/08/19 12:54:51 doligez Exp $ *)
+;(* $Id: caml.el,v 1.44.2.1 2008/10/29 12:30:57 doligez Exp $ *)
 
 ;;; caml.el --- O'Caml code editing commands for Emacs
 
@@ -791,7 +791,7 @@ variable caml-mode-indentation."
 ;; Hence we add a regexp.
 
 (defconst caml-error-regexp
-  "^[A-\377]+ \"\\([^\"\n]+\\)\", [A-\377]+ \\([0-9]+\\)[-,:]"
+  "^[ A-\377]+ \"\\([^\"\n]+\\)\", [A-\377]+ \\([0-9]+\\)[-,:]"
   "Regular expression matching the error messages produced by camlc.")
 
 (if (boundp 'compilation-error-regexp-alist)
@@ -804,7 +804,7 @@ variable caml-mode-indentation."
 ;; A regexp to extract the range info
 
 (defconst caml-error-chars-regexp
-  ".*, .*, [A-\377]+ \\([0-9]+\\)-\\([0-9]+\\):"
+  ".*, .*, [A-\377]+ \\([0-9]+\\)-\\([0-9]+\\):?"
   "Regular expression extracting the character numbers
 from an error message produced by camlc.")
 
@@ -816,7 +816,7 @@ from an error message produced by camlc.")
 (defun caml-string-to-int (x)
   (if (fboundp 'string-to-number) (string-to-number x) (string-to-int x)))
 
-;;itz 04-21-96 somebody didn't get the documetation for next-error
+;;itz 04-21-96 somebody didn't get the documentation for next-error
 ;;right. When the optional argument is a number n, it should move
 ;;forward n errors, not reparse.
 
index 0ce1e8d88d70df4cee53fa569c3110a22b72626b..a7fae5d38c8a03f05a3cfb40b297482cff52a299 100644 (file)
@@ -1,4 +1,4 @@
-\" $Id: ocamlc.m,v 1.12 2008/09/15 14:12:56 doligez Exp $
+\" $Id: ocamlc.m,v 1.12.2.1 2008/10/29 12:38:52 doligez Exp $
 
 .TH OCAMLC 1
 
@@ -421,8 +421,8 @@ as a preprocessor for each source file. The output of
 is redirected to
 an intermediate file, which is compiled. If there are no compilation
 errors, the intermediate file is deleted afterwards. The name of this
-file is built from the basename of the source file with the extension
-.ppi for an interface (.mli) file and .ppo for an implementation
+file is built from the basename of the source file with the extension .ppi
+for an interface (.mli) file and .ppo for an implementation
 (.ml) file.
 .TP
 .B \-principal
@@ -561,7 +561,7 @@ into errors.  The compiler will stop with an error when one of these
 warnings is emitted.  The
 .I warning\-list
 has the same meaning as for
-the "-w" option: an uppercase character turns the corresponding
+the "\-w" option: an uppercase character turns the corresponding
 warning into an error, a lowercase character leaves it as a warning.
 The default setting is
 .B \-warn\-error\ a
index 3872bd8710e9c1cec82e4ee8654b8c2d7a2ea071..cdebf3d161720979cf3eefed8e484d0e3239fbfa 100644 (file)
@@ -1,4 +1,4 @@
-\" $Id: ocamlopt.m,v 1.10 2008/09/15 14:12:56 doligez Exp $
+\" $Id: ocamlopt.m,v 1.10.2.1 2008/10/29 12:38:52 doligez Exp $
 .TH OCAMLOPT 1
 
 .SH NAME
@@ -222,7 +222,7 @@ and edit that file to remove all declarations of unexported names.
 Add the given directory to the list of directories searched for
 compiled interface files (.cmi) and compiled object code files
 (.cmo). By default, the current directory is searched first, then the
-standard library directory. Directories added with -I are searched
+standard library directory. Directories added with \-I are searched
 after the current directory, in the order in which they were given on
 the command line, but before the standard library directory.
 
@@ -536,7 +536,7 @@ into errors.  The compiler will stop with an error when one of these
 warnings is emitted.  The
 .I warning\-list
 has the same meaning as for
-the "-w" option: an uppercase character turns the corresponding
+the "\-w" option: an uppercase character turns the corresponding
 warning into an error, a lowercase character leaves it as a warning.
 The default setting is
 .B \-warn\-error\ a
@@ -577,7 +577,7 @@ trigonometric operations
 .BR cos ,
 .BR sin ,
 .B tan
-have their range reduced to [-2^64, 2^64].
+have their range reduced to [\-2^64, 2^64].
 
 .SH OPTIONS FOR THE AMD64 ARCHITECTURE
 
index 1b51e3abfaaa8ec297340531c46c5c36076cd223..a4c52de45d2e5b2073028324f07326893817740e 100644 (file)
@@ -1,4 +1,4 @@
-\" $Id: ocamlrun.m,v 1.6 2008/09/15 14:12:56 doligez Exp $
+\" $Id: ocamlrun.m,v 1.6.2.1 2008/11/18 10:41:17 doligez Exp $
 .TH OCAMLRUN 1
 
 .SH NAME
@@ -104,18 +104,24 @@ record documented in
 .IR "The Objective Caml user's manual",
 chapter "Standard Library", section "Gc".
 .TP
-.BR b
+.B b
 Trigger the printing of a stack backtrace
 when an uncaught exception aborts the program.
 This option takes no argument.
 .TP
-.BR p
+.B p
 Turn on debugging support for
 .BR ocamlyacc -generated
 parsers.  When this option is on,
 the pushdown automaton that executes the parsers prints a
 trace of its actions.  This option takes no argument.
 .TP
+.BR a \ (allocation_policy)
+The policy used for allocating in the OCaml heap.  Possible values
+are 0 for the next-fit policy, and 1 for the first-fit
+policy.  Next-fit is somewhat faster, but first-fit is better for
+avoiding fragmentation and the associated heap compactions.
+.TP
 .BR s \ (minor_heap_size)
 The size of the minor heap (in words).
 .TP
index 6050eb69b3437f29ebadb179fc2c237d5ef72d76..2c9479527cd5d1865ce86afd05cad65649af56bd 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: myocamlbuild.ml,v 1.23 2008/10/03 15:41:25 ertai Exp $ *)
+(* $Id: myocamlbuild.ml,v 1.23.2.2 2008/10/23 15:29:11 ertai Exp $ *)
 
 open Ocamlbuild_plugin
 open Command
@@ -110,21 +110,21 @@ let full_ocamlrun = P((Sys.getcwd ()) / "boot/ocamlrun")
 
 let boot_ocamlc = S[ocamlrun; A"boot/ocamlc"; A"-I"; A"boot"; A"-nostdlib"]
 
-let partial = bool_of_string (getenv ~default:"false" "OCAMLBUILD_PARTIAL");;
+let mixed = Pathname.exists "build/ocamlbuild_mixed_mode";;
 
-let if_partial_dir dir =
-  if partial then ".."/dir else dir;;
+let if_mixed_dir dir =
+  if mixed then ".."/dir else dir;;
 
 let unix_dir =
   match Sys.os_type with
-  | "Win32" -> if_partial_dir "otherlibs/win32unix"
-  | _       -> if_partial_dir "otherlibs/unix";;
+  | "Win32" -> if_mixed_dir "otherlibs/win32unix"
+  | _       -> if_mixed_dir "otherlibs/unix";;
 
-let threads_dir    = if_partial_dir "otherlibs/threads";;
-let systhreads_dir = if_partial_dir "otherlibs/systhreads";;
-let dynlink_dir    = if_partial_dir "otherlibs/dynlink";;
-let str_dir        = if_partial_dir "otherlibs/str";;
-let toplevel_dir   = if_partial_dir "toplevel";;
+let threads_dir    = if_mixed_dir "otherlibs/threads";;
+let systhreads_dir = if_mixed_dir "otherlibs/systhreads";;
+let dynlink_dir    = if_mixed_dir "otherlibs/dynlink";;
+let str_dir        = if_mixed_dir "otherlibs/str";;
+let toplevel_dir   = if_mixed_dir "toplevel";;
 
 let ocamlc_solver =
   let native_deps = ["ocamlc.opt"; "stdlib/stdlib.cmxa";
@@ -156,7 +156,7 @@ let ar = A"ar";;
 
 dispatch begin function
 | Before_hygiene ->
-    if partial then
+    if mixed then
       let patt = String.concat ","
         ["asmcomp"; "bytecomp"; "debugger"; "driver";
          "lex"; "ocamldoc"; "otherlibs"; "parsing"; "stdlib"; "tools";
@@ -364,8 +364,8 @@ let import_stdlib_contents build exts =
   List.iter Outcome.ignore_good res
 ;;
 
-rule "byte stdlib in partial mode"
-  ~stamp:"byte_stdlib_partial_mode"
+rule "byte stdlib in mixed mode"
+  ~stamp:"byte_stdlib_mixed_mode"
   ~deps:["stdlib/stdlib.mllib"; "stdlib/stdlib.cma";
          "stdlib/std_exit.cmo"; "stdlib/libcamlrun"-.-C.a;
          "stdlib/camlheader"; "stdlib/camlheader_ur"]
@@ -378,8 +378,8 @@ rule "byte stdlib in partial mode"
     Nop
   end;;
 
-rule "native stdlib in partial mode"
-  ~stamp:"native_stdlib_partial_mode"
+rule "native stdlib in mixed mode"
+  ~stamp:"native_stdlib_mixed_mode"
   ~deps:["stdlib/stdlib.mllib"; "stdlib/stdlib.cmxa";
          "stdlib/stdlib"-.-C.a; "stdlib/std_exit.cmx";
          "stdlib/std_exit"-.-C.o; "stdlib/libasmrun"-.-C.a;
@@ -785,7 +785,7 @@ let mk_camlp4_bin name ?unix:(link_unix=true) modules =
     then A"unix.cma", A"unix.cmxa", S[A"-I"; P unix_dir]
     else N,N,N in
   let dep_unix_byte, dep_unix_native =
-    if link_unix && not partial
+    if link_unix && not mixed
     then [unix_dir/"unix.cma"],
          [unix_dir/"unix.cmxa"; unix_dir/"unix"-.-C.a]
     else [],[] in
@@ -793,15 +793,19 @@ let mk_camlp4_bin name ?unix:(link_unix=true) modules =
   let cmos = add_extensions ["cmo"] deps in
   let cmxs = add_extensions ["cmx"] deps in
   let objs = add_extensions [C.o] deps in
-  let dep_dynlink_native =
-    if partial then [] else [dynlink_dir/"dynlink.cmxa"; dynlink_dir/"dynlink"-.-C.a]
+  let dep_dynlink_byte, dep_dynlink_native =
+    if mixed
+    then [], []
+    else [dynlink_dir/"dynlink.cma"],
+         [dynlink_dir/"dynlink.cmxa"; dynlink_dir/"dynlink"-.-C.a]
   in
   rule byte
-    ~deps:(camlp4lib_cma::cmos @ dep_unix_byte)
+    ~deps:(camlp4lib_cma::cmos @ dep_unix_byte @ dep_dynlink_byte)
     ~prod:(add_exe byte)
     ~insert:(`before "ocaml: cmo* -> byte")
     begin fun _ _ ->
-      Cmd(S[ocamlc; include_unix; unix_cma; T(tags_of_pathname byte++"ocaml"++"link"++"byte");
+      Cmd(S[ocamlc; A"-I"; P dynlink_dir; A "dynlink.cma"; include_unix; unix_cma;
+            T(tags_of_pathname byte++"ocaml"++"link"++"byte");
             P camlp4lib_cma; A"-linkall"; atomize cmos; A"-o"; Px (add_exe byte)])
     end;
   rule native
@@ -809,7 +813,8 @@ let mk_camlp4_bin name ?unix:(link_unix=true) modules =
     ~prod:(add_exe native)
     ~insert:(`before "ocaml: cmx* & o* -> native")
     begin fun _ _ ->
-      Cmd(S[ocamlopt; A"-I"; P dynlink_dir; A "dynlink.cmxa"; include_unix; unix_cmxa; T(tags_of_pathname native++"ocaml"++"link"++"native");
+      Cmd(S[ocamlopt; A"-I"; P dynlink_dir; A "dynlink.cmxa"; include_unix; unix_cmxa;
+            T(tags_of_pathname native++"ocaml"++"link"++"native");
             P camlp4lib_cmxa; A"-linkall"; atomize cmxs; A"-o"; Px (add_exe native)])
     end;;
 
index 7d638b1dfa4d5e041089df7e8dc789d71cb2e011..326ab16b34b2cf27630ef18dc99bac017e3cf191 100644 (file)
@@ -9,7 +9,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: display.ml,v 1.3 2008/01/11 16:13:16 doligez Exp $ *)
+(* $Id: display.ml,v 1.3.4.1 2008/11/06 15:40:39 ertai Exp $ *)
 (* Original author: Berke Durak *)
 (* Display *)
 open My_std;;
@@ -61,7 +61,7 @@ type display_line =
 
 type display = {
           di_log_level    : int;
-          di_log_channel  : (Format.formatter * out_channel) option;
+  mutable di_log_channel  : (Format.formatter * out_channel) option;
           di_channel      : out_channel;
           di_formatter    : Format.formatter;
           di_display_line : display_line;
@@ -274,7 +274,8 @@ let finish ?(how=`Success) di =
     call_if di.di_log_channel
       begin fun (fmt, oc) ->
         Format.fprintf fmt "# Compilation %ssuccessful.@." (if how = `Error then "un" else "");
-        close_out oc
+        close_out oc;
+        di.di_log_channel <- None
       end;
     match di.di_display_line with
     | Classic -> ()
index 71ca30e289f2252f02def8e4d018ae6b93f675e1..38dc396fc3a8a04a616ac6699dd439e683d827ad 100644 (file)
@@ -9,7 +9,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: main.ml,v 1.21 2008/01/11 16:13:16 doligez Exp $ *)
+(* $Id: main.ml,v 1.21.4.1 2008/11/06 15:40:39 ertai Exp $ *)
 (* Original author: Berke Durak *)
 open My_std
 open Log
@@ -24,6 +24,7 @@ exception Exit_build_error of string
 exception Exit_silently
 
 let clean () =
+  Log.finish ();
   Shell.rm_rf !Options.build_dir;
   if !Options.make_links then begin
     let entry =
index d2ad68dd691b2dfd529be08c5be0c3ebe98c2d96..d90850102267e77a5947d2ea846f196e28023880 100644 (file)
@@ -9,7 +9,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: ocaml_specific.ml,v 1.23 2008/08/05 13:06:56 ertai Exp $ *)
+(* $Id: ocaml_specific.ml,v 1.23.2.1 2008/10/22 11:23:57 ertai Exp $ *)
 (* Original author: Nicolas Pouillard *)
 open My_std
 open Format
@@ -404,6 +404,7 @@ flag ["ocaml"; "debug"; "pack"; "native"] (A "-g");;
 flag ["ocaml"; "link"; "native"; "output_obj"] (A"-output-obj");;
 flag ["ocaml"; "link"; "byte"; "output_obj"] (A"-output-obj");;
 flag ["ocaml"; "dtypes"; "compile"] (A "-dtypes");;
+flag ["ocaml"; "annot"; "compile"] (A "-annot");;
 flag ["ocaml"; "rectypes"; "compile"] (A "-rectypes");;
 flag ["ocaml"; "rectypes"; "infer_interface"] (A "-rectypes");;
 flag ["ocaml"; "linkall"; "link"] (A "-linkall");;
index d0ded9ec2402ba16bd3a41e523f70021a153dbff..043a6fcaaad9666403b0238adde3154364148ab8 100644 (file)
@@ -9,7 +9,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: plugin.ml,v 1.4 2008/01/11 16:13:16 doligez Exp $ *)
+(* $Id: plugin.ml,v 1.4.4.1 2008/11/06 15:40:39 ertai Exp $ *)
 (* Original author: Nicolas Pouillard *)
 open My_std
 open Format
@@ -98,6 +98,7 @@ module Make(U:sig end) =
           if not !Options.just_plugin then
             let spec = S[!Options.ocamlrun; P(!Options.build_dir/plugin);
                          A"-no-plugin"; atomize (List.tl (Array.to_list Sys.argv))] in
+            let () = Log.finish () in
             raise (Exit_silently_with_code (sys_command (Command.string_of_command_spec spec)))
         end
       else
index aafd132c1c7e0b122cc8d9e85a446bd2270b9bb6..21294cb0a0cbb056f9f1fc95e37e9ffce73d2d90 100644 (file)
@@ -9,7 +9,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: odoc_html.ml,v 1.64 2008/07/23 08:55:36 guesdon Exp $ *)
+(* $Id: odoc_html.ml,v 1.64.2.1 2008/11/10 13:03:55 guesdon Exp $ *)
 
 (** Generation of html documentation.*)
 
@@ -275,7 +275,7 @@ class virtual text =
               None
             else
               match s.[n] with
-              |        '\n' -> iter_first (n+1)
+              | '\n' -> iter_first (n+1)
               | _ -> Some n
           in
           match iter_first 0 with
index a550118cede3466bdc4504c5a936fc99bab574da..2e495b184eb9b7094d5b3956045fffa95828b5b2 100644 (file)
@@ -9,7 +9,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: odoc_man.ml,v 1.28 2008/07/23 08:55:36 guesdon Exp $ *)
+(* $Id: odoc_man.ml,v 1.28.2.1 2008/10/29 11:58:35 guesdon Exp $ *)
 
 (** The man pages generator. *)
 open Odoc_info
@@ -204,6 +204,8 @@ class man =
         match s.[i] with
           '\\' -> Buffer.add_string b "\\(rs"
         | '.' -> Buffer.add_string b "\\&."
+        | '\'' -> Buffer.add_string b "\\&'"
+        | '-' -> Buffer.add_string b "\\-"
         | c -> Buffer.add_char b c
       done;
       Buffer.contents b
@@ -633,15 +635,15 @@ class man =
 
     (** Print groff string for a module comment.*)
     method man_of_module_comment b text =
-      bs b "\n.pp\n";
+      bs b "\n.PP\n";
       self#man_of_text b [Code ("=== "^(Odoc_misc.string_of_text text)^" ===")];
-      bs b "\n.pp\n"
+      bs b "\n.PP\n"
 
     (** Print groff string for a class comment.*)
     method man_of_class_comment b text =
-      bs b "\n.pp\n";
+      bs b "\n.PP\n";
       self#man_of_text b [Code ("=== "^(Odoc_misc.string_of_text text)^" ===")];
-      bs b "\n.pp\n"
+      bs b "\n.PP\n"
 
     (** Print groff string for an included module. *)
     method man_of_included_module b m_name im =
index 05cda08afc8dbf2e6fea222bc561ed29bae7931b..e7c5c77ca58bc5553145fbdc8e1ed8a2acdbf2e3 100644 (file)
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: odoc_ocamlhtml.mll,v 1.10 2008/01/11 16:13:16 doligez Exp $ *)
+(* $Id: odoc_ocamlhtml.mll,v 1.10.4.1 2008/11/10 13:03:55 guesdon Exp $ *)
 
 (** Generation of html code to display OCaml code. *)
 open Lexing
@@ -202,7 +202,7 @@ let reset_string_buffer () = Buffer.reset string_buffer
 let store_string_char = Buffer.add_char string_buffer
 let get_stored_string () =
   let s = Buffer.contents string_buffer in
-  String.escaped s
+  s
 
 (** To translate escape sequences *)
 
@@ -219,6 +219,11 @@ let char_for_decimal_code lexbuf i =
                 (Char.code(Lexing.lexeme_char lexbuf (i+2)) - 48) in
   Char.chr(c land 0xFF)
 
+let char_for_hexa_code lexbuf i =
+  let c = 16 * (Char.code(Lexing.lexeme_char lexbuf i) - 48) +
+                (Char.code(Lexing.lexeme_char lexbuf (i+1)) - 48) in
+  Char.chr(c land 0xFF)
+
 (** To store the position of the beginning of a string and comment *)
 let string_start_pos = ref 0;;
 let comment_start_pos = ref [];;
@@ -426,6 +431,7 @@ and comment = parse
             comment_start_pos := l;
             comment lexbuf;
        }
+(* These filters are useless
   | "\""
       { reset_string_buffer();
         string_start_pos := Lexing.lexeme_start lexbuf;
@@ -437,11 +443,6 @@ and comment = parse
           raise (Error (Unterminated_string_in_comment, st, st + 2))
         end;
         comment lexbuf }
-  | "''"
-      {
-        store_comment_char '\'';
-        store_comment_char '\'';
-        comment lexbuf }
   | "'" [^ '\\' '\''] "'"
       {
         store_comment_char '\'';
@@ -455,13 +456,20 @@ and comment = parse
         store_comment_char(char_for_backslash(Lexing.lexeme_char lexbuf 1)) ;
         store_comment_char '\'';
         comment lexbuf }
-  | "'\\" ['0'-'9'] ['0'-'9'] ['0'-'9'] "'"
+  | "\\" ['0'-'9'] ['0'-'9'] ['0'-'9']
       {
-        store_comment_char '\'';
-        store_comment_char '\\';
         store_comment_char(char_for_decimal_code lexbuf 1);
+        comment lexbuf }
+  | "\\x" ['0'-'9' 'A'-'Z' 'a'-'z' ] ['0'-'9' 'A'-'Z' 'a'-'z']
+      {
+        store_comment_char(char_for_hexa_code lexbuf 2);
+        string lexbuf }
+  | "''"
+      {
+        store_comment_char '\'';
         store_comment_char '\'';
         comment lexbuf }
+*)
   | eof
       { let st = List.hd !comment_start_pos in
         raise (Error (Unterminated_comment, st, st + 2));
@@ -475,11 +483,16 @@ and string = parse
       { () }
   | '\\' ("\010" | "\013" | "\013\010") [' ' '\009'] *
       { string lexbuf }
-  | '\\' ['\\' '"' 'n' 't' 'b' 'r']
-      { store_string_char(char_for_backslash(Lexing.lexeme_char lexbuf 1));
+  | '\\' ['\\' '"' 'n' 't' 'b' 'r' ]
+      { Buffer.add_string string_buffer (Lexing.lexeme lexbuf) ;
         string lexbuf }
   | '\\' ['0'-'9'] ['0'-'9'] ['0'-'9']
-      { store_string_char(char_for_decimal_code lexbuf 1);
+      {
+        Buffer.add_string string_buffer (Lexing.lexeme lexbuf) ;
+        string lexbuf
+      }
+  | '\\' 'x' ['0'-'9' 'A'-'Z' 'a'-'z' ] ['0'-'9' 'A'-'Z' 'a'-'z']
+      {  Buffer.add_string string_buffer (Lexing.lexeme lexbuf) ;
          string lexbuf }
   | eof
       { raise (Error (Unterminated_string,
index 3fd80cf8cd5d86e4940b70ba956fd1b313a9a8e9..7fc10e6328a85cc1dd4255c2e37378d0637ddc95 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: bigarray.h,v 1.9 2006/01/27 14:33:42 doligez Exp $ */
+/* $Id: bigarray.h,v 1.9.14.1 2008/11/09 09:03:50 xleroy Exp $ */
 
 #ifndef CAML_BIGARRAY_H
 #define CAML_BIGARRAY_H
@@ -90,5 +90,6 @@ CAMLBAextern value
     caml_ba_alloc(int flags, int num_dims, void * data, intnat * dim);
 CAMLBAextern value caml_ba_alloc_dims(int flags, int num_dims, void * data,
                                  ... /*dimensions, with type intnat */);
+CAMLBAextern uintnat caml_ba_byte_size(struct caml_ba_array * b);
 
 #endif
index 3ec5063705105789d664b7b1bbf0553b14918c45..d1d19d9ba7c00bc6f68fc6453a279675c741e169 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: bigarray_stubs.c,v 1.23 2008/01/04 09:52:27 xleroy Exp $ */
+/* $Id: bigarray_stubs.c,v 1.23.4.1 2008/11/09 09:03:51 xleroy Exp $ */
 
 #include <stddef.h>
 #include <stdarg.h>
@@ -56,7 +56,7 @@ int caml_ba_element_size[] =
 
 /* Compute the number of bytes for the elements of a big array */
 
-uintnat caml_ba_byte_size(struct caml_ba_array * b)
+CAMLexport uintnat caml_ba_byte_size(struct caml_ba_array * b)
 {
   return caml_ba_num_elts(b)
          * caml_ba_element_size[b->flags & CAML_BA_KIND_MASK];
index 12550fe8cb0d2ed1462c092919064bf82fe8fbcb..df1e92ac20dd54ca94e9f20d63a97fbf970aa306 100644 (file)
@@ -2,15 +2,16 @@ OTHERSLIB=-I $(OTHERS)/win32unix -I $(OTHERS)/str -I $(OTHERS)/systhreads
 
 CCFLAGS=-I../../../byterun $(TK_DEFS)
 
+include Makefile.shared
+
 ifeq ($(CCOMPTYPE),cc)
-WINDOWS_APP=-ccopt "-Wl,--subsystem,windows"
+WINDOWS_APP=-ccopt "-link -Wl,--subsystem,windows"
 else
-WINDOWS_APP=-ccopt "/link /subsystem:windows"
+WINDOWS_APP=-ccopt "-link /subsystem:windows"
 endif
 
-OCAMLBR=threads.cma winmain.$(O) $(WINDOWS_APP)
-
-include Makefile.shared
+XTRAOBJ=winmain.$(O)
+XTRALIBS=threads.cma -custom $(WINDOWS_APP)
 
 dummy.mli:
        cp dummyWin.mli dummy.mli
index c5080b7cf1148d6095b747a682c619c1350d81ec..e25a2a9ddeef188615aec082dc88f2b9dcf45ffd 100644 (file)
@@ -30,10 +30,11 @@ JG =        jg_tk.cmo       jg_config.cmo   jg_bind.cmo      jg_completion.cmo \
 all: ocamlbrowser$(EXE)
 
 ocamlbrowser$(EXE): $(TOPDIR)/toplevel/toplevellib.cma jglib.cma $(OBJ) \
-                       ../support/lib$(LIBNAME).$(A)
+                       ../support/lib$(LIBNAME).$(A) $(XTRAOBJ)
        $(CAMLC) -o ocamlbrowser$(EXE) $(INCLUDES) \
                $(TOPDIR)/toplevel/toplevellib.cma \
-               unix.cma str.cma $(OCAMLBR) $(LIBNAME).cma jglib.cma $(OBJ) 
+               unix.cma str.cma $(XTRALIBS) $(LIBNAME).cma jglib.cma \
+                $(OBJ) $(XTRAOBJ)
 
 ocamlbrowser.cma: jglib.cma $(OBJ)
        $(CAMLC) -a -o $@ -linkall jglib.cma $(OBJ)
index b647fb79b7ca4589c366a9b72502a593e506cbb8..2eb32e67f77847ecd5bda1d704ddb622d5d89314 100644 (file)
@@ -3,16 +3,22 @@
 #include <callback.h>
 #include <sys.h>
 
-CAMLextern int __argc;
-CAMLextern char **__argv;
-CAMLextern void caml_expand_command_line(int * argcp, char *** argvp);
+/*CAMLextern int __argc; */
+/* CAMLextern char **__argv; */
+/* CAMLextern void caml_expand_command_line(int * argcp, char *** argvp); */
 /* extern void caml_main (char **); */
 
 int WINAPI WinMain(HINSTANCE h, HINSTANCE HPrevInstance,
                    LPSTR lpCmdLine, int nCmdShow)
 {
-  caml_expand_command_line(&__argc, &__argv);
-  caml_main(__argv);
+  char exe_name[1024];
+  char * argv[2];
+
+  GetModuleFileName(NULL, exe_name, sizeof(exe_name) - 1);
+  exe_name[sizeof(exe_name) - 1] = '0';
+  argv[0] = exe_name;
+  argv[1] = NULL;
+  caml_main(argv);
   sys_exit(Val_int(0));
   return 0;
 }
index f30c898ba9495df185b46d0b3c674ff54d26aeaa..d3926204a380997dc7fd5a72be3136b2166af602 100644 (file)
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/
 
-/* $Id: select.c,v 1.14 2008/07/31 12:09:18 xleroy Exp $ */
+/* $Id: select.c,v 1.14.2.1 2008/10/29 13:38:56 xleroy Exp $ */
 
 #include <mlvalues.h>
 #include <alloc.h>
@@ -771,6 +771,9 @@ CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value
   /* Time to wait */
   DWORD milliseconds;
 
+  /* Is there static select data */
+  BOOL  hasStaticData = FALSE;
+
   /* Wait return */
   DWORD waitRet;
 
@@ -797,6 +800,7 @@ CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value
   iterSelectData = NULL;
   iterResult     = NULL;
   err            = 0;
+  hasStaticData  = 0;
   waitRet        = 0;
   readfds_len    = caml_list_length(readfds);
   writefds_len   = caml_list_length(writefds);
@@ -892,6 +896,16 @@ CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value
   iterSelectData = lpSelectData;
   while (iterSelectData != NULL)
   {
+    /* Check if it is static data. If this is the case, launch everything
+     * but don't wait for events. It helps to test if there are events on
+     * any other fd (which are not static), knowing that there is at least
+     * one result (the static data).
+     */
+    if (iterSelectData->EType == SELECT_TYPE_STATIC)
+    {
+      hasStaticData = TRUE;
+    };
+
     /* Execute APC */
     if (iterSelectData->funcWorker != NULL)
     {
@@ -914,7 +928,7 @@ CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value
   if (nEventsCount > 0)
   {
     /* Waiting for event */
-    if (err == 0)
+    if (err == 0 && !hasStaticData)
     {
       DBUG_PRINT("Waiting for one select worker to be done");
       switch (WaitForMultipleObjects(nEventsCount, lpEventsDone, FALSE, milliseconds))
@@ -958,7 +972,7 @@ CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value
     }
   }
   /* Nothing to monitor but some time to wait. */
-  else 
+  else if (!hasStaticData)
   {
     Sleep(milliseconds);
   }
index a94a12f3ca90c14de7124cf7683a757decbcf49e..b7849968f223850c8b78e83d16c5cb6d08eabe34 100644 (file)
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: filename.ml,v 1.41 2007/01/09 13:42:17 doligez Exp $ *)
+(* $Id: filename.ml,v 1.41.12.1 2008/11/20 18:36:52 doligez Exp $ *)
 
 let generic_quote quotequote s =
   let l = String.length s in
@@ -98,21 +98,24 @@ module Win32 = struct
     let b = Buffer.create (l + 20) in
     Buffer.add_char b '\"';
     let rec loop i =
-      if i = l then () else
+      if i = l then Buffer.add_char b '\"' else
       match s.[i] with
       | '\"' -> loop_bs 0 i;
       | '\\' -> loop_bs 0 i;
       | c    -> Buffer.add_char b c; loop (i+1);
     and loop_bs n i =
-      if i = l then add_bs (2*n) else
-      match s.[i] with
-      | '\"' -> add_bs (2*n+1); Buffer.add_char b '\"'; loop (i+1);
-      | '\\' -> loop_bs (n+1) (i+1);
-      | c    -> add_bs n; loop i
+      if i = l then begin
+        Buffer.add_char b '\"';
+        add_bs n;
+      end else begin
+        match s.[i] with
+        | '\"' -> add_bs (2*n+1); Buffer.add_char b '\"'; loop (i+1);
+        | '\\' -> loop_bs (n+1) (i+1);
+        | c    -> add_bs n; loop i
+      end
     and add_bs n = for j = 1 to n do Buffer.add_char b '\\'; done
     in
     loop 0;
-    Buffer.add_char b '\"';
     Buffer.contents b
   let has_drive s =
     let is_letter = function
index fac7ab38057277194791e2fa817916902da19545..faed5cf904936c34d9b7831d52dd82f1144e369b 100644 (file)
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: gc.ml,v 1.20 2004/06/14 13:27:36 doligez Exp $ *)
+(* $Id: gc.ml,v 1.20.24.1 2008/11/18 10:24:43 doligez Exp $ *)
 
 type stat = {
   minor_words : float;
@@ -38,6 +38,7 @@ type control = {
   mutable verbose : int;
   mutable max_overhead : int;
   mutable stack_limit : int;
+  mutable allocation_policy : int;
 };;
 
 external stat : unit -> stat = "caml_gc_stat";;
index 6a60a96747469f65120ae9ffb9ac652823323fe7..ee56196dd6f3f441afc0826515dea6ad4fdf742f 100644 (file)
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: gc.mli,v 1.44 2008/02/29 14:21:22 doligez Exp $ *)
+(* $Id: gc.mli,v 1.44.4.1 2008/11/18 10:24:43 doligez Exp $ *)
 
 (** Memory management control and statistics; finalised values. *)
 
@@ -126,6 +126,14 @@ type control =
     (** The maximum size of the stack (in words).  This is only
        relevant to the byte-code runtime, as the native code runtime
        uses the operating system's stack.  Default: 256k. *)
+
+    mutable allocation_policy : int;
+    (** The policy used for allocating in the heap.  Possible
+        values are 0 and 1.  0 is the next-fit policy, which is
+        quite fast but can result in fragmentation.  1 is the
+        first-fit policy, which can be slower in some cases but
+        can be better for programs with fragmentation problems.
+        Default: 0. *)
 }
 (** The GC parameters are given as a [control] record.  Note that
     these parameters can also be initialised by setting the
index 292b8ba4625cf3ce1f7c1c4e4a85f93b8f15d15c..908be652a21350f47c9e6c34bb13204462c72b15 100644 (file)
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: string.ml,v 1.28 2008/07/22 11:29:00 weis Exp $ *)
+(* $Id: string.ml,v 1.28.2.1 2008/11/12 10:53:47 doligez Exp $ *)
 
 (* String operations *)
 
@@ -154,7 +154,7 @@ let index s c = index_rec s (length s) 0 c;;
 
 let index_from s i c =
   let l = length s in
-  if i < 0 || i >= l then invalid_arg "String.index_from" else
+  if i < 0 || i > l then invalid_arg "String.index_from" else
   index_rec s l i c;;
 
 let rec rindex_rec s i c =
@@ -164,22 +164,18 @@ let rec rindex_rec s i c =
 let rindex s c = rindex_rec s (length s - 1) c;;
 
 let rindex_from s i c =
-  let l = length s in
-  if i < 0 || i >= l then invalid_arg "String.rindex_from" else
+  if i < -1 || i >= length s then invalid_arg "String.rindex_from" else
   rindex_rec s i c;;
 
 let contains_from s i c =
   let l = length s in
-  if i < 0 || i >= l then invalid_arg "String.contains_from" else
+  if i < 0 || i > l then invalid_arg "String.contains_from" else
   try ignore (index_rec s l i c); true with Not_found -> false;;
 
-let contains s c =
-  let l = length s in
-  l <> 0 && contains_from s 0 c;;
+let contains s c = contains_from s 0 c;;
 
 let rcontains_from s i c =
-  let l = length s in
-  if i < 0 || i >= l then invalid_arg "String.rcontains_from" else
+  if i < 0 || i >= length s then invalid_arg "String.rcontains_from" else
   try ignore (rindex_rec s i c); true with Not_found -> false;;
 
 type t = string
index 437bab242153d2d23df35c274744e406886e8465..b2dcf606e2272f990869560ba9b76debeaf4e400 100644 (file)
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: weak.mli,v 1.16 2008/09/17 14:55:30 doligez Exp $ *)
+(* $Id: weak.mli,v 1.16.2.1 2008/11/13 10:39:46 doligez Exp $ *)
 
 (** Arrays of weak pointers and hash tables of weak pointers. *)
 
 
 type 'a t
 (** The type of arrays of weak pointers (weak arrays).  A weak
-   pointer is a value that the garbage collector may erase at
-   any time.
+   pointer is a value that the garbage collector may erase whenever
+   the value is not used any more (through normal pointers) by the
+   program.  Note that finalisation functions are run after the
+   weak pointers are erased.
    A weak pointer is said to be full if it points to a value,
    empty if the value was erased by the GC.
 
index fa2cf436b75fb8e8e6d55904124bcd4dd2fb620e..2b9ee1fb1ac1a136979d3e655dc55990351a30bc 100755 (executable)
@@ -12,7 +12,7 @@
 #                                                                       #
 #########################################################################
 
-# $Id: make-package-macosx,v 1.16 2008/02/29 14:21:22 doligez Exp $
+# $Id: make-package-macosx,v 1.16.4.1 2008/10/16 15:57:00 doligez Exp $
 
 cd package-macosx
 rm -rf ocaml.pkg ocaml-rw.dmg
@@ -87,7 +87,8 @@ mkdir -p resources
 cat >resources/ReadMe.txt <<EOF
 This package installs Objective Caml version ${VERSION}.
 You need Mac OS X 10.5.x (Leopard), with the
-XCode tools (v3.x) installed (and optionally X11).
+XCode tools installed (v3.1.1 or later), and
+optionally X11.
 
 Files will be installed in the following directories:
 
index 6f6e7228b6f0d642e37b8c15c9c0cb17654a451c..7b389f32c2a056011eaa4da911360b9b6de6a7ad 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: opttopdirs.ml,v 1.2 2007/11/06 15:16:56 frisch Exp $ *)
+(* $Id: opttopdirs.ml,v 1.2.4.1 2008/11/19 02:35:40 garrigue Exp $ *)
 
 (* Toplevel directives *)
 
@@ -182,6 +182,9 @@ let _ =
   Hashtbl.add directive_table "principal"
              (Directive_bool(fun b -> Clflags.principal := b));
 
+  Hashtbl.add directive_table "rectypes"
+             (Directive_none(fun () -> Clflags.recursive_types := true));
+
   Hashtbl.add directive_table "warnings"
              (Directive_string (parse_warnings std_out false));
 
index 204df79a2f91ac57fa4ed301043fb043079ce65f..50cbc4ed47a4c4f9403755739b957caaa70faee9 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: topdirs.ml,v 1.66 2006/09/28 21:36:38 xleroy Exp $ *)
+(* $Id: topdirs.ml,v 1.66.14.1 2008/11/19 02:35:40 garrigue Exp $ *)
 
 (* Toplevel directives *)
 
@@ -294,6 +294,9 @@ let _ =
   Hashtbl.add directive_table "principal"
              (Directive_bool(fun b -> Clflags.principal := b));
 
+  Hashtbl.add directive_table "rectypes"
+             (Directive_none(fun () -> Clflags.recursive_types := true));
+
   Hashtbl.add directive_table "warnings"
              (Directive_string (parse_warnings std_out false));
 
index f0115532eaaf9adbf82db90100fec3d7e147879e..d8c3d60fdc7f3120f1da915be5fd1026897118ca 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: ctype.mli,v 1.55 2007/11/01 18:36:43 weis Exp $ *)
+(* $Id: ctype.mli,v 1.55.4.1 2008/10/16 03:05:26 garrigue Exp $ *)
 
 (* Operations on core types *)
 
@@ -131,6 +131,7 @@ val apply:
 
 val expand_head_once: Env.t -> type_expr -> type_expr
 val expand_head: Env.t -> type_expr -> type_expr
+val try_expand_once_opt: Env.t -> type_expr -> type_expr
 val expand_head_opt: Env.t -> type_expr -> type_expr
 (** The compiler's own version of [expand_head] necessary for type-based
     optimisations. *)
index 91750f21199344fdab90552be092995476aadf57..ba4d1120400556730c9c9012705f784cd8f1543c 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: includecore.ml,v 1.35 2007/11/28 22:27:35 weis Exp $ *)
+(* $Id: includecore.ml,v 1.35.4.2 2008/10/16 03:05:26 garrigue Exp $ *)
 
 (* Inclusion checks for the core language *)
 
@@ -54,7 +54,7 @@ let is_absrow env ty =
       end
   | _ -> false
 
-let type_manifest env ty1 params1 ty2 params2 =
+let type_manifest env ty1 params1 ty2 params2 priv2 =
   let ty1' = Ctype.expand_head env ty1 and ty2' = Ctype.expand_head env ty2 in
   match ty1'.desc, ty2'.desc with
     Tvariant row1, Tvariant row2 when is_absrow env (Btype.row_more row2) ->
@@ -97,7 +97,13 @@ let type_manifest env ty1 params1 ty2 params2 =
        List.split (List.map (fun (_,_,t1,_,t2) -> t1, t2) pairs) in
       Ctype.equal env true (params1 @ tl1) (params2 @ tl2)
   | _ ->
-      Ctype.equal env true (ty1 :: params1) (ty2 :: params2)
+      let rec check_super ty1 =
+        Ctype.equal env true (ty1 :: params1) (ty2 :: params2) ||
+        priv2 = Private &&
+        try check_super
+              (Ctype.try_expand_once_opt env (Ctype.expand_head env ty1))
+        with Ctype.Cannot_expand -> false
+      in check_super ty1
 
 (* Inclusion between type declarations *)
 
@@ -131,6 +137,7 @@ let type_declarations env id decl1 decl2 =
         Ctype.equal env true decl1.type_params decl2.type_params
     | (Some ty1, Some ty2) ->
        type_manifest env ty1 decl1.type_params ty2 decl2.type_params
+          decl2.type_private
     | (None, Some ty2) ->
         let ty1 =
           Btype.newgenty (Tconstr(Pident id, decl2.type_params, ref Mnil))
index 17ba4c4dafae8d3362642439b7313d65740d03c8..91a6a9d497b362ccce01e2edd4a9bf569ba357bd 100644 (file)
@@ -10,7 +10,7 @@
 (*                                                                     *)
 (***********************************************************************)
 
-(* $Id: ccomp.ml,v 1.28.4.1 2008/10/15 08:48:51 xleroy Exp $ *)
+(* $Id: ccomp.ml,v 1.28.4.2 2008/10/16 15:57:00 doligez Exp $ *)
 
 (* Compiling C files and building C libraries *)
 
@@ -118,7 +118,7 @@ let call_linker mode output_name files extra =
         )
         (Filename.quote output_name)
         (if !Clflags.gprofile then Config.cc_profile else "")
-        (Clflags.std_include_flag "-I")
+        ""  (*(Clflags.std_include_flag "-I")*)
         (quote_prefixed "-L" !Config.load_path)
         files
         extra