Skip to content
This repository
Browse code

merge changes from release/3.11.1 to release/3.11.2

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9540 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
commit cff40c4f2829cf30b4e05d7a39e8566440892d3f 1 parent b709b6a
doligez authored

Showing 132 changed files with 1,400 additions and 864 deletions. Show diff stats Hide diff stats

  1. +55 2 Changes
  2. +9 6 INSTALL
  3. +5 4 Makefile
  4. +15 14 README.win32
  5. +1 1  VERSION
  6. +2 0  _tags
  7. +2 2 asmcomp/alpha/emit.mlp
  8. +22 26 asmcomp/amd64/emit.mlp
  9. +1 2  asmcomp/amd64/proc.ml
  10. +3 0  asmcomp/arm/emit.mlp
  11. +1 0  asmcomp/asmlink.ml
  12. +21 0 asmcomp/emitaux.ml
  13. +3 0  asmcomp/emitaux.mli
  14. +5 3 asmcomp/hppa/emit.mlp
  15. +7 4 asmcomp/i386/emit.mlp
  16. +2 2 asmcomp/ia64/emit.mlp
  17. +2 3 asmcomp/mips/emit.mlp
  18. +11 4 asmcomp/power/emit.mlp
  19. +4 3 asmcomp/sparc/emit.mlp
  20. +3 10 asmrun/ia64.S
  21. +1 0  boot/.cvsignore
  22. BIN  boot/ocamlc
  23. BIN  boot/ocamldep
  24. BIN  boot/ocamllex
  25. +1 3 build/boot-c-parts-windows.sh
  26. +1 2  build/install.sh
  27. +1 0  build/mkmyocamlbuild_config.sh
  28. +54 6 bytecomp/bytelink.ml
  29. +3 11 bytecomp/symtable.ml
  30. +18 22 bytecomp/typeopt.ml
  31. +2 0  byterun/.cvsignore
  32. +6 6 byterun/.depend
  33. +6 1 byterun/backtrace.c
  34. +1 0  byterun/backtrace.h
  35. +1 1  byterun/gc_ctrl.c
  36. +2 1  byterun/interp.c
  37. +4 0 byterun/obj.c
  38. +28 4 byterun/startup.c
  39. +1 1  camlp4/Makefile.ml
  40. +7 3 config/Makefile-templ
  41. +2 2 config/Makefile.mingw
  42. +5 5 config/Makefile.msvc
  43. +2 2 config/Makefile.msvc64
  44. +12 8 configure
  45. +121 121 debugger/.depend
  46. +4 3 debugger/Makefile.shared
  47. +23 11 debugger/command_line.ml
  48. +3 1 debugger/frames.ml
  49. +2 2 debugger/frames.mli
  50. +34 2 debugger/main.ml
  51. +8 1 debugger/show_information.ml
  52. +9 7 debugger/show_source.ml
  53. +5 0 debugger/source.ml
  54. +3 0  debugger/source.mli
  55. +7 0 debugger/symbols.ml
  56. +1 1  driver/main_args.ml
  57. +1 1  driver/optmain.ml
  58. +4 4 emacs/caml-types.el
  59. +32 32 lex/.depend
  60. +2 0  lex/Makefile.nt
  61. +3 3 myocamlbuild.ml
  62. +1 0  myocamlbuild_config.mli
  63. +1 1  ocamlbuild/_tags
  64. +1 1  ocamlbuild/command.ml
  65. +4 1 ocamlbuild/ocaml_specific.ml
  66. +4 1 ocamlbuild/ocaml_utils.ml
  67. +1 1  ocamlbuild/ocamlbuild-presentation.rslide
  68. +1 0  ocamlbuild/ocamlbuild_plugin.ml
  69. +1 0  ocamlbuild/ocamlbuild_unix_plugin.ml
  70. +4 3 ocamlbuild/options.ml
  71. +11 4 ocamlbuild/plugin.ml
  72. +3 2 ocamlbuild/rule.ml
  73. +1 0  ocamlbuild/rule.mli
  74. +4 0 ocamlbuild/signatures.mli
  75. +1 0  ocamldoc/.cvsignore
  76. +114 114 ocamldoc/.depend
  77. +2 2 ocamldoc/odoc.ml
  78. +2 2 ocamldoc/odoc_ast.ml
  79. +2 1  ocamldoc/remove_DEBUG
  80. +2 0  otherlibs/bigarray/.cvsignore
  81. +3 3 otherlibs/bigarray/.depend
  82. +2 0  otherlibs/dbm/.cvsignore
  83. +3 3 otherlibs/dbm/.depend
  84. +1 0  otherlibs/dynlink/.cvsignore
  85. +2 0  otherlibs/graph/.cvsignore
  86. +6 6 otherlibs/graph/.depend
  87. +1 0  otherlibs/labltk/frx/.cvsignore
  88. +1 0  otherlibs/labltk/jpf/.cvsignore
  89. +1 1  otherlibs/labltk/lib/.cvsignore
  90. +2 0  otherlibs/labltk/support/.cvsignore
  91. +2 0  otherlibs/labltk/tkanim/.cvsignore
  92. +2 0  otherlibs/num/.cvsignore
  93. +21 21 otherlibs/num/.depend
  94. +12 2 otherlibs/num/nat_stubs.c
  95. +2 0  otherlibs/str/.cvsignore
  96. +3 3 otherlibs/str/.depend
  97. +2 0  otherlibs/systhreads/.cvsignore
  98. +19 19 otherlibs/systhreads/.depend
  99. +2 0  otherlibs/threads/.cvsignore
  100. +21 21 otherlibs/threads/.depend
  101. +2 0  otherlibs/unix/.cvsignore
  102. +29 6 otherlibs/unix/.depend
  103. +6 0 otherlibs/unix/socketaddr.c
  104. +4 1 otherlibs/win32unix/channels.c
  105. +3 0  otherlibs/win32unix/unixsupport.c
  106. +1 1  otherlibs/win32unix/unixsupport.h
  107. +1 0  stdlib/.cvsignore
  108. +140 138 stdlib/.depend
  109. +8 0 stdlib/buffer.ml
  110. +9 0 stdlib/buffer.mli
  111. +6 6 stdlib/filename.ml
  112. +7 2 stdlib/filename.mli
  113. +41 3 stdlib/format.mli
  114. +3 0  stdlib/obj.ml
  115. +4 1 stdlib/obj.mli
  116. +9 5 stdlib/pervasives.mli
  117. +14 3 stdlib/printexc.ml
  118. +10 0 stdlib/printexc.mli
  119. +11 7 stdlib/scanf.mli
  120. +34 33 stdlib/stdlib.mllib
  121. +15 1 test/Moretest/tscanf.ml
  122. +15 0 testlabl/bugs/pr4933.ml
  123. +58 0 testlabl/private.ml
  124. +1 0  tools/.cvsignore
  125. +38 38 tools/.depend
  126. +13 9 tools/ocamlmklib.mlp
  127. +35 34 typing/ctype.ml
  128. +2 1  typing/includecore.ml
  129. +8 5 typing/typedecl.ml
  130. +9 4 typing/typetexp.ml
  131. +1 0  typing/typetexp.mli
  132. +1 1  utils/warnings.ml
57 Changes
@@ -22,8 +22,10 @@ Language features:
22 22 "let [rec] <ident> : 'a1 ... 'an. <typexp> = ..."
23 23 - First-class packages modules.
24 24 New kind of type expression, for packaged modules: (module PT).
25   - New kind of expression, to pack a module as a first-class value: (module MODEXPR : PT).
26   - New kind of module expression, to unpack a first-class value as a module: (val EXPR : PT).
  25 + New kind of expression, to pack a module as a first-class value:
  26 + (module MODEXPR : PT).
  27 + New kind of module expression, to unpack a first-class value as a module:
  28 + (val EXPR : PT).
27 29 PT is a package type of the form "S" or
28 30 "S with type t1 = ... and ... and type tn = ..." (S refers to a module type).
29 31 - Local opening of modules in a subexpression.
@@ -58,6 +60,55 @@ Bug Fixes:
58 60 - PR#4775: compiler crash on crazy types (temporary fix)
59 61
60 62
  63 +Objective Caml 3.11.2:
  64 +----------------------
  65 +
  66 +Bug fixes:
  67 +- PR#4151: better documentation for min and max w.r.t. NaN
  68 +- PR#4421: ocamlbuild uses wrong compiler for C files
  69 +- PR#4710, PR#4720: ocamlbuild does not use properly configuration information
  70 +- PR#4750: under some Windows installations, high start-up times for Unix lib
  71 +- PR#4777: problem with scanf and CRLF
  72 +- PR#4783: ocamlmklib problem under Windows
  73 +- PR#4810: BSD problem with socket addresses, e.g. in Unix.getnameinfo
  74 +- PR#4813: issue with parsing of float literals by the GNU assembler
  75 +- PR#4816: problem with modules and private types
  76 +- PR#4818: missed opportunity for type-based optimization of bigarray accesses
  77 +- PR#4821: check for duplicate method names in classes
  78 +- PR#4823: build problem on Mac OS X
  79 +- PR#4836: spurious errors raised by Unix.single_write under Windows
  80 +- PR#4841, PR#4860, PR#4930: problem with ocamlopt -output-obj under Mac OS X
  81 +- PR#4847: C compiler error with ocamlc -output-obj under Win64
  82 +- PR#4856: ocamlbuild uses ocamlrun to execute a native plugin
  83 +- PR#4867, PR#4760: ocamlopt -shared fails on Mac OS X 64bit
  84 +- PR#4873: ocamlbuild ignores "thread" tag when building a custom toplevel
  85 +- PR#4890: ocamlbuild tries to use native plugin on bytecode-only arch
  86 +- PR#4896: ocamlbuild should always pass -I to tools for external libraries
  87 +- PR#4900: small bug triggering automatic compaction even if max_overhead = 1M
  88 +- PR#4902: bug in %.0F printf format
  89 +- PR#4910: problem with format concatenation
  90 +- PR#4922: ocamlbuild recompiles too many files
  91 +- PR#4923: missing \xff for scanf %S
  92 +- PR#4933: functors not handling private types correctly
  93 +- PR#4940: problem with end-of-line in DOS text mode, tentative fix
  94 +- PR#4953: problem compiling bytecode interpreter on ARM in Thumb mode.
  95 +- PR#4955: compiler crash when typing recursive type expression with constraint
  96 +- Module Printf: the simple conversion %F (without width indication) was not
  97 + treated properly.
  98 +- Makefile: problem with cygwin, flexdll, and symbolic links
  99 +- Various build problems with ocamlbuild under Windows with msvc
  100 +
  101 +Feature wishes:
  102 +- PR#9: (tentative implementation) make ocamldebug use #linenum annotations
  103 +- PR#123, PR#4477: custom exception printers
  104 +- PR#3456: Obj.double_field and Obj.set_double_field functions
  105 +- PR#4003: destination directory can be given to Filename.[open_]temp_file
  106 +- PR#4647: Buffer.blit function
  107 +- PR#4685: access to Filename.dir_sep
  108 +- PR#4703: support for debugging embedded applications
  109 +- PR#4723: "clear_rules" function to empty the set of ocamlbuild rules
  110 +- PR#4921: configure option to help cross-compilers
  111 +
61 112 Objective Caml 3.11.1:
62 113 ----------------------
63 114
@@ -113,6 +164,7 @@ Other changes:
113 164 (contributed by Jonathan Davies, Citrix).
114 165 - Support for 64-bit mode in Solaris/x86 (PR#4670).
115 166
  167 +
116 168 Objective Caml 3.11.0:
117 169 ----------------------
118 170
@@ -261,6 +313,7 @@ Bug fixes:
261 313 - Small bugs in the make-package-macosx script
262 314 - Bug in typing of polymorphic variants (reported on caml-list)
263 315
  316 +
264 317 Objective Caml 3.10.1:
265 318 ----------------------
266 319
15 INSTALL
@@ -109,7 +109,7 @@ The "configure" script accepts the following options:
109 109 -as <assembler and options> (default: determined automatically)
110 110 The assembler to use for assembling ocamlopt-generated code.
111 111
112   --aspp <assembler and options> (default: determined automatically>
  112 +-aspp <assembler and options> (default: determined automatically)
113 113 The assembler to use for assembling the parts of the
114 114 run-time system manually written in assembly language.
115 115 This assembler must preprocess its input with the C preprocessor.
@@ -126,10 +126,13 @@ Examples:
126 126 Installation in /usr, man pages in section "l":
127 127 ./configure -bindir /usr/bin -libdir /usr/lib/ocaml -mandir /usr/man/manl
128 128
129   - On a MacOSX/Intel Core 2 or MacOSX/PowerPC host, to build a 64-bit version
130   - of OCaml:
  129 + On a MacOSX 10.5/Intel Core 2 or MacOSX 10.5/PowerPC host,
  130 + to build a 64-bit version of OCaml:
131 131 ./configure -cc "gcc -m64"
132 132
  133 + On a MacOSX 10.6/Intel Core 2, to build a 32-bit version of OCaml:
  134 + ./configure -cc "gcc -m32" -as "as -arch i386" -aspp "gcc -m32 -c"
  135 +
133 136 On a Linux x86/64 bits host, to build a 32-bit version of OCaml:
134 137 ./configure -cc "gcc -m32" -as "as --32" -aspp "gcc -m32 -c"
135 138
@@ -188,9 +191,9 @@ or:
188 191 make opt > log.opt 2>&1 # in sh
189 192 make opt >& log.opt # in csh
190 193
191   -5- (Optional) If you want to compile fast versions of the Objective
192   -Caml compilers, you can compile them with the native-code compiler
193   -(they are compiled to bytecode by default). Just do:
  194 +5- Compile fast versions of the Objective Caml compilers, by
  195 +compiling them with the native-code compiler (you have only compiled
  196 +them to bytecode so far). Just do:
194 197
195 198 make opt.opt
196 199
9 Makefile
@@ -567,10 +567,11 @@ alldepend::
567 567
568 568 # The runtime system for the native-code compiler
569 569
570   -runtimeopt:
  570 +runtimeopt: makeruntimeopt
  571 + cp asmrun/libasmrun.a stdlib/libasmrun.a
  572 +
  573 +makeruntimeopt:
571 574 cd asmrun; $(MAKE) all
572   - if test -f stdlib/libasmrun.a; then :; else \
573   - ln -s ../asmrun/libasmrun.a stdlib/libasmrun.a; fi
574 575
575 576 clean::
576 577 cd asmrun; $(MAKE) clean
@@ -762,6 +763,6 @@ distclean:
762 763 .PHONY: ocamldoc.opt ocamllex ocamllex.opt ocamltools ocamltools.opt
763 764 .PHONY: ocamlyacc opt-core opt opt.opt otherlibraries
764 765 .PHONY: otherlibrariesopt package-macosx promote promote-cross
765   -.PHONY: restore runtime runtimeopt world world.opt
  766 +.PHONY: restore runtime runtimeopt makeruntimeopt world world.opt
766 767
767 768 include .depend
29 README.win32
@@ -61,7 +61,7 @@ Microsoft Visual C++ compiler (items [1] and [2] in the section
61 61 The native-code compiler (ocamlopt) requires Visual C++ (items [1], [2]),
62 62 the Microsoft assembler MASM (item [3]) and the flexdll tool (item [5]).
63 63
64   -The LablTk GUI requires Tcl/Tk 8.4 (item [4]).
  64 +The LablTk GUI requires Tcl/Tk 8.5 (item [4]).
65 65
66 66
67 67 INSTALLATION:
@@ -70,33 +70,34 @@ The binary distribution is a self-installing executable archive.
70 70 Just run it and it should install OCaml automatically.
71 71
72 72 To run programs that use the LablTK GUI, the directory where the
73   -DLLs tk84.dll and tcl84.dll were installed (by the Tcl/Tk
  73 +DLLs tk85.dll and tcl85.dll were installed (by the Tcl/Tk
74 74 installer) must be added to the PATH environment variable.
75 75
76 76 To compile programs that use the LablTK GUI, the directory where the
77   -libraries tk84.lib and tcl84.lib were installed (by the Tcl/Tk
  77 +libraries tk85.lib and tcl85.lib were installed (by the Tcl/Tk
78 78 installer) must be added to the library search path in the LIB
79 79 environment variable. E.g. if Tcl/Tk was installed in C:\tcl, add
80 80 "C:\tcl\lib" to the LIB environment variable.
81 81
82 82 THIRD-PARTY SOFTWARE:
83 83
84   -[1] Visual C++ version 2005, 2003, or 6.
85   - We use Visual C++ 2005 Express Edition, which can be downloaded for free
  84 +[1] Visual C++ version 2008, 2005, 2003, or 6.
  85 + We use Visual C++ 2008 Express Edition, which can be downloaded for free
86 86 from http://www.microsoft.com.
87 87
88   -[2] Windows header files and development libraries. We found them in
89   - the Microsoft Windows Server 2003 SP1 Platform SDK, which can
90   - be downloaded for free from http://www.microsoft.com/.
  88 +[2] Windows header files and development libraries. They are included
  89 + in the Visual C++ 2008 Express Edition distribution.
  90 + Otherwise, you can find them in the Windows Platform SDK,
  91 + which can be downloaded for free from http://www.microsoft.com/.
91 92
92 93 [3] MASM version 6.11 or later. The full distribution of Visual C++ 2005
93   - contains MASM version 8. Users of the Express Edition of Visual C++
  94 + or 2008 contains MASM version 8. Users of the Express Edition of Visual C++
94 95 2005 can download MASM version 8 from
95 96 http://www.microsoft.com/downloads/details.aspx?FamilyID=7A1C9DA0-0510-44A2-B042-7EF370530C64&displaylang=en
96 97 To obtain MASM version 6.11, see
97 98 http://users.easystreet.com/jkirwan/new/pctools.html.
98 99
99   -[4] TCL/TK version 8.4. Windows binaries are available as part of the
  100 +[4] TCL/TK version 8.5. Windows binaries are available as part of the
100 101 ActiveTCL distribution at http://www.activestate.com/products/ActiveTcl/
101 102
102 103 [5] flexdll.
@@ -190,7 +191,7 @@ Do *not* install the Mingw/MSYS development tools from www.mingw.org:
190 191 these are not compatible with this Caml port (@responsefile not
191 192 recognized on the command line).
192 193
193   -The LablTk GUI requires Tcl/Tk 8.4. Windows binaries are available
  194 +The LablTk GUI requires Tcl/Tk 8.5. Windows binaries are available
194 195 as part of the ActiveTCL distribution at
195 196 http://www.activestate.com/products/ActiveTcl/
196 197
@@ -200,11 +201,11 @@ The binary distribution is a self-installing executable archive.
200 201 Just run it and it should install OCaml automatically.
201 202
202 203 To run programs that use the LablTK GUI, the directory where the
203   -DLLs tk84.dll and tcl84.dll were installed (by the Tcl/Tk
  204 +DLLs tk85.dll and tcl85.dll were installed (by the Tcl/Tk
204 205 installer) must be added to the PATH environment variable.
205 206
206 207 To compile programs that use the LablTK GUI, the directory where the
207   -libraries tk84.lib and tcl84.lib were installed (by the Tcl/Tk
  208 +libraries tk85.lib and tcl85.lib were installed (by the Tcl/Tk
208 209 installer) must be added to the library search path in the LIB
209 210 environment variable. E.g. if Tcl/Tk was installed in C:\tcl, add
210 211 "C:\tcl\lib" to the LIB environment variable.
@@ -217,7 +218,7 @@ You will need the following software components to perform the recompilation:
217 218 - Cygwin: http://sourceware.cygnus.com/cygwin/
218 219 Install at least the following packages: binutils, diffutils,
219 220 gcc-core, gcc-mingw-core, make, mingw-runtime, ncurses, w32-api.
220   -- TCL/TK version 8.4 (see above).
  221 +- TCL/TK version 8.5 (see above).
221 222 - The flexdll tool (see above).
222 223
223 224 Do *not* install the standalone distribution of MinGW, nor the
2  VERSION
... ... @@ -1,4 +1,4 @@
1   -3.12.0+dev16 (2010-01-07)
  1 +3.12.0+dev17 (2010-01-20)
2 2
3 3 # The version string is the first line of this file.
4 4 # It must be in the format described in stdlib/sys.mli
2  _tags
@@ -55,6 +55,7 @@ true: use_stdlib
55 55 <otherlibs/num/nums.cm{,x}a> or <otherlibs/dbm/dbm.cm{,x}a>: ocamlmklib
56 56 <otherlibs/{,win32}graph/graphics.cm{,x}a>: ocamlmklib
57 57 <otherlibs/threads/threads.cm{,x}a>: ocamlmklib
  58 +"otherlibs/threads/unix.cma": ocamlmklib
58 59 <otherlibs/bigarray/bigarray.cm{,x}a>: ocamlmklib
59 60
60 61 <otherlibs/{bigarray,systhreads}/**.ml*>: include_unix
@@ -70,6 +71,7 @@ true: use_stdlib
70 71 <otherlibs/bigarray/**>: otherlibs_bigarray
71 72 <otherlibs/num/**>: otherlibs_num
72 73 <otherlibs/threads/**>: otherlibs_threads
  74 +"otherlibs/threads/unix.cma": -otherlibs_threads
73 75 <otherlibs/systhreads/**>: otherlibs_systhreads
74 76 <otherlibs/dbm/**>: otherlibs_dbm
75 77 <otherlibs/graph/**>: otherlibs_graph
4 asmcomp/alpha/emit.mlp
@@ -793,9 +793,9 @@ let emit_item = function
793 793 long decimal constants *)
794 794 ` .quad 0x{emit_string(Nativeint.format "%x" n)}\n`
795 795 | Csingle f ->
796   - ` .float {emit_string f}\n`
  796 + emit_float32_directive ".long" f
797 797 | Cdouble f ->
798   - ` .double {emit_string f}\n`
  798 + emit_float64_directive ".quad" f
799 799 | Csymbol_address s ->
800 800 ` .quad {emit_symbol s}\n`
801 801 | Clabel_address lbl ->
48 asmcomp/amd64/emit.mlp
@@ -575,33 +575,26 @@ let emit_instr fallthrough i =
575 575 end
576 576 | Lswitch jumptbl ->
577 577 let lbl = new_label() in
578   - if !pic_code || !Clflags.dlcode then begin
579   - (* PR#4424: r11 is known to be clobbered by the Lswitch,
580   - meaning that no variable that is live across the Lswitch
581   - is assigned to r11. However, the argument to Lswitch
582   - can still be assigned to r11, so we need to special-case
583   - this situation. *)
584   - if i.arg.(0).loc = Reg 9 (* ie r11, cf amd64/proc.ml *) then begin
585   - ` salq $3, %r11\n`;
586   - ` pushq %r11\n`;
587   - ` leaq {emit_label lbl}(%rip), %r11\n`;
588   - ` addq 0(%rsp), %r11\n`;
589   - ` addq $8, %rsp\n`;
590   - ` jmp *(%r11)\n`
591   - end else begin
592   - ` leaq {emit_label lbl}(%rip), %r11\n`;
593   - ` jmp *(%r11, {emit_reg i.arg.(0)}, 8)\n`
594   - end
595   - end else begin
596   - ` jmp *{emit_label lbl}(, {emit_reg i.arg.(0)}, 8)\n`
597   - end;
  578 + (* rax and rdx are clobbered by the Lswitch,
  579 + meaning that no variable that is live across the Lswitch
  580 + is assigned to rax or rdx. However, the argument to Lswitch
  581 + can still be assigned to one of these two registers, so
  582 + we must be careful not to clobber it before use. *)
  583 + let (tmp1, tmp2) =
  584 + if i.arg.(0).loc = Reg 0 (* rax *)
  585 + then (phys_reg 4 (*rdx*), phys_reg 0 (*rax*))
  586 + else (phys_reg 0 (*rax*), phys_reg 4 (*rdx*)) in
  587 + ` leaq {emit_label lbl}(%rip), {emit_reg tmp1}\n`;
  588 + ` movslq ({emit_reg tmp1}, {emit_reg i.arg.(0)}, 4), {emit_reg tmp2}\n`;
  589 + ` addq {emit_reg tmp2}, {emit_reg tmp1}\n`;
  590 + ` jmp *{emit_reg tmp1}\n`;
598 591 if macosx
599 592 then ` .const\n`
600 593 else ` .section .rodata\n`;
601   - emit_align 8;
  594 + emit_align 4;
602 595 `{emit_label lbl}:`;
603 596 for i = 0 to Array.length jumptbl - 1 do
604   - ` .quad {emit_label jumptbl.(i)}\n`
  597 + ` .long {emit_label jumptbl.(i)} - {emit_label lbl}\n`
605 598 done;
606 599 ` .text\n`
607 600 | Lsetuptrap lbl ->
@@ -634,7 +627,8 @@ let rec emit_all fallthrough i =
634 627 (* Emission of the floating-point constants *)
635 628
636 629 let emit_float_constant (lbl, cst) =
637   - `{emit_label lbl}: .double {emit_string cst}\n`
  630 + `{emit_label lbl}:`;
  631 + emit_float64_directive ".quad" cst
638 632
639 633 (* Emission of the profiling prelude *)
640 634
@@ -667,7 +661,9 @@ let fundecl fundecl =
667 661 bound_error_call := 0;
668 662 ` .text\n`;
669 663 emit_align 16;
670   - if macosx && is_generic_function fundecl.fun_name
  664 + if macosx
  665 + && not !Clflags.output_c_object
  666 + && is_generic_function fundecl.fun_name
671 667 then (* PR#4690 *)
672 668 ` .private_extern {emit_symbol fundecl.fun_name}\n`
673 669 else
@@ -712,9 +708,9 @@ let emit_item = function
712 708 | Cint n ->
713 709 ` .quad {emit_nativeint n}\n`
714 710 | Csingle f ->
715   - ` .float {emit_string f}\n`
  711 + emit_float32_directive ".long" f
716 712 | Cdouble f ->
717   - ` .double {emit_string f}\n`
  713 + emit_float64_directive ".quad" f
718 714 | Csymbol_address s ->
719 715 ` .quad {emit_symbol s}\n`
720 716 | Clabel_address lbl ->
3  asmcomp/amd64/proc.ml
@@ -92,7 +92,6 @@ let phys_reg n =
92 92 let rax = phys_reg 0
93 93 let rcx = phys_reg 5
94 94 let rdx = phys_reg 4
95   -let r11 = phys_reg 9
96 95 let rxmm15 = phys_reg 115
97 96
98 97 let stack_slot slot ty =
@@ -170,7 +169,7 @@ let destroyed_at_oper = function
170 169 | Iop(Istore(Single, _)) -> [| rxmm15 |]
171 170 | Iop(Ialloc _ | Iintop(Icomp _) | Iintop_imm((Idiv|Imod|Icomp _), _))
172 171 -> [| rax |]
173   - | Iswitch(_, _) when !pic_code || !Clflags.dlcode -> [| r11 |]
  172 + | Iswitch(_, _) -> [| rax; rdx |]
174 173 | _ -> [||]
175 174
176 175 let destroyed_at_raise = all_phys_regs
3  asmcomp/arm/emit.mlp
@@ -585,6 +585,9 @@ let emit_item = function
585 585 | Csingle f ->
586 586 ` .float {emit_string f}\n`
587 587 | Cdouble f ->
  588 + (* FIXME: this version of the ARM port is mixed-endian, so we
  589 + use .double instead of emit_float64_directive. The next
  590 + version is little-endian, so we'll use emit_float64 then. *)
588 591 ` .align 0\n`;
589 592 ` .double {emit_string f}\n`
590 593 | Csymbol_address s ->
1  asmcomp/asmlink.ml
@@ -259,6 +259,7 @@ let link_shared ppf objfiles output_name =
21 asmcomp/emitaux.ml
@@ -93,6 +93,27 @@ let emit_bytes_directive directive s =
93 93 done;
94 94 if !pos > 0 then emit_char '\n'
95 95
  96 +(* PR#4813: assemblers do strange things with float literals indeed,
  97 + so we convert to IEEE representation ourselves and emit float
  98 + literals as 32- or 64-bit integers. *)
  99 +
  100 +let emit_float64_directive directive f =
  101 + let x = Int64.bits_of_float (float_of_string f) in
  102 + emit_printf "\t%s\t0x%Lx\n" directive x
  103 +
  104 +let emit_float64_split_directive directive f =
  105 + let x = Int64.bits_of_float (float_of_string f) in
  106 + let lo = Int64.logand x 0xFFFF_FFFFL
  107 + and hi = Int64.shift_right_logical x 32 in
  108 + emit_printf "\t%s\t0x%Lx, 0x%Lx\n"
  109 + directive
  110 + (if Arch.big_endian then hi else lo)
  111 + (if Arch.big_endian then lo else hi)
  112 +
  113 +let emit_float32_directive directive f =
  114 + let x = Int32.bits_of_float (float_of_string f) in
  115 + emit_printf "\t%s\t0x%lx\n" directive x
  116 +
96 117 (* Record live pointers at call points *)
97 118
98 119 type frame_descr =
3  asmcomp/emitaux.mli
@@ -25,6 +25,9 @@ val emit_char: char -> unit
25 25 val emit_string_literal: string -> unit
26 26 val emit_string_directive: string -> string -> unit
27 27 val emit_bytes_directive: string -> string -> unit
  28 +val emit_float64_directive: string -> string -> unit
  29 +val emit_float64_split_directive: string -> string -> unit
  30 +val emit_float32_directive: string -> string -> unit
28 31
29 32 type frame_descr =
30 33 { fd_lbl: int; (* Return address *)
8 asmcomp/hppa/emit.mlp
@@ -299,7 +299,9 @@ let emit_float_constants () =
299 299 ` .text\n`;
300 300 emit_align 8;
301 301 List.iter
302   - (fun (lbl, cst) -> `{emit_label lbl}: .double {emit_string cst}\n`)
  302 + (fun (lbl, cst) ->
  303 + `{emit_label lbl}:`;
  304 + emit_float64_split_directive ".long" cst)
303 305 !float_constants;
304 306 float_constants := []
305 307
@@ -972,9 +974,9 @@ let emit_item = function
972 974 | Cint n ->
973 975 ` .long {emit_nativeint n}\n`
974 976 | Csingle f ->
975   - ` .float {emit_string f}\n`
  977 + emit_float32_directive ".long" f
976 978 | Cdouble f ->
977   - ` .double {emit_string f}\n`
  979 + emit_float64_split_directive ".long" f
978 980 | Csymbol_address s ->
979 981 use_symbol s;
980 982 ` .long {emit_symbol s}\n`
11 asmcomp/i386/emit.mlp
@@ -815,7 +815,8 @@ let rec emit_all fallthrough i =
815 815
816 816 let emit_float_constant (lbl, cst) =
817 817 ` .data\n`;
818   - `{emit_label lbl}: .double {emit_string cst}\n`
  818 + `{emit_label lbl}:`;
  819 + emit_float64_split_directive ".long" cst
819 820
820 821 (* Emission of external symbol references (for MacOSX) *)
821 822
@@ -888,7 +889,9 @@ let fundecl fundecl =
888 889 bound_error_call := 0;
889 890 ` .text\n`;
890 891 emit_align 16;
891   - if macosx && is_generic_function fundecl.fun_name
  892 + if macosx
  893 + && not !Clflags.output_c_object
  894 + && is_generic_function fundecl.fun_name
892 895 then (* PR#4690 *)
893 896 ` .private_extern {emit_symbol fundecl.fun_name}\n`
894 897 else
@@ -928,9 +931,9 @@ let emit_item = function
928 931 | Cint n ->
929 932 ` .long {emit_nativeint n}\n`
930 933 | Csingle f ->
931   - ` .float {emit_string f}\n`
  934 + emit_float32_directive ".long" f
932 935 | Cdouble f ->
933   - ` .double {emit_string f}\n`
  936 + emit_float64_split_directive ".long" f
934 937 | Csymbol_address s ->
935 938 ` .long {emit_symbol s}\n`
936 939 | Clabel_address lbl ->
4 asmcomp/ia64/emit.mlp
@@ -1287,9 +1287,9 @@ let emit_item = function
1287 1287 | Cint n ->
1288 1288 ` data8 {emit_nativeint n}\n`
1289 1289 | Csingle f ->
1290   - ` real4 {emit_string f}\n`
  1290 + emit_float32_directive "data4" f
1291 1291 | Cdouble f ->
1292   - ` real8 {emit_string f}\n`
  1292 + emit_float64_directive "data8" f
1293 1293 | Csymbol_address s ->
1294 1294 ` data8 {emit_symbol s}#\n`
1295 1295 | Clabel_address lbl ->
5 asmcomp/mips/emit.mlp
@@ -527,10 +527,9 @@ let emit_item = function
527 527 | Cint n ->
528 528 ` .word {emit_nativeint n}\n`
529 529 | Csingle f ->
530   - ` .float {emit_string f}\n`
  530 + emit_float32_directive ".word" f
531 531 | Cdouble f ->
532   - ` .align 0\n`; (* Prevent alignment on 8-byte boundary *)
533   - ` .double {emit_string f}\n`
  532 + emit_float64_split_directive ".word" f
534 533 | Csymbol_address s ->
535 534 ` .word {emit_symbol s}\n`
536 535 | Clabel_address lbl ->
15 asmcomp/power/emit.mlp
@@ -835,7 +835,9 @@ let fundecl fundecl =
835 835 call_gc_label := 0;
836 836 float_literals := [];
837 837 int_literals := [];
838   - if Config.system = "rhapsody" && is_generic_function fundecl.fun_name
  838 + if Config.system = "rhapsody"
  839 + && not !Clflags.output_c_object
  840 + && is_generic_function fundecl.fun_name
839 841 then (* PR#4690 *)
840 842 ` .private_extern {emit_symbol fundecl.fun_name}\n`
841 843 else
@@ -871,7 +873,10 @@ let fundecl fundecl =
871 873 ` .align 3\n`;
872 874 List.iter
873 875 (fun (f, lbl) ->
874   - `{emit_label lbl}: .double 0d{emit_string f}\n`)
  876 + `{emit_label lbl}:`;
  877 + if ppc64
  878 + then emit_float64_directive ".quad" f
  879 + else emit_float64_split_directive ".long" f)
875 880 !float_literals;
876 881 List.iter
877 882 (fun (n, lbl) ->
@@ -902,9 +907,11 @@ let emit_item = function
902 907 | Cint n ->
903 908 ` {emit_string datag} {emit_nativeint n}\n`
904 909 | Csingle f ->
905   - ` .float 0d{emit_string f}\n`
  910 + emit_float32_directive ".long" f
906 911 | Cdouble f ->
907   - ` .double 0d{emit_string f}\n`
  912 + if ppc64
  913 + then emit_float64_directive ".quad" f
  914 + else emit_float64_split_directive ".long" f
908 915 | Csymbol_address s ->
909 916 ` {emit_string datag} {emit_symbol s}\n`
910 917 | Clabel_address lbl ->
7 asmcomp/sparc/emit.mlp
@@ -195,7 +195,8 @@ let float_constants = ref ([] : (int * string) list)
195 195 let emit_float_constant (lbl, cst) =
196 196 rodata ();
197 197 ` .align 8\n`;
198   - `{emit_label lbl}: .double 0r{emit_string cst}\n`
  198 + `{emit_label lbl}:`;
  199 + emit_float64_split_directive ".word" cst
199 200
200 201 (* Emission of the profiling prelude *)
201 202 let emit_profile () =
@@ -723,9 +724,9 @@ let emit_item = function
723 724 | Cint n ->
724 725 ` .word {emit_nativeint n}\n`
725 726 | Csingle f ->
726   - ` .single 0r{emit_string f}\n`
  727 + emit_float32_directive ".word" f
727 728 | Cdouble f ->
728   - ` .double 0r{emit_string f}\n`
  729 + emit_float64_split_directive ".word" f
729 730 | Csymbol_address s ->
730 731 ` .word {emit_symbol s}\n`
731 732 | Clabel_address lbl ->
13 asmrun/ia64.S
@@ -12,7 +12,7 @@
12 12
13 13 /* $Id$ */
14 14
15   -/* Asm part of the runtime system, Alpha processor */
  15 +/* Asm part of the runtime system, IA64 processor */
16 16
17 17 #undef BROKEN_POSTINCREMENT
18 18
@@ -68,15 +68,8 @@ caml_allocN:
68 68 sub r4 = r4, r2 ;;
69 69 cmp.ltu p0, p6 = r4, r5
70 70 (p6) br.ret.sptk b0 ;;
71   - /* Stash return address at sp (in stack scratch area) */
72   - mov r3 = b0 ;;
73   - st8 [sp] = r3
74   - /* Call GC */
75   - br.call.sptk b0 = caml_call_gc# ;;
76   - /* Return to caller */
77   - ld8 r3 = [sp] ;;
78   - mov b0 = r3 ;;
79   - br.ret.sptk b0
  71 + /* Fall through caml_call_gc */
  72 + br.sptk.many caml_call_gc#
80 73
81 74 .endp caml_allocN#
82 75
1  boot/.cvsignore
@@ -4,3 +4,4 @@ ocamlyacc
4 4 camlheader
5 5 myocamlbuild
6 6 myocamlbuild.native
  7 +libcamlrun.a
BIN  boot/ocamlc
Binary file not shown
BIN  boot/ocamldep
Binary file not shown
BIN  boot/ocamllex
Binary file not shown
4 build/boot-c-parts-windows.sh
@@ -13,7 +13,6 @@ set -ex
13 13 mkdir -p _build/boot
14 14 cp -f byterun/ocamlrun.exe \
15 15 byterun/libcamlrun.$A \
16   - byterun/ocamlrun.dll \
17 16 asmrun/libasmrun.$A \
18 17 yacc/ocamlyacc.exe \
19 18 boot/ocamlc \
@@ -21,5 +20,4 @@ cp -f byterun/ocamlrun.exe \
21 20 boot/ocamldep \
22 21 _build/boot
23 22 mkdir -p _build/byterun
24   -cp -f byterun/ocamlrun.exe byterun/ocamlrun.dll boot
25   -cp -f byterun/ocamlrun.$A _build/byterun
  23 +cp -f byterun/ocamlrun.exe boot
3  build/install.sh
@@ -132,7 +132,6 @@ cd ..
132 132 WIN32=""
133 133 if [ "x$EXE" = "x.exe" ]; then
134 134 installbin win32caml/ocamlwin.exe $PREFIX/OCamlWin.exe
135   - installdir byterun/ocamlrun.dll $BINDIR
136 135 WIN32=win32
137 136 fi
138 137
@@ -140,7 +139,7 @@ installdir otherlibs/"$WIN32"unix/unixsupport.h \
140 139 otherlibs/bigarray/bigarray.h \
141 140 $LIBDIR/caml
142 141
143   -installdir yacc/ocamlyacc byterun/ocamlrun $BINDIR
  142 +installdir yacc/ocamlyacc$EXE byterun/ocamlrun$EXE $BINDIR
144 143
145 144 installdir config/Makefile $LIBDIR/Makefile.config
146 145 installdir byterun/ld.conf $LIBDIR
1  build/mkmyocamlbuild_config.sh
@@ -19,6 +19,7 @@ cd `dirname $0`/..
19 19 sed \
20 20 -e 's/^.*FLEXDIR.*$//g' \
21 21 -e 's/^#ml \(.*\)/\1/' \
  22 + -e 's/^\([^"][^"]*\("[^"]*"[^"]*\)*\)#.*$/\1/' \
22 23 -e 's/^\(#.*\)$/(* \1 *)/' \
23 24 -e 's/^\(.*\$([0-9]).*\)$/(* \1 *)/' \
24 25 -e 's/^\([^(=]*\)=\([^"]*\)$/let <:lower<\1>> = "\2";;/' \
60 bytecomp/bytelink.ml
@@ -377,14 +377,40 @@ let output_data_string outchan data =
@@ -393,8 +419,11 @@ CAMLextern void caml_startup_code(\n\
@@ -422,18 +451,24 @@ void caml_startup(char ** argv)\n\
@@ -472,7 +507,20 @@ let link objfiles output_name =
14 bytecomp/symtable.ml
@@ -114,14 +114,10 @@ open Printf
114 114
115 115 let output_primitive_table outchan =
116 116 let prim = all_primitives() in
117   - fprintf outchan "\
118   - #ifdef __cplusplus\n\
119   - extern \"C\" {\n\
120   - #endif\n";
121 117 for i = 0 to Array.length prim - 1 do
122   - fprintf outchan "extern long %s();\n" prim.(i)
  118 + fprintf outchan "extern value %s();\n" prim.(i)
123 119 done;
124   - fprintf outchan "typedef long (*primitive)();\n";
  120 + fprintf outchan "typedef value (*primitive)();\n";
125 121 fprintf outchan "primitive caml_builtin_cprim[] = {\n";
126 122 for i = 0 to Array.length prim - 1 do
127 123 fprintf outchan " %s,\n" prim.(i)
@@ -131,11 +127,7 @@ let output_primitive_table outchan =
131 127 for i = 0 to Array.length prim - 1 do
132 128 fprintf outchan " \"%s\",\n" prim.(i)
133 129 done;
134   - fprintf outchan " (char *) 0 };\n";
135   - fprintf outchan "\
136   - #ifdef __cplusplus\n\
137   - }\n\
138   - #endif\n"
  130 + fprintf outchan " (char *) 0 };\n"
139 131
140 132 (* Initialization for batch linking *)
141 133
40 bytecomp/typeopt.ml
@@ -22,18 +22,17 @@ open Types
22 22 open Typedtree
23 23 open Lambda
24 24
  25 +let scrape env ty =
  26 + (Ctype.repr (Ctype.expand_head_opt env (Ctype.correct_levels ty))).desc
  27 +
25 28 let has_base_type exp base_ty_path =
26   - let exp_ty =
27   - Ctype.expand_head_opt exp.exp_env (Ctype.correct_levels exp.exp_type) in
28   - match Ctype.repr exp_ty with
29   - {desc = Tconstr(p, _, _)} -> Path.same p base_ty_path
  29 + match scrape exp.exp_env exp.exp_type with
  30 + | Tconstr(p, _, _) -> Path.same p base_ty_path
30 31 | _ -> false
31 32
32 33 let maybe_pointer exp =
33   - let exp_ty =
34   - Ctype.expand_head_opt exp.exp_env (Ctype.correct_levels exp.exp_type) in
35   - match (Ctype.repr exp_ty).desc with
36   - Tconstr(p, args, abbrev) ->
  34 + match scrape exp.exp_env exp.exp_type with
  35 + | Tconstr(p, args, abbrev) ->
37 36 not (Path.same p Predef.path_int) &&
38 37 not (Path.same p Predef.path_char) &&
39 38 begin try
@@ -50,9 +49,8 @@ let maybe_pointer exp =
50 49 | _ -> true
51 50
52 51 let array_element_kind env ty =
53   - let ty = Ctype.repr (Ctype.expand_head_opt env ty) in
54   - match ty.desc with
55   - Tvar | Tunivar ->
  52 + match scrape env ty with
  53 + | Tvar | Tunivar ->
56 54 Pgenarray
57 55 | Tconstr(p, args, abbrev) ->
58 56 if Path.same p Predef.path_int || Path.same p Predef.path_char then
@@ -85,9 +83,8 @@ let array_element_kind env ty =
85 83 Paddrarray
86 84
87 85 let array_kind_gen ty env =
88   - let array_ty = Ctype.expand_head_opt env (Ctype.correct_levels ty) in
89   - match (Ctype.repr array_ty).desc with
90   - Tconstr(p, [elt_ty], _) | Tpoly({desc = Tconstr(p, [elt_ty], _)}, _)
  86 + match scrape env ty with
  87 + | Tconstr(p, [elt_ty], _) | Tpoly({desc = Tconstr(p, [elt_ty], _)}, _)
91 88 when Path.same p Predef.path_array ->
92 89 array_element_kind env elt_ty
93 90 | _ ->
@@ -98,9 +95,9 @@ let array_kind exp = array_kind_gen exp.exp_type exp.exp_env
98 95
99 96 let array_pattern_kind pat = array_kind_gen pat.pat_type pat.pat_env
100 97
101   -let bigarray_decode_type ty tbl dfl =
102   - match (Ctype.repr ty).desc with
103   - Tconstr(Pdot(Pident mod_id, type_name, _), [], _)
  98 +let bigarray_decode_type env ty tbl dfl =
  99 + match scrape env ty with
  100 + | Tconstr(Pdot(Pident mod_id, type_name, _), [], _)
104 101 when Ident.name mod_id = "Bigarray" ->
105 102 begin try List.assoc type_name tbl with Not_found -> dfl end
106 103 | _ ->
@@ -125,10 +122,9 @@ let layout_table =
125 122 "fortran_layout", Pbigarray_fortran_layout]
126 123
127 124 let bigarray_kind_and_layout exp =
128   - let ty = Ctype.repr (Ctype.expand_head_opt exp.exp_env exp.exp_type) in
129   - match ty.desc with
130   - Tconstr(p, [caml_type; elt_type; layout_type], abbrev) ->
131   - (bigarray_decode_type elt_type kind_table Pbigarray_unknown,
132   - bigarray_decode_type layout_type layout_table Pbigarray_unknown_layout)
  125 + match scrape exp.exp_env exp.exp_type with
  126 + | Tconstr(p, [caml_type; elt_type; layout_type], abbrev) ->
  127 + (bigarray_decode_type exp.exp_env elt_type kind_table Pbigarray_unknown,
  128 + bigarray_decode_type exp.exp_env layout_type layout_table Pbigarray_unknown_layout)
133 129 | _ ->
134 130 (Pbigarray_unknown, Pbigarray_unknown_layout)
2  byterun/.cvsignore
@@ -15,3 +15,5 @@ interp.a.lst
15 15 *.[sd]obj
16 16 *.lib
17 17 .gdb_history
  18 +*.so
  19 +*.a
12 byterun/.depend
@@ -105,13 +105,13 @@ printexc.o: printexc.c backtrace.h mlvalues.h compatibility.h config.h \
105 105 roots.o: roots.c finalise.h roots.h misc.h compatibility.h config.h \
106 106 ../config/m.h ../config/s.h memory.h gc.h mlvalues.h major_gc.h \
107 107 freelist.h minor_gc.h globroots.h stacks.h
108   -signals_byt.o: signals_byt.c config.h ../config/m.h ../config/s.h \
109   - compatibility.h memory.h gc.h mlvalues.h misc.h major_gc.h freelist.h \
110   - minor_gc.h osdeps.h signals.h signals_machdep.h
111 108 signals.o: signals.c alloc.h compatibility.h misc.h config.h \
112 109 ../config/m.h ../config/s.h mlvalues.h callback.h fail.h memory.h gc.h \
113 110 major_gc.h freelist.h minor_gc.h roots.h signals.h signals_machdep.h \
114 111 sys.h
  112 +signals_byt.o: signals_byt.c config.h ../config/m.h ../config/s.h \
  113 + compatibility.h memory.h gc.h mlvalues.h misc.h major_gc.h freelist.h \
  114 + minor_gc.h osdeps.h signals.h signals_machdep.h
115 115 stacks.o: stacks.c config.h ../config/m.h ../config/s.h compatibility.h \
116 116 fail.h misc.h mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h \
117 117 minor_gc.h
@@ -243,13 +243,13 @@ printexc.d.o: printexc.c backtrace.h mlvalues.h compatibility.h config.h \
243 243 roots.d.o: roots.c finalise.h roots.h misc.h compatibility.h config.h \
244 244 ../config/m.h ../config/s.h memory.h gc.h mlvalues.h major_gc.h \
245 245 freelist.h minor_gc.h globroots.h stacks.h
246   -signals_byt.d.o: signals_byt.c config.h ../config/m.h ../config/s.h \
247   - compatibility.h memory.h gc.h mlvalues.h misc.h major_gc.h freelist.h \
248   - minor_gc.h osdeps.h signals.h signals_machdep.h
249 246 signals.d.o: signals.c alloc.h compatibility.h misc.h config.h \
250 247 ../config/m.h ../config/s.h mlvalues.h callback.h fail.h memory.h gc.h \
251 248 major_gc.h freelist.h minor_gc.h roots.h signals.h signals_machdep.h \
252 249 sys.h
  250 +signals_byt.d.o: signals_byt.c config.h ../config/m.h ../config/s.h \
  251 + compatibility.h memory.h gc.h mlvalues.h misc.h major_gc.h freelist.h \
  252 + minor_gc.h osdeps.h signals.h signals_machdep.h
253 253 stacks.d.o: stacks.c config.h ../config/m.h ../config/s.h compatibility.h \
254 254 fail.h misc.h mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h \
255 255 minor_gc.h
7 byterun/backtrace.c
@@ -39,6 +39,7 @@ CAMLexport int caml_backtrace_active = 0;
39 39 CAMLexport int caml_backtrace_pos = 0;
40 40 CAMLexport code_t * caml_backtrace_buffer = NULL;
41 41 CAMLexport value caml_backtrace_last_exn = Val_unit;
  42 +CAMLexport char * caml_cds_file = NULL;
42 43 #define BACKTRACE_BUFFER_SIZE 1024
43 44
44 45 /* Location of fields in the Instruct.debug_event record */
@@ -135,7 +136,11 @@ static value read_debug_info(void)
135 136 uint32 num_events, orig, i;
136 137 value evl, l;
137 138
138   - exec_name = caml_exe_name;
  139 + if (caml_cds_file != NULL) {
  140 + exec_name = caml_cds_file;
  141 + } else {
  142 + exec_name = caml_exe_name;
  143 + }
139 144 fd = caml_attempt_open(&exec_name, &trail, 1);
140 145 if (fd < 0) CAMLreturn(Val_false);
141 146 caml_read_section_descriptors(fd, &trail);
1  byterun/backtrace.h
@@ -22,6 +22,7 @@ CAMLextern int caml_backtrace_active;
22 22 CAMLextern int caml_backtrace_pos;
23 23 CAMLextern code_t * caml_backtrace_buffer;
24 24 CAMLextern value caml_backtrace_last_exn;
  25 +CAMLextern char * caml_cds_file;
25 26
26 27 CAMLprim value caml_record_backtrace(value vflag);
27 28 #ifndef NATIVE_CODE
2  byterun/gc_ctrl.c
@@ -419,7 +419,7 @@ static void test_and_compact (void)
419 419
420 420 fp = 100.0 * caml_fl_cur_size
421 421 / (Wsize_bsize (caml_stat_heap_size) - caml_fl_cur_size);
422   - if (fp > 1000000.0) fp = 1000000.0;
  422 + if (fp > 999999.0) fp = 999999.0;
423 423 caml_gc_message (0x200, "Estimated overhead (lower bound) = %"
424 424 ARCH_INTNAT_PRINTF_FORMAT "u%%\n",
425 425 (uintnat) fp);
3  byterun/interp.c
@@ -157,7 +157,8 @@ sp is a local copy of the global variable caml_extern_sp. */
157 157 #define SP_REG asm("a4")
158 158 #define ACCU_REG asm("d7")
159 159 #endif
160   -#ifdef __arm__
  160 +/* PR#4953: these specific registers not available in Thumb mode */
  161 +#if defined (__arm__) && !defined(__thumb__)
161 162 #define PC_REG asm("r6")
162 163 #define SP_REG asm("r8")
163 164 #define ACCU_REG asm("r7")
4 byterun/obj.c
@@ -165,6 +165,10 @@ CAMLprim value caml_obj_truncate (value v, value newsize)
165 165 return Val_unit;
166 166 }
167 167
  168 +CAMLprim value caml_obj_add_offset (value v, value offset)
  169 +{
  170 + return v + Int32_val (offset);
  171 +}
168 172
169 173 /* The following functions are used in stdlib/lazy.ml.
170 174 They are not written in O'Caml because they must be atomic with respect
32 byterun/startup.c
@@ -439,12 +439,18 @@ CAMLexport void caml_startup_code(
439 439 char **argv)
440 440 {
441 441 value res;
  442 + char* cds_file;
442 443
443 444 caml_init_ieee_floats();
444 445 caml_init_custom_operations();
445 446 #ifdef DEBUG
446 447 caml_verb_gc = 63;
447 448 #endif
  449 + cds_file = getenv("CAML_DEBUG_FILE");
  450 + if (cds_file != NULL) {
  451 + caml_cds_file = caml_stat_alloc(strlen(cds_file) + 1);
  452 + strcpy(caml_cds_file, cds_file);
  453 + }
448 454 parse_camlrunparam();
449 455 caml_external_raise = NULL;
450 456 /* Initialize the abstract machine */
@@ -454,8 +460,17 @@ CAMLexport void caml_startup_code(
454 460 init_atoms();
455 461 /* Initialize the interpreter */
456 462 caml_interprete(NULL, 0);
  463 + /* Initialize the debugger, if needed */
  464 + caml_debugger_init();
457 465 /* Load the code */
458 466 caml_start_code = code;
  467 + caml_code_size = code_size;
  468 + if (caml_debugger_in_use) {
  469 + int len, i;
  470 + len = code_size / sizeof(opcode_t);
  471 + caml_saved_code = (unsigned char *) caml_stat_alloc(len);
  472 + for (i = 0; i < len; i++) caml_saved_code[i] = caml_start_code[i];
  473 + }
459 474 #ifdef THREADED_CODE
460 475 caml_thread_code(caml_start_code, code_size);
461 476 #endif
@@ -469,10 +484,19 @@ CAMLexport void caml_startup_code(
469 484 /* Record the sections (for caml_get_section_table in meta.c) */
470 485 caml_section_table = section_table;
471 486 caml_section_table_size = section_table_size;
472   - /* Run the code */
  487 + /* Initialize system libraries */
473 488 caml_init_exceptions();
474 489 caml_sys_init("", argv);
475   - res = caml_interprete(caml_start_code, code_size);
476   - if (Is_exception_result(res))
477   - caml_fatal_uncaught_exception(Extract_exception(res));
  490 + /* Execute the program */
  491 + caml_debugger(PROGRAM_START);
  492 + res = caml_interprete(caml_start_code, caml_code_size);
  493 + if (Is_exception_result(res)) {
  494 + caml_exn_bucket = Extract_exception(res);
  495 + if (caml_debugger_in_use) {
  496 + caml_extern_sp = &caml_exn_bucket; /* The debugger needs the
  497 + exception value.*/
  498 + caml_debugger(UNCAUGHT_EXC);
  499 + }
  500 + caml_fatal_uncaught_exception(caml_exn_bucket);
  501 + }
478 502 }
2  camlp4/Makefile.ml
@@ -90,7 +90,7 @@ let may_define_unix = if windows then [] else ["-D UNIX"]
90 90
91 91 let () =
92 92 !options.ocaml_Flags ^= "-w Aler -warn-error Aler"^^
93   - (if getenv "DTYPES" "" <> "" then "-dtypes"
  93 + (if getenv "DTYPES" "" <> "" then "-annot"
94 94 else "");
95 95 !options.ocaml_P4 := camlp4boot_may_debug may_define_unix;
96 96 !options.ocaml_P4_opt := camlp4boot_may_debug ("-D OPT" :: may_define_unix);
10 config/Makefile-templ
@@ -78,10 +78,14 @@ SHARPBANGSCRIPTS=true
78 78 # Under FreeBSD:
79 79 #CPP=cpp -P
80 80
  81 +### Magic declarations for ocamlbuild -- leave unchanged
  82 +#ml let syslib x = "-l"^x;;
  83 +#ml let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
  84 +
81 85 ### How to invoke ranlib
82   -# BSD-style:
83   -#RANLIB=ranlib
84   -#RANLIBCMD=ranlib
  86 +RANLIB=ranlib