From c5cb9675064f274462a8d98e2b7063288f9fd32c Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones Date: Jun 16 2015 13:00:05 +0000 Subject: New upstream version: 4.02.2+rc1. - Dropped two aarch64 patches which are now included upstream. - Includes libasmrun_shared.so (RHBZ#1195025). --- diff --git a/0001-Don-t-ignore-.-configure-it-s-a-real-git-file.patch b/0001-Don-t-ignore-.-configure-it-s-a-real-git-file.patch index 38bf039..1c70c41 100644 --- a/0001-Don-t-ignore-.-configure-it-s-a-real-git-file.patch +++ b/0001-Don-t-ignore-.-configure-it-s-a-real-git-file.patch @@ -1,14 +1,14 @@ -From 607ae33eed09f9eafccda1276626e9c509dcbed1 Mon Sep 17 00:00:00 2001 +From b57c7d76ec960e35a6b227f8944e5956cb9b381b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 22:29:38 +0100 -Subject: [PATCH 01/18] Don't ignore ./configure, it's a real git file. +Subject: [PATCH 01/16] Don't ignore ./configure, it's a real git file. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore -index 6c66ecc..5d4b626 100644 +index 87f7cda..8aad7c2 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ diff --git a/0002-Ensure-empty-compilerlibs-directory-is-created-by-gi.patch b/0002-Ensure-empty-compilerlibs-directory-is-created-by-gi.patch index cb2c1ce..6323708 100644 --- a/0002-Ensure-empty-compilerlibs-directory-is-created-by-gi.patch +++ b/0002-Ensure-empty-compilerlibs-directory-is-created-by-gi.patch @@ -1,7 +1,7 @@ -From 89f29afc4aaa324585aa010289a4a58416d53700 Mon Sep 17 00:00:00 2001 +From 5afec587989790c5d3f8e0c215672d27aad6d6fe Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 7 Jun 2012 15:36:16 +0100 -Subject: [PATCH 02/18] Ensure empty compilerlibs/ directory is created by git. +Subject: [PATCH 02/16] Ensure empty compilerlibs/ directory is created by git. This directory exists in the OCaml tarball, but is empty. As a result, git ignores it unless we put a dummy file in it. diff --git a/0003-Don-t-add-rpaths-to-libraries.patch b/0003-Don-t-add-rpaths-to-libraries.patch index 158a687..a01b443 100644 --- a/0003-Don-t-add-rpaths-to-libraries.patch +++ b/0003-Don-t-add-rpaths-to-libraries.patch @@ -1,17 +1,17 @@ -From 10209519de242952ebdef608ab5f2f51a6c9e2b3 Mon Sep 17 00:00:00 2001 +From 738c7f82c8b5413d83b1599235cebada4bd022c0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 03/18] Don't add rpaths to libraries. +Subject: [PATCH 03/16] Don't add rpaths to libraries. --- tools/Makefile.shared | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/Makefile.shared b/tools/Makefile.shared -index 2517434..75a75b4 100644 +index 0b90cd3..dc48712 100644 --- a/tools/Makefile.shared +++ b/tools/Makefile.shared -@@ -112,9 +112,9 @@ ocamlmklibconfig.ml: ../config/Makefile +@@ -113,9 +113,9 @@ ocamlmklibconfig.ml: ../config/Makefile echo 'let ext_dll = "$(EXT_DLL)"'; \ echo 'let supports_shared_libraries = $(SUPPORTS_SHARED_LIBRARIES)';\ echo 'let mkdll = "$(MKDLL)"'; \ diff --git a/0004-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch b/0004-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch index 4f9e793..56c95b3 100644 --- a/0004-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch +++ b/0004-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch @@ -1,7 +1,7 @@ -From b360841d9b1eae64201d1ee7a1ff6dc5a5b0fa87 Mon Sep 17 00:00:00 2001 +From 15662574d75d041cc3a3a824ac70d6e78ecbb6d0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:40:36 +0100 -Subject: [PATCH 04/18] ocamlbyteinfo, ocamlplugininfo: Useful utilities from +Subject: [PATCH 04/16] ocamlbyteinfo, ocamlplugininfo: Useful utilities from Debian, sent upstream. See: diff --git a/0005-configure-Allow-user-defined-C-compiler-flags.patch b/0005-configure-Allow-user-defined-C-compiler-flags.patch index b29755f..7217642 100644 --- a/0005-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0005-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,17 +1,17 @@ -From 6193266853d3667f18048989ebaaa0cbcb74afb5 Mon Sep 17 00:00:00 2001 +From bf5117d9018ef5fe22e3ca7ac932eb0d31905028 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 05/18] configure: Allow user defined C compiler flags. +Subject: [PATCH 05/16] configure: Allow user defined C compiler flags. --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure -index 3edb9fd..18b95cd 100755 +index 4ea1498..d006010 100755 --- a/configure +++ b/configure -@@ -1654,6 +1654,10 @@ case "$buggycc" in +@@ -1701,6 +1701,10 @@ case "$buggycc" in nativecccompopts="$nativecccompopts -fomit-frame-pointer";; esac diff --git a/0006-Add-support-for-ppc64.patch b/0006-Add-support-for-ppc64.patch index d96a643..7fca771 100644 --- a/0006-Add-support-for-ppc64.patch +++ b/0006-Add-support-for-ppc64.patch @@ -1,7 +1,7 @@ -From 5022b33b094d5a88c5c372b0873d81023f0d7bb4 Mon Sep 17 00:00:00 2001 +From d6961d937fdb97bc119d31a2d3919a380cdc2b4a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:47:07 +0100 -Subject: [PATCH 06/18] Add support for ppc64. +Subject: [PATCH 06/16] Add support for ppc64. Note (1): This patch was rejected upstream because they don't have appropriate hardware for testing. @@ -1576,12 +1576,12 @@ index 0000000..53b7828 + +let fundecl f = (new selector)#emit_fundecl f diff --git a/asmrun/Makefile b/asmrun/Makefile -index 63ff80c..5da022c 100644 +index 37b6182..788fee9 100644 --- a/asmrun/Makefile +++ b/asmrun/Makefile -@@ -93,6 +93,12 @@ power.o: power-$(SYSTEM).o - power.p.o: power-$(SYSTEM).o - cp power-$(SYSTEM).o power.p.o +@@ -122,6 +122,12 @@ power.p.o: power-$(SYSTEM).o + power.pic.o: power-$(SYSTEM).pic.o + cp power-$(SYSTEM).pic.o power.pic.o +power64.o: power64-$(SYSTEM).o + cp power64-$(SYSTEM).o power64.o @@ -2085,7 +2085,7 @@ index 0000000..b2c24d6 + .align 3 + diff --git a/asmrun/stack.h b/asmrun/stack.h -index 92b3c28..5202c3a 100644 +index 6e55942..81263da 100644 --- a/asmrun/stack.h +++ b/asmrun/stack.h @@ -46,6 +46,15 @@ @@ -2105,10 +2105,10 @@ index 92b3c28..5202c3a 100644 #define Saved_return_address(sp) *((intnat *)((sp) - 4)) #define Callback_link(sp) ((struct caml_context *)((sp) + 8)) diff --git a/configure b/configure -index 18b95cd..57c8699 100755 +index d006010..cb289fb 100755 --- a/configure +++ b/configure -@@ -814,6 +814,7 @@ case "$target" in +@@ -843,6 +843,7 @@ case "$target" in fi;; i[3456]86-*-gnu*) arch=i386; system=gnu;; i[3456]86-*-mingw*) arch=i386; system=mingw;; @@ -2116,7 +2116,7 @@ index 18b95cd..57c8699 100755 powerpc*-*-linux*) arch=power; model=ppc; system=elf;; powerpc-*-netbsd*) arch=power; model=ppc; system=elf;; powerpc-*-openbsd*) arch=power; model=ppc; system=bsd_elf;; -@@ -894,6 +895,8 @@ case "$arch,$system" in +@@ -923,6 +924,8 @@ case "$arch,$system" in aspp="/usr/ccs/bin/${TOOLPREF}as -P";; power,elf) as="${TOOLPREF}as -u -m ppc" aspp="${TOOLPREF}gcc -c";; diff --git a/0007-ppc64-Update-for-OCaml-4.02.0.patch b/0007-ppc64-Update-for-OCaml-4.02.0.patch index 719f481..70ef205 100644 --- a/0007-ppc64-Update-for-OCaml-4.02.0.patch +++ b/0007-ppc64-Update-for-OCaml-4.02.0.patch @@ -1,7 +1,7 @@ -From 834644b81c536fc81022a0a13f860fb33e3d78d2 Mon Sep 17 00:00:00 2001 +From 755d197c3eca97f8b690d49917a42ef4c7287ce2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 24 Oct 2014 12:59:23 +0200 -Subject: [PATCH 07/18] ppc64: Update for OCaml 4.02.0. +Subject: [PATCH 07/16] ppc64: Update for OCaml 4.02.0. These are based on the power (ppc32) branch and some guesswork. In particular, I'm not convinced that my changes to floating diff --git a/0008-Add-support-for-ppc64le.patch b/0008-Add-support-for-ppc64le.patch index 223b625..716b314 100644 --- a/0008-Add-support-for-ppc64le.patch +++ b/0008-Add-support-for-ppc64le.patch @@ -1,7 +1,7 @@ -From c89bde7d3563e2c7bb725272334fabf53044bd9c Mon Sep 17 00:00:00 2001 +From 7a80efaf43d1832e9a53508835df61c0d43d1105 Mon Sep 17 00:00:00 2001 From: Michel Normand Date: Tue, 18 Mar 2014 09:15:47 -0400 -Subject: [PATCH 08/18] Add support for ppc64le. +Subject: [PATCH 08/16] Add support for ppc64le. Signed-off-by: Michel Normand --- @@ -1556,10 +1556,10 @@ index 0000000..6101d53 + +let fundecl f = (new selector)#emit_fundecl f diff --git a/asmrun/Makefile b/asmrun/Makefile -index 5da022c..c0362b6 100644 +index 788fee9..a63321e 100644 --- a/asmrun/Makefile +++ b/asmrun/Makefile -@@ -99,6 +99,12 @@ power64.o: power64-$(SYSTEM).o +@@ -128,6 +128,12 @@ power64.o: power64-$(SYSTEM).o power64.p.o: power64-$(SYSTEM).o cp power64-$(SYSTEM).o power64.p.o @@ -1858,7 +1858,7 @@ index 0000000..f49d00c +power64-elf.S \ No newline at end of file diff --git a/asmrun/stack.h b/asmrun/stack.h -index 5202c3a..94b81e4 100644 +index 81263da..e23da0c 100644 --- a/asmrun/stack.h +++ b/asmrun/stack.h @@ -55,6 +55,15 @@ @@ -1892,10 +1892,10 @@ index b79252d..049652e 100755 echo powerpc-unknown-linux-${LIBC} exit ;; diff --git a/configure b/configure -index 57c8699..c04272c 100755 +index cb289fb..6157157 100755 --- a/configure +++ b/configure -@@ -815,6 +815,7 @@ case "$target" in +@@ -844,6 +844,7 @@ case "$target" in i[3456]86-*-gnu*) arch=i386; system=gnu;; i[3456]86-*-mingw*) arch=i386; system=mingw;; powerpc64-*-linux*) arch=power64; model=ppc64; system=elf;; @@ -1903,7 +1903,7 @@ index 57c8699..c04272c 100755 powerpc*-*-linux*) arch=power; model=ppc; system=elf;; powerpc-*-netbsd*) arch=power; model=ppc; system=elf;; powerpc-*-openbsd*) arch=power; model=ppc; system=bsd_elf;; -@@ -897,6 +898,8 @@ case "$arch,$system" in +@@ -926,6 +927,8 @@ case "$arch,$system" in aspp="${TOOLPREF}gcc -c";; power64,elf) as='${TOOLPREF}as -u -m ppc64' aspp='${TOOLPREF}gcc -c';; diff --git a/0009-ppc64le-Update-for-OCaml-4.02.0.patch b/0009-ppc64le-Update-for-OCaml-4.02.0.patch index 7cd779d..e1cb455 100644 --- a/0009-ppc64le-Update-for-OCaml-4.02.0.patch +++ b/0009-ppc64le-Update-for-OCaml-4.02.0.patch @@ -1,7 +1,7 @@ -From 8d86aba4983a254f36f2f1758079b3099ba5fc07 Mon Sep 17 00:00:00 2001 +From c7ff29a506205aeb9c398e08bfd9c84954709c72 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 24 Oct 2014 12:59:23 +0200 -Subject: [PATCH 09/18] ppc64le: Update for OCaml 4.02.0. +Subject: [PATCH 09/16] ppc64le: Update for OCaml 4.02.0. These are based on the power (ppc32) branch and some guesswork. In particular, I'm not convinced that my changes to floating point diff --git a/0010-arm-arm64-Mark-stack-as-non-executable.patch b/0010-arm-arm64-Mark-stack-as-non-executable.patch index b7fef02..c278625 100644 --- a/0010-arm-arm64-Mark-stack-as-non-executable.patch +++ b/0010-arm-arm64-Mark-stack-as-non-executable.patch @@ -1,7 +1,7 @@ -From 4d08d0e8511e247a96440693b73773c72b04fee2 Mon Sep 17 00:00:00 2001 +From a917e3fed4c915c07b01ee07c17aeefd5500cd74 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 10 May 2014 03:20:35 -0400 -Subject: [PATCH 10/18] arm, arm64: Mark stack as non-executable. +Subject: [PATCH 10/16] arm, arm64: Mark stack as non-executable. The same fix as this one, which was only fully applied to i686 & x86-64: diff --git a/0011-arg-Add-no_arg-and-get_arg-helper-functions.patch b/0011-arg-Add-no_arg-and-get_arg-helper-functions.patch index c1eb577..998e062 100644 --- a/0011-arg-Add-no_arg-and-get_arg-helper-functions.patch +++ b/0011-arg-Add-no_arg-and-get_arg-helper-functions.patch @@ -1,7 +1,7 @@ -From 8ee89eee0500d17ffb91aa2febdeb6792ac53f27 Mon Sep 17 00:00:00 2001 +From bd549d61c9f6b2d20261afba90b33eb96612b7d6 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 1 Apr 2014 11:17:07 +0100 -Subject: [PATCH 11/18] arg: Add no_arg and get_arg helper functions. +Subject: [PATCH 11/16] arg: Add no_arg and get_arg helper functions. The no_arg function in this patch is a no-op. It will do something useful in the followups. diff --git a/0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch b/0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch index 9e3f866..080c543 100644 --- a/0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch +++ b/0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch @@ -1,7 +1,7 @@ -From 350eab7918f0adf385e01411ae6fed3e0579145f Mon Sep 17 00:00:00 2001 +From a743fad54d002ab6db941cfe249bfcefb55ae6f5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 1 Apr 2014 11:21:40 +0100 -Subject: [PATCH 12/18] arg: Allow flags such as --flag=arg as well as --flag +Subject: [PATCH 12/16] arg: Allow flags such as --flag=arg as well as --flag arg. Allow flags to be followed directly by their argument, separated by an '=' diff --git a/0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch b/0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch index 133f333..82b6319 100644 --- a/0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch +++ b/0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch @@ -1,7 +1,7 @@ -From 4072cbf56bba989f87783f285952d7227ba5898d Mon Sep 17 00:00:00 2001 +From 7fd0da10005641c51e7b69f47a4255b7321424d2 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 27 Aug 2014 09:58:33 +0000 -Subject: [PATCH 13/18] PR#6517: use ISO C99 types {,u}int{32,64}_t in +Subject: [PATCH 13/16] PR#6517: use ISO C99 types {,u}int{32,64}_t in preference to our homegrown types {,u}int{32,64}. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15131 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 @@ -17,31 +17,31 @@ See also: http://caml.inria.fr/mantis/view.php?id=6517 --- asmrun/backtrace.c | 6 +- - byterun/alloc.h | 4 +- byterun/backtrace.c | 2 +- - byterun/config.h | 35 +++++++---- - byterun/debugger.h | 28 ++++----- - byterun/exec.h | 4 +- + byterun/caml/alloc.h | 4 +- + byterun/caml/config.h | 35 +++++++---- + byterun/caml/debugger.h | 28 ++++----- + byterun/caml/exec.h | 4 +- + byterun/caml/hash.h | 12 ++-- + byterun/caml/int64_emul.h | 114 ++++++++++++++++++------------------ + byterun/caml/int64_format.h | 4 +- + byterun/caml/int64_native.h | 20 +++---- + byterun/caml/intext.h | 12 ++-- + byterun/caml/io.h | 6 +- + byterun/caml/md5.h | 6 +- + byterun/caml/mlvalues.h | 12 ++-- + byterun/caml/startup.h | 4 +- byterun/extern.c | 4 +- byterun/fix_code.c | 8 +-- byterun/floats.c | 6 +- byterun/globroots.c | 4 +- byterun/hash.c | 44 +++++++------- - byterun/hash.h | 12 ++-- - byterun/int64_emul.h | 114 ++++++++++++++++++------------------ - byterun/int64_format.h | 4 +- - byterun/int64_native.h | 20 +++---- byterun/intern.c | 20 +++---- byterun/interp.c | 2 +- - byterun/intext.h | 12 ++-- byterun/ints.c | 112 +++++++++++++++++------------------ byterun/io.c | 6 +- - byterun/io.h | 6 +- byterun/md5.c | 26 ++++---- - byterun/md5.h | 6 +- - byterun/mlvalues.h | 12 ++-- byterun/startup.c | 10 ++-- - byterun/startup.h | 4 +- byterun/str.c | 20 +++---- config/auto-aux/int64align.c | 14 ++--- config/s-nt.h | 3 + @@ -53,11 +53,11 @@ http://caml.inria.fr/mantis/view.php?id=6517 34 files changed, 319 insertions(+), 320 deletions(-) diff --git a/asmrun/backtrace.c b/asmrun/backtrace.c -index 05e0d6b..5eb8600 100644 +index fafe13a..498c91a 100644 --- a/asmrun/backtrace.c +++ b/asmrun/backtrace.c -@@ -217,7 +217,7 @@ static void extract_location_info(frame_descr * d, - /*out*/ struct loc_info * li) +@@ -208,7 +208,7 @@ CAMLexport void extract_location_info(frame_descr * d, + /*out*/ struct caml_loc_info * li) { uintnat infoptr; - uint32 info1, info2; @@ -65,7 +65,7 @@ index 05e0d6b..5eb8600 100644 /* If no debugging information available, print nothing. When everything is compiled with -g, this corresponds to -@@ -232,8 +232,8 @@ static void extract_location_info(frame_descr * d, +@@ -223,8 +223,8 @@ CAMLexport void extract_location_info(frame_descr * d, sizeof(char *) + sizeof(short) + sizeof(short) + sizeof(short) * d->num_live + sizeof(frame_descr *) - 1) & -sizeof(frame_descr *); @@ -76,23 +76,8 @@ index 05e0d6b..5eb8600 100644 /* Format of the two info words: llllllllllllllllllll aaaaaaaa bbbbbbbbbb nnnnnnnnnnnnnnnnnnnnnnnn kk 44 36 26 2 0 -diff --git a/byterun/alloc.h b/byterun/alloc.h -index f00a7ef..2a640eb 100644 ---- a/byterun/alloc.h -+++ b/byterun/alloc.h -@@ -32,8 +32,8 @@ CAMLextern value caml_alloc_string (mlsize_t); /* size in bytes */ - CAMLextern value caml_copy_string (char const *); - CAMLextern value caml_copy_string_array (char const **); - CAMLextern value caml_copy_double (double); --CAMLextern value caml_copy_int32 (int32); /* defined in [ints.c] */ --CAMLextern value caml_copy_int64 (int64); /* defined in [ints.c] */ -+CAMLextern value caml_copy_int32 (int32_t); /* defined in [ints.c] */ -+CAMLextern value caml_copy_int64 (int64_t); /* defined in [ints.c] */ - CAMLextern value caml_copy_nativeint (intnat); /* defined in [ints.c] */ - CAMLextern value caml_alloc_array (value (*funct) (char const *), - char const ** array); diff --git a/byterun/backtrace.c b/byterun/backtrace.c -index 76e3ddf..6ed56c8 100644 +index 008b199..b5672fe 100644 --- a/byterun/backtrace.c +++ b/byterun/backtrace.c @@ -229,7 +229,7 @@ static void read_debug_info(void) @@ -104,10 +89,25 @@ index 76e3ddf..6ed56c8 100644 intnat j; value evl, l, ev_start; -diff --git a/byterun/config.h b/byterun/config.h -index f775988..6c86d16 100644 ---- a/byterun/config.h -+++ b/byterun/config.h +diff --git a/byterun/caml/alloc.h b/byterun/caml/alloc.h +index f00a7ef..2a640eb 100644 +--- a/byterun/caml/alloc.h ++++ b/byterun/caml/alloc.h +@@ -32,8 +32,8 @@ CAMLextern value caml_alloc_string (mlsize_t); /* size in bytes */ + CAMLextern value caml_copy_string (char const *); + CAMLextern value caml_copy_string_array (char const **); + CAMLextern value caml_copy_double (double); +-CAMLextern value caml_copy_int32 (int32); /* defined in [ints.c] */ +-CAMLextern value caml_copy_int64 (int64); /* defined in [ints.c] */ ++CAMLextern value caml_copy_int32 (int32_t); /* defined in [ints.c] */ ++CAMLextern value caml_copy_int64 (int64_t); /* defined in [ints.c] */ + CAMLextern value caml_copy_nativeint (intnat); /* defined in [ints.c] */ + CAMLextern value caml_alloc_array (value (*funct) (char const *), + char const ** array); +diff --git a/byterun/caml/config.h b/byterun/caml/config.h +index 6f60836..cbe1999 100644 +--- a/byterun/caml/config.h ++++ b/byterun/caml/config.h @@ -25,24 +25,30 @@ #include "compatibility.h" #endif @@ -175,10 +175,10 @@ index f775988..6c86d16 100644 #define ARCH_INTNAT_PRINTF_FORMAT ARCH_INT64_PRINTF_FORMAT #else #error "No integer type available to represent pointers" -diff --git a/byterun/debugger.h b/byterun/debugger.h +diff --git a/byterun/caml/debugger.h b/byterun/caml/debugger.h index b5079eb..e68ef75 100644 ---- a/byterun/debugger.h -+++ b/byterun/debugger.h +--- a/byterun/caml/debugger.h ++++ b/byterun/caml/debugger.h @@ -37,17 +37,17 @@ void caml_debugger_cleanup_fork (void); /* Requests from the debugger to the runtime system */ @@ -250,10 +250,10 @@ index b5079eb..e68ef75 100644 - the value of the event counter - the position of the stack - the current pc. */ -diff --git a/byterun/exec.h b/byterun/exec.h +diff --git a/byterun/caml/exec.h b/byterun/caml/exec.h index a58bcf8..7e084ac 100644 ---- a/byterun/exec.h -+++ b/byterun/exec.h +--- a/byterun/caml/exec.h ++++ b/byterun/caml/exec.h @@ -39,13 +39,13 @@ struct section_descriptor { @@ -270,244 +270,13 @@ index a58bcf8..7e084ac 100644 char magic[12]; /* The magic number */ struct section_descriptor * section; /* Not part of file */ }; -diff --git a/byterun/extern.c b/byterun/extern.c -index 33fa89a..e67d7a3 100644 ---- a/byterun/extern.c -+++ b/byterun/extern.c -@@ -720,7 +720,7 @@ CAMLexport void caml_serialize_int_2(int i) - extern_ptr += 2; - } - --CAMLexport void caml_serialize_int_4(int32 i) -+CAMLexport void caml_serialize_int_4(int32_t i) - { - if (extern_ptr + 4 > extern_limit) grow_extern_output(4); - extern_ptr[0] = i >> 24; -@@ -730,7 +730,7 @@ CAMLexport void caml_serialize_int_4(int32 i) - extern_ptr += 4; - } - --CAMLexport void caml_serialize_int_8(int64 i) -+CAMLexport void caml_serialize_int_8(int64_t i) - { - caml_serialize_block_8(&i, 1); - } -diff --git a/byterun/fix_code.c b/byterun/fix_code.c -index 3380dc9..4fa0275 100644 ---- a/byterun/fix_code.c -+++ b/byterun/fix_code.c -@@ -134,12 +134,12 @@ void caml_thread_code (code_t code, asize_t len) - } - *p++ = (opcode_t)(caml_instr_table[instr] - caml_instr_base); - if (instr == SWITCH) { -- uint32 sizes = *p++; -- uint32 const_size = sizes & 0xFFFF; -- uint32 block_size = sizes >> 16; -+ uint32_t sizes = *p++; -+ uint32_t const_size = sizes & 0xFFFF; -+ uint32_t block_size = sizes >> 16; - p += const_size + block_size; - } else if (instr == CLOSUREREC) { -- uint32 nfuncs = *p++; -+ uint32_t nfuncs = *p++; - p++; /* skip nvars */ - p += nfuncs; - } else { -diff --git a/byterun/floats.c b/byterun/floats.c -index 7ff6d89..d8fdd05 100644 ---- a/byterun/floats.c -+++ b/byterun/floats.c -@@ -378,9 +378,9 @@ CAMLprim value caml_log1p_float(value f) - union double_as_two_int32 { - double d; - #if defined(ARCH_BIG_ENDIAN) || (defined(__arm__) && !defined(__ARM_EABI__)) -- struct { uint32 h; uint32 l; } i; -+ struct { uint32_t h; uint32_t l; } i; - #else -- struct { uint32 l; uint32 h; } i; -+ struct { uint32_t l; uint32_t h; } i; - #endif - }; - -@@ -467,7 +467,7 @@ CAMLprim value caml_classify_float(value vd) - } - #else - union double_as_two_int32 u; -- uint32 h, l; -+ uint32_t h, l; - - u.d = Double_val(vd); - h = u.i.h; l = u.i.l; -diff --git a/byterun/globroots.c b/byterun/globroots.c -index ded393e..d9111ee 100644 ---- a/byterun/globroots.c -+++ b/byterun/globroots.c -@@ -43,11 +43,11 @@ struct global_root_list { - (i.e. 2 * (NUM_LEVELS - 1)). Moreover, the congruential PRNG - is faster and guaranteed to be deterministic (to reproduce bugs). */ - --static uint32 random_seed = 0; -+static uint32_t random_seed = 0; - - static int random_level(void) - { -- uint32 r; -+ uint32_t r; - int level = 0; - - /* Linear congruence with modulus = 2^32, multiplier = 69069 -diff --git a/byterun/hash.c b/byterun/hash.c -index f896426..12912d3 100644 ---- a/byterun/hash.c -+++ b/byterun/hash.c -@@ -41,7 +41,7 @@ - h *= 0xc2b2ae35; \ - h ^= h >> 16; - --CAMLexport uint32 caml_hash_mix_uint32(uint32 h, uint32 d) -+CAMLexport uint32_t caml_hash_mix_uint32(uint32_t h, uint32_t d) - { - MIX(h, d); - return h; -@@ -49,17 +49,17 @@ CAMLexport uint32 caml_hash_mix_uint32(uint32 h, uint32 d) - - /* Mix a platform-native integer. */ - --CAMLexport uint32 caml_hash_mix_intnat(uint32 h, intnat d) -+CAMLexport uint32_t caml_hash_mix_intnat(uint32_t h, intnat d) - { -- uint32 n; -+ uint32_t n; - #ifdef ARCH_SIXTYFOUR - /* Mix the low 32 bits and the high 32 bits, in a way that preserves -- 32/64 compatibility: we want n = (uint32) d -+ 32/64 compatibility: we want n = (uint32_t) d - if d is in the range [-2^31, 2^31-1]. */ - n = (d >> 32) ^ (d >> 63) ^ d; - /* If 0 <= d < 2^31: d >> 32 = 0 d >> 63 = 0 - If -2^31 <= d < 0: d >> 32 = -1 d >> 63 = -1 -- In both cases, n = (uint32) d. */ -+ In both cases, n = (uint32_t) d. */ - #else - n = d; - #endif -@@ -69,9 +69,9 @@ CAMLexport uint32 caml_hash_mix_intnat(uint32 h, intnat d) - - /* Mix a 64-bit integer. */ - --CAMLexport uint32 caml_hash_mix_int64(uint32 h, int64 d) -+CAMLexport uint32_t caml_hash_mix_int64(uint32_t h, int64_t d) - { -- uint32 hi = (uint32) (d >> 32), lo = (uint32) d; -+ uint32_t hi = (uint32_t) (d >> 32), lo = (uint32_t) d; - MIX(h, lo); - MIX(h, hi); - return h; -@@ -82,17 +82,17 @@ CAMLexport uint32 caml_hash_mix_int64(uint32 h, int64 d) - Treats all NaNs identically. - */ - --CAMLexport uint32 caml_hash_mix_double(uint32 hash, double d) -+CAMLexport uint32_t caml_hash_mix_double(uint32_t hash, double d) - { - union { - double d; - #if defined(ARCH_BIG_ENDIAN) || (defined(__arm__) && !defined(__ARM_EABI__)) -- struct { uint32 h; uint32 l; } i; -+ struct { uint32_t h; uint32_t l; } i; - #else -- struct { uint32 l; uint32 h; } i; -+ struct { uint32_t l; uint32_t h; } i; - #endif - } u; -- uint32 h, l; -+ uint32_t h, l; - /* Convert to two 32-bit halves */ - u.d = d; - h = u.i.h; l = u.i.l; -@@ -115,14 +115,14 @@ CAMLexport uint32 caml_hash_mix_double(uint32 hash, double d) - Treats all NaNs identically. - */ - --CAMLexport uint32 caml_hash_mix_float(uint32 hash, float d) -+CAMLexport uint32_t caml_hash_mix_float(uint32_t hash, float d) - { - union { - float f; -- uint32 i; -+ uint32_t i; - } u; -- uint32 n; -- /* Convert to int32 */ -+ uint32_t n; -+ /* Convert to int32_t */ - u.f = d; n = u.i; - /* Normalize NaNs */ - if ((n & 0x7F800000) == 0x7F800000 && (n & 0x007FFFFF) != 0) { -@@ -138,11 +138,11 @@ CAMLexport uint32 caml_hash_mix_float(uint32 hash, float d) - - /* Mix an OCaml string */ - --CAMLexport uint32 caml_hash_mix_string(uint32 h, value s) -+CAMLexport uint32_t caml_hash_mix_string(uint32_t h, value s) - { - mlsize_t len = caml_string_length(s); - mlsize_t i; -- uint32 w; -+ uint32_t w; - - /* Mix by 32-bit blocks (little-endian) */ - for (i = 0; i + 4 <= len; i += 4) { -@@ -152,7 +152,7 @@ CAMLexport uint32 caml_hash_mix_string(uint32 h, value s) - | (Byte_u(s, i+2) << 16) - | (Byte_u(s, i+3) << 24); - #else -- w = *((uint32 *) &Byte_u(s, i)); -+ w = *((uint32_t *) &Byte_u(s, i)); - #endif - MIX(h, w); - } -@@ -166,7 +166,7 @@ CAMLexport uint32 caml_hash_mix_string(uint32 h, value s) - default: /*skip*/; /* len & 3 == 0, no extra bytes, do nothing */ - } - /* Finally, mix in the length. Ignore the upper 32 bits, generally 0. */ -- h ^= (uint32) len; -+ h ^= (uint32_t) len; - return h; - } - -@@ -184,7 +184,7 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj) - intnat wr; /* One past position of last value in queue */ - intnat sz; /* Max number of values to put in queue */ - intnat num; /* Max number of meaningful values to see */ -- uint32 h; /* Rolling hash */ -+ uint32_t h; /* Rolling hash */ - value v; - mlsize_t i, len; - -@@ -245,7 +245,7 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj) - /* If no hashing function provided, do nothing. */ - /* Only use low 32 bits of custom hash, for 32/64 compatibility */ - if (Custom_ops_val(v)->hash != NULL) { -- uint32 n = (uint32) Custom_ops_val(v)->hash(v); -+ uint32_t n = (uint32_t) Custom_ops_val(v)->hash(v); - h = caml_hash_mix_uint32(h, n); - num--; - } -@@ -408,5 +408,5 @@ CAMLexport value caml_hash_variant(char const * tag) +diff --git a/byterun/caml/hash.h b/byterun/caml/hash.h +index 452a092..ee82a4c 100644 +--- a/byterun/caml/hash.h ++++ b/byterun/caml/hash.h +@@ -22,12 +22,12 @@ + extern "C" { #endif - /* Force sign extension of bit 31 for compatibility between 32 and 64-bit - platforms */ -- return (int32) accu; -+ return (int32_t) accu; - } -diff --git a/byterun/hash.h b/byterun/hash.h -index 436a8bb..6561397 100644 ---- a/byterun/hash.h -+++ b/byterun/hash.h -@@ -18,12 +18,12 @@ - - #include "mlvalues.h" -CAMLextern uint32 caml_hash_mix_uint32(uint32 h, uint32 d); -CAMLextern uint32 caml_hash_mix_intnat(uint32 h, intnat d); @@ -522,12 +291,12 @@ index 436a8bb..6561397 100644 +CAMLextern uint32_t caml_hash_mix_float(uint32_t h, float d); +CAMLextern uint32_t caml_hash_mix_string(uint32_t h, value s); - - #endif -diff --git a/byterun/int64_emul.h b/byterun/int64_emul.h + #ifdef __cplusplus + } +diff --git a/byterun/caml/int64_emul.h b/byterun/caml/int64_emul.h index ba7904a..2554df1 100644 ---- a/byterun/int64_emul.h -+++ b/byterun/int64_emul.h +--- a/byterun/caml/int64_emul.h ++++ b/byterun/caml/int64_emul.h @@ -28,7 +28,7 @@ #define I64_split(x,hi,lo) (hi = (x).h, lo = (x).l) @@ -809,81 +578,450 @@ index ba7904a..2554df1 100644 res.h = (((x.l & 0x000000FF) << 24) | ((x.l & 0x0000FF00) << 8) | ((x.l & 0x00FF0000) >> 8) | -diff --git a/byterun/int64_format.h b/byterun/int64_format.h +diff --git a/byterun/caml/int64_format.h b/byterun/caml/int64_format.h index b0de527..aa8f1ab 100644 ---- a/byterun/int64_format.h -+++ b/byterun/int64_format.h +--- a/byterun/caml/int64_format.h ++++ b/byterun/caml/int64_format.h @@ -17,7 +17,7 @@ #ifndef CAML_INT64_FORMAT_H #define CAML_INT64_FORMAT_H --static void I64_format(char * buffer, char * fmt, int64 x) -+static void I64_format(char * buffer, char * fmt, int64_t x) +-static void I64_format(char * buffer, char * fmt, int64 x) ++static void I64_format(char * buffer, char * fmt, int64_t x) + { + static char conv_lower[] = "0123456789abcdef"; + static char conv_upper[] = "0123456789ABCDEF"; +@@ -26,7 +26,7 @@ static void I64_format(char * buffer, char * fmt, int64 x) + int base, width, sign, i, rawlen; + char * cvtbl; + char * p, * r; +- int64 wbase, digit; ++ int64_t wbase, digit; + + /* Parsing of format */ + justify = '+'; +diff --git a/byterun/caml/int64_native.h b/byterun/caml/int64_native.h +index e9ffe67..b6716ad 100644 +--- a/byterun/caml/int64_native.h ++++ b/byterun/caml/int64_native.h +@@ -18,36 +18,36 @@ + #ifndef CAML_INT64_NATIVE_H + #define CAML_INT64_NATIVE_H + +-#define I64_literal(hi,lo) ((int64)(hi) << 32 | (lo)) +-#define I64_split(x,hi,lo) (hi = (uint32)((x)>>32), lo = (uint32)(x)) ++#define I64_literal(hi,lo) ((int64_t)(hi) << 32 | (lo)) ++#define I64_split(x,hi,lo) (hi = (uint32_t)((x)>>32), lo = (uint32_t)(x)) + #define I64_compare(x,y) (((x) > (y)) - ((x) < (y))) +-#define I64_ult(x,y) ((uint64)(x) < (uint64)(y)) ++#define I64_ult(x,y) ((uint64_t)(x) < (uint64_t)(y)) + #define I64_neg(x) (-(x)) + #define I64_add(x,y) ((x) + (y)) + #define I64_sub(x,y) ((x) - (y)) + #define I64_mul(x,y) ((x) * (y)) + #define I64_is_zero(x) ((x) == 0) + #define I64_is_negative(x) ((x) < 0) +-#define I64_is_min_int(x) ((x) == ((int64)1 << 63)) ++#define I64_is_min_int(x) ((x) == ((int64_t)1 << 63)) + #define I64_is_minus_one(x) ((x) == -1) + + #define I64_div(x,y) ((x) / (y)) + #define I64_mod(x,y) ((x) % (y)) + #define I64_udivmod(x,y,quo,rem) \ +- (*(rem) = (uint64)(x) % (uint64)(y), \ +- *(quo) = (uint64)(x) / (uint64)(y)) ++ (*(rem) = (uint64_t)(x) % (uint64_t)(y), \ ++ *(quo) = (uint64_t)(x) / (uint64_t)(y)) + #define I64_and(x,y) ((x) & (y)) + #define I64_or(x,y) ((x) | (y)) + #define I64_xor(x,y) ((x) ^ (y)) + #define I64_lsl(x,y) ((x) << (y)) + #define I64_asr(x,y) ((x) >> (y)) +-#define I64_lsr(x,y) ((uint64)(x) >> (y)) ++#define I64_lsr(x,y) ((uint64_t)(x) >> (y)) + #define I64_to_intnat(x) ((intnat) (x)) + #define I64_of_intnat(x) ((intnat) (x)) +-#define I64_to_int32(x) ((int32) (x)) +-#define I64_of_int32(x) ((int64) (x)) ++#define I64_to_int32(x) ((int32_t) (x)) ++#define I64_of_int32(x) ((int64_t) (x)) + #define I64_to_double(x) ((double)(x)) +-#define I64_of_double(x) ((int64)(x)) ++#define I64_of_double(x) ((int64_t)(x)) + + #define I64_bswap(x) ((((x) & 0x00000000000000FFULL) << 56) | \ + (((x) & 0x000000000000FF00ULL) << 40) | \ +diff --git a/byterun/caml/intext.h b/byterun/caml/intext.h +index f7aa655..2c108a4 100644 +--- a/byterun/caml/intext.h ++++ b/byterun/caml/intext.h +@@ -119,8 +119,8 @@ CAMLextern value caml_input_value_from_block(char * data, intnat len); + + CAMLextern void caml_serialize_int_1(int i); + CAMLextern void caml_serialize_int_2(int i); +-CAMLextern void caml_serialize_int_4(int32 i); +-CAMLextern void caml_serialize_int_8(int64 i); ++CAMLextern void caml_serialize_int_4(int32_t i); ++CAMLextern void caml_serialize_int_8(int64_t i); + CAMLextern void caml_serialize_float_4(float f); + CAMLextern void caml_serialize_float_8(double f); + CAMLextern void caml_serialize_block_1(void * data, intnat len); +@@ -133,10 +133,10 @@ CAMLextern int caml_deserialize_uint_1(void); + CAMLextern int caml_deserialize_sint_1(void); + CAMLextern int caml_deserialize_uint_2(void); + CAMLextern int caml_deserialize_sint_2(void); +-CAMLextern uint32 caml_deserialize_uint_4(void); +-CAMLextern int32 caml_deserialize_sint_4(void); +-CAMLextern uint64 caml_deserialize_uint_8(void); +-CAMLextern int64 caml_deserialize_sint_8(void); ++CAMLextern uint32_t caml_deserialize_uint_4(void); ++CAMLextern int32_t caml_deserialize_sint_4(void); ++CAMLextern uint64_t caml_deserialize_uint_8(void); ++CAMLextern int64_t caml_deserialize_sint_8(void); + CAMLextern float caml_deserialize_float_4(void); + CAMLextern double caml_deserialize_float_8(void); + CAMLextern void caml_deserialize_block_1(void * data, intnat len); +diff --git a/byterun/caml/io.h b/byterun/caml/io.h +index 64a8bf5..5a9c037 100644 +--- a/byterun/caml/io.h ++++ b/byterun/caml/io.h +@@ -78,12 +78,12 @@ CAMLextern value caml_alloc_channel(struct channel *chan); + + CAMLextern int caml_flush_partial (struct channel *); + CAMLextern void caml_flush (struct channel *); +-CAMLextern void caml_putword (struct channel *, uint32); ++CAMLextern void caml_putword (struct channel *, uint32_t); + CAMLextern int caml_putblock (struct channel *, char *, intnat); + CAMLextern void caml_really_putblock (struct channel *, char *, intnat); + + CAMLextern unsigned char caml_refill (struct channel *); +-CAMLextern uint32 caml_getword (struct channel *); ++CAMLextern uint32_t caml_getword (struct channel *); + CAMLextern int caml_getblock (struct channel *, char *, intnat); + CAMLextern int caml_really_getblock (struct channel *, char *, intnat); + +@@ -107,7 +107,7 @@ CAMLextern struct channel * caml_all_opened_channels; + #define Unlock_exn() \ + if (caml_channel_mutex_unlock_exn != NULL) (*caml_channel_mutex_unlock_exn)() + +-/* Conversion between file_offset and int64 */ ++/* Conversion between file_offset and int64_t */ + + #define Val_file_offset(fofs) caml_copy_int64(fofs) + #define File_offset_val(v) ((file_offset) Int64_val(v)) +diff --git a/byterun/caml/md5.h b/byterun/caml/md5.h +index d8aff09..f63667d 100644 +--- a/byterun/caml/md5.h ++++ b/byterun/caml/md5.h +@@ -26,8 +26,8 @@ CAMLextern void caml_md5_block(unsigned char digest[16], + void * data, uintnat len); + + struct MD5Context { +- uint32 buf[4]; +- uint32 bits[2]; ++ uint32_t buf[4]; ++ uint32_t bits[2]; + unsigned char in[64]; + }; + +@@ -35,7 +35,7 @@ CAMLextern void caml_MD5Init (struct MD5Context *context); + CAMLextern void caml_MD5Update (struct MD5Context *context, unsigned char *buf, + uintnat len); + CAMLextern void caml_MD5Final (unsigned char *digest, struct MD5Context *ctx); +-CAMLextern void caml_MD5Transform (uint32 *buf, uint32 *in); ++CAMLextern void caml_MD5Transform (uint32_t *buf, uint32_t *in); + + + #endif /* CAML_MD5_H */ +diff --git a/byterun/caml/mlvalues.h b/byterun/caml/mlvalues.h +index fe4a8f0..0735692 100644 +--- a/byterun/caml/mlvalues.h ++++ b/byterun/caml/mlvalues.h +@@ -38,8 +38,8 @@ extern "C" { + bp: Pointer to the first byte of a block. (a char *) + op: Pointer to the first field of a block. (a value *) + hp: Pointer to the header of a block. (a char *) +- int32: Four bytes on all architectures. +- int64: Eight bytes on all architectures. ++ int32_t: Four bytes on all architectures. ++ int64_t: Eight bytes on all architectures. + + Remark: A block size is always a multiple of the word size, and at least + one word plus the header. +@@ -161,7 +161,7 @@ bits 63 10 9 8 7 0 + /* Fields are numbered from 0. */ + #define Field(x, i) (((value *)(x)) [i]) /* Also an l-value. */ + +-typedef int32 opcode_t; ++typedef int32_t opcode_t; + typedef opcode_t * code_t; + + /* NOTE: [Forward_tag] and [Infix_tag] must be just under +@@ -262,12 +262,12 @@ struct custom_operations; /* defined in [custom.h] */ + + /* Int32.t, Int64.t and Nativeint.t are represented as custom blocks. */ + +-#define Int32_val(v) (*((int32 *) Data_custom_val(v))) ++#define Int32_val(v) (*((int32_t *) Data_custom_val(v))) + #define Nativeint_val(v) (*((intnat *) Data_custom_val(v))) + #ifndef ARCH_ALIGN_INT64 +-#define Int64_val(v) (*((int64 *) Data_custom_val(v))) ++#define Int64_val(v) (*((int64_t *) Data_custom_val(v))) + #else +-CAMLextern int64 caml_Int64_val(value v); ++CAMLextern int64_t caml_Int64_val(value v); + #define Int64_val(v) caml_Int64_val(v) + #endif + +diff --git a/byterun/caml/startup.h b/byterun/caml/startup.h +index 3dda64b..3268d88 100644 +--- a/byterun/caml/startup.h ++++ b/byterun/caml/startup.h +@@ -30,9 +30,9 @@ enum { FILE_NOT_FOUND = -1, BAD_BYTECODE = -2 }; + extern int caml_attempt_open(char **name, struct exec_trailer *trail, + int do_open_script); + extern void caml_read_section_descriptors(int fd, struct exec_trailer *trail); +-extern int32 caml_seek_optional_section(int fd, struct exec_trailer *trail, ++extern int32_t caml_seek_optional_section(int fd, struct exec_trailer *trail, + char *name); +-extern int32 caml_seek_section(int fd, struct exec_trailer *trail, char *name); ++extern int32_t caml_seek_section(int fd, struct exec_trailer *trail, char *name); + + + #endif /* CAML_STARTUP_H */ +diff --git a/byterun/extern.c b/byterun/extern.c +index 5965b8d..9b47d44 100644 +--- a/byterun/extern.c ++++ b/byterun/extern.c +@@ -720,7 +720,7 @@ CAMLexport void caml_serialize_int_2(int i) + extern_ptr += 2; + } + +-CAMLexport void caml_serialize_int_4(int32 i) ++CAMLexport void caml_serialize_int_4(int32_t i) + { + if (extern_ptr + 4 > extern_limit) grow_extern_output(4); + extern_ptr[0] = i >> 24; +@@ -730,7 +730,7 @@ CAMLexport void caml_serialize_int_4(int32 i) + extern_ptr += 4; + } + +-CAMLexport void caml_serialize_int_8(int64 i) ++CAMLexport void caml_serialize_int_8(int64_t i) + { + caml_serialize_block_8(&i, 1); + } +diff --git a/byterun/fix_code.c b/byterun/fix_code.c +index 95a7591..e605290 100644 +--- a/byterun/fix_code.c ++++ b/byterun/fix_code.c +@@ -145,12 +145,12 @@ void caml_thread_code (code_t code, asize_t len) + } + *p++ = (opcode_t)(caml_instr_table[instr] - caml_instr_base); + if (instr == SWITCH) { +- uint32 sizes = *p++; +- uint32 const_size = sizes & 0xFFFF; +- uint32 block_size = sizes >> 16; ++ uint32_t sizes = *p++; ++ uint32_t const_size = sizes & 0xFFFF; ++ uint32_t block_size = sizes >> 16; + p += const_size + block_size; + } else if (instr == CLOSUREREC) { +- uint32 nfuncs = *p++; ++ uint32_t nfuncs = *p++; + p++; /* skip nvars */ + p += nfuncs; + } else { +diff --git a/byterun/floats.c b/byterun/floats.c +index de18c33..544dc06 100644 +--- a/byterun/floats.c ++++ b/byterun/floats.c +@@ -379,9 +379,9 @@ CAMLprim value caml_log1p_float(value f) + union double_as_two_int32 { + double d; + #if defined(ARCH_BIG_ENDIAN) || (defined(__arm__) && !defined(__ARM_EABI__)) +- struct { uint32 h; uint32 l; } i; ++ struct { uint32_t h; uint32_t l; } i; + #else +- struct { uint32 l; uint32 h; } i; ++ struct { uint32_t l; uint32_t h; } i; + #endif + }; + +@@ -469,7 +469,7 @@ CAMLprim value caml_classify_float(value vd) + } + #else + union double_as_two_int32 u; +- uint32 h, l; ++ uint32_t h, l; + + u.d = Double_val(vd); + h = u.i.h; l = u.i.l; +diff --git a/byterun/globroots.c b/byterun/globroots.c +index d3dd925..b2770e3 100644 +--- a/byterun/globroots.c ++++ b/byterun/globroots.c +@@ -43,11 +43,11 @@ struct global_root_list { + (i.e. 2 * (NUM_LEVELS - 1)). Moreover, the congruential PRNG + is faster and guaranteed to be deterministic (to reproduce bugs). */ + +-static uint32 random_seed = 0; ++static uint32_t random_seed = 0; + + static int random_level(void) + { +- uint32 r; ++ uint32_t r; + int level = 0; + + /* Linear congruence with modulus = 2^32, multiplier = 69069 +diff --git a/byterun/hash.c b/byterun/hash.c +index 8663a3d..e6be1ae 100644 +--- a/byterun/hash.c ++++ b/byterun/hash.c +@@ -41,7 +41,7 @@ + h *= 0xc2b2ae35; \ + h ^= h >> 16; + +-CAMLexport uint32 caml_hash_mix_uint32(uint32 h, uint32 d) ++CAMLexport uint32_t caml_hash_mix_uint32(uint32_t h, uint32_t d) + { + MIX(h, d); + return h; +@@ -49,17 +49,17 @@ CAMLexport uint32 caml_hash_mix_uint32(uint32 h, uint32 d) + + /* Mix a platform-native integer. */ + +-CAMLexport uint32 caml_hash_mix_intnat(uint32 h, intnat d) ++CAMLexport uint32_t caml_hash_mix_intnat(uint32_t h, intnat d) + { +- uint32 n; ++ uint32_t n; + #ifdef ARCH_SIXTYFOUR + /* Mix the low 32 bits and the high 32 bits, in a way that preserves +- 32/64 compatibility: we want n = (uint32) d ++ 32/64 compatibility: we want n = (uint32_t) d + if d is in the range [-2^31, 2^31-1]. */ + n = (d >> 32) ^ (d >> 63) ^ d; + /* If 0 <= d < 2^31: d >> 32 = 0 d >> 63 = 0 + If -2^31 <= d < 0: d >> 32 = -1 d >> 63 = -1 +- In both cases, n = (uint32) d. */ ++ In both cases, n = (uint32_t) d. */ + #else + n = d; + #endif +@@ -69,9 +69,9 @@ CAMLexport uint32 caml_hash_mix_intnat(uint32 h, intnat d) + + /* Mix a 64-bit integer. */ + +-CAMLexport uint32 caml_hash_mix_int64(uint32 h, int64 d) ++CAMLexport uint32_t caml_hash_mix_int64(uint32_t h, int64_t d) + { +- uint32 hi = (uint32) (d >> 32), lo = (uint32) d; ++ uint32_t hi = (uint32_t) (d >> 32), lo = (uint32_t) d; + MIX(h, lo); + MIX(h, hi); + return h; +@@ -82,17 +82,17 @@ CAMLexport uint32 caml_hash_mix_int64(uint32 h, int64 d) + Treats all NaNs identically. + */ + +-CAMLexport uint32 caml_hash_mix_double(uint32 hash, double d) ++CAMLexport uint32_t caml_hash_mix_double(uint32_t hash, double d) + { + union { + double d; + #if defined(ARCH_BIG_ENDIAN) || (defined(__arm__) && !defined(__ARM_EABI__)) +- struct { uint32 h; uint32 l; } i; ++ struct { uint32_t h; uint32_t l; } i; + #else +- struct { uint32 l; uint32 h; } i; ++ struct { uint32_t l; uint32_t h; } i; + #endif + } u; +- uint32 h, l; ++ uint32_t h, l; + /* Convert to two 32-bit halves */ + u.d = d; + h = u.i.h; l = u.i.l; +@@ -115,14 +115,14 @@ CAMLexport uint32 caml_hash_mix_double(uint32 hash, double d) + Treats all NaNs identically. + */ + +-CAMLexport uint32 caml_hash_mix_float(uint32 hash, float d) ++CAMLexport uint32_t caml_hash_mix_float(uint32_t hash, float d) { - static char conv_lower[] = "0123456789abcdef"; - static char conv_upper[] = "0123456789ABCDEF"; -@@ -26,7 +26,7 @@ static void I64_format(char * buffer, char * fmt, int64 x) - int base, width, sign, i, rawlen; - char * cvtbl; - char * p, * r; -- int64 wbase, digit; -+ int64_t wbase, digit; + union { + float f; +- uint32 i; ++ uint32_t i; + } u; +- uint32 n; +- /* Convert to int32 */ ++ uint32_t n; ++ /* Convert to int32_t */ + u.f = d; n = u.i; + /* Normalize NaNs */ + if ((n & 0x7F800000) == 0x7F800000 && (n & 0x007FFFFF) != 0) { +@@ -138,11 +138,11 @@ CAMLexport uint32 caml_hash_mix_float(uint32 hash, float d) - /* Parsing of format */ - justify = '+'; -diff --git a/byterun/int64_native.h b/byterun/int64_native.h -index e9ffe67..b6716ad 100644 ---- a/byterun/int64_native.h -+++ b/byterun/int64_native.h -@@ -18,36 +18,36 @@ - #ifndef CAML_INT64_NATIVE_H - #define CAML_INT64_NATIVE_H + /* Mix an OCaml string */ --#define I64_literal(hi,lo) ((int64)(hi) << 32 | (lo)) --#define I64_split(x,hi,lo) (hi = (uint32)((x)>>32), lo = (uint32)(x)) -+#define I64_literal(hi,lo) ((int64_t)(hi) << 32 | (lo)) -+#define I64_split(x,hi,lo) (hi = (uint32_t)((x)>>32), lo = (uint32_t)(x)) - #define I64_compare(x,y) (((x) > (y)) - ((x) < (y))) --#define I64_ult(x,y) ((uint64)(x) < (uint64)(y)) -+#define I64_ult(x,y) ((uint64_t)(x) < (uint64_t)(y)) - #define I64_neg(x) (-(x)) - #define I64_add(x,y) ((x) + (y)) - #define I64_sub(x,y) ((x) - (y)) - #define I64_mul(x,y) ((x) * (y)) - #define I64_is_zero(x) ((x) == 0) - #define I64_is_negative(x) ((x) < 0) --#define I64_is_min_int(x) ((x) == ((int64)1 << 63)) -+#define I64_is_min_int(x) ((x) == ((int64_t)1 << 63)) - #define I64_is_minus_one(x) ((x) == -1) +-CAMLexport uint32 caml_hash_mix_string(uint32 h, value s) ++CAMLexport uint32_t caml_hash_mix_string(uint32_t h, value s) + { + mlsize_t len = caml_string_length(s); + mlsize_t i; +- uint32 w; ++ uint32_t w; - #define I64_div(x,y) ((x) / (y)) - #define I64_mod(x,y) ((x) % (y)) - #define I64_udivmod(x,y,quo,rem) \ -- (*(rem) = (uint64)(x) % (uint64)(y), \ -- *(quo) = (uint64)(x) / (uint64)(y)) -+ (*(rem) = (uint64_t)(x) % (uint64_t)(y), \ -+ *(quo) = (uint64_t)(x) / (uint64_t)(y)) - #define I64_and(x,y) ((x) & (y)) - #define I64_or(x,y) ((x) | (y)) - #define I64_xor(x,y) ((x) ^ (y)) - #define I64_lsl(x,y) ((x) << (y)) - #define I64_asr(x,y) ((x) >> (y)) --#define I64_lsr(x,y) ((uint64)(x) >> (y)) -+#define I64_lsr(x,y) ((uint64_t)(x) >> (y)) - #define I64_to_intnat(x) ((intnat) (x)) - #define I64_of_intnat(x) ((intnat) (x)) --#define I64_to_int32(x) ((int32) (x)) --#define I64_of_int32(x) ((int64) (x)) -+#define I64_to_int32(x) ((int32_t) (x)) -+#define I64_of_int32(x) ((int64_t) (x)) - #define I64_to_double(x) ((double)(x)) --#define I64_of_double(x) ((int64)(x)) -+#define I64_of_double(x) ((int64_t)(x)) + /* Mix by 32-bit blocks (little-endian) */ + for (i = 0; i + 4 <= len; i += 4) { +@@ -152,7 +152,7 @@ CAMLexport uint32 caml_hash_mix_string(uint32 h, value s) + | (Byte_u(s, i+2) << 16) + | (Byte_u(s, i+3) << 24); + #else +- w = *((uint32 *) &Byte_u(s, i)); ++ w = *((uint32_t *) &Byte_u(s, i)); + #endif + MIX(h, w); + } +@@ -166,7 +166,7 @@ CAMLexport uint32 caml_hash_mix_string(uint32 h, value s) + default: /*skip*/; /* len & 3 == 0, no extra bytes, do nothing */ + } + /* Finally, mix in the length. Ignore the upper 32 bits, generally 0. */ +- h ^= (uint32) len; ++ h ^= (uint32_t) len; + return h; + } - #define I64_bswap(x) ((((x) & 0x00000000000000FFULL) << 56) | \ - (((x) & 0x000000000000FF00ULL) << 40) | \ +@@ -184,7 +184,7 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj) + intnat wr; /* One past position of last value in queue */ + intnat sz; /* Max number of values to put in queue */ + intnat num; /* Max number of meaningful values to see */ +- uint32 h; /* Rolling hash */ ++ uint32_t h; /* Rolling hash */ + value v; + mlsize_t i, len; + +@@ -245,7 +245,7 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj) + /* If no hashing function provided, do nothing. */ + /* Only use low 32 bits of custom hash, for 32/64 compatibility */ + if (Custom_ops_val(v)->hash != NULL) { +- uint32 n = (uint32) Custom_ops_val(v)->hash(v); ++ uint32_t n = (uint32_t) Custom_ops_val(v)->hash(v); + h = caml_hash_mix_uint32(h, n); + num--; + } +@@ -408,5 +408,5 @@ CAMLexport value caml_hash_variant(char const * tag) + #endif + /* Force sign extension of bit 31 for compatibility between 32 and 64-bit + platforms */ +- return (int32) accu; ++ return (int32_t) accu; + } diff --git a/byterun/intern.c b/byterun/intern.c -index e0fcc5d..638ff72 100644 +index d2943af..6f2d49f 100644 --- a/byterun/intern.c +++ b/byterun/intern.c @@ -553,7 +553,7 @@ static void intern_add_to_heap(mlsize_t whsize) @@ -956,7 +1094,7 @@ index e0fcc5d..638ff72 100644 return i; } diff --git a/byterun/interp.c b/byterun/interp.c -index 9b682ba..e22b28b 100644 +index fd4740b..094eb50 100644 --- a/byterun/interp.c +++ b/byterun/interp.c @@ -793,7 +793,7 @@ value caml_interprete(code_t prog, asize_t prog_size) @@ -968,38 +1106,8 @@ index 9b682ba..e22b28b 100644 if (Is_block(accu)) { intnat index = Tag_val(accu); Assert ((uintnat) index < (sizes >> 16)); -diff --git a/byterun/intext.h b/byterun/intext.h -index f7aa655..2c108a4 100644 ---- a/byterun/intext.h -+++ b/byterun/intext.h -@@ -119,8 +119,8 @@ CAMLextern value caml_input_value_from_block(char * data, intnat len); - - CAMLextern void caml_serialize_int_1(int i); - CAMLextern void caml_serialize_int_2(int i); --CAMLextern void caml_serialize_int_4(int32 i); --CAMLextern void caml_serialize_int_8(int64 i); -+CAMLextern void caml_serialize_int_4(int32_t i); -+CAMLextern void caml_serialize_int_8(int64_t i); - CAMLextern void caml_serialize_float_4(float f); - CAMLextern void caml_serialize_float_8(double f); - CAMLextern void caml_serialize_block_1(void * data, intnat len); -@@ -133,10 +133,10 @@ CAMLextern int caml_deserialize_uint_1(void); - CAMLextern int caml_deserialize_sint_1(void); - CAMLextern int caml_deserialize_uint_2(void); - CAMLextern int caml_deserialize_sint_2(void); --CAMLextern uint32 caml_deserialize_uint_4(void); --CAMLextern int32 caml_deserialize_sint_4(void); --CAMLextern uint64 caml_deserialize_uint_8(void); --CAMLextern int64 caml_deserialize_sint_8(void); -+CAMLextern uint32_t caml_deserialize_uint_4(void); -+CAMLextern int32_t caml_deserialize_sint_4(void); -+CAMLextern uint64_t caml_deserialize_uint_8(void); -+CAMLextern int64_t caml_deserialize_sint_8(void); - CAMLextern float caml_deserialize_float_4(void); - CAMLextern double caml_deserialize_float_8(void); - CAMLextern void caml_deserialize_block_1(void * data, intnat len); diff --git a/byterun/ints.c b/byterun/ints.c -index d762c76..056e82a 100644 +index 4a73276..621aa54 100644 --- a/byterun/ints.c +++ b/byterun/ints.c @@ -172,8 +172,8 @@ CAMLprim value caml_format_int(value fmt, value arg) @@ -1334,7 +1442,7 @@ index d762c76..056e82a 100644 caml_serialize_int_1(2); caml_serialize_int_8(l); diff --git a/byterun/io.c b/byterun/io.c -index 5f04a96..bedc0f0 100644 +index 11f941d..77f308c 100644 --- a/byterun/io.c +++ b/byterun/io.c @@ -207,7 +207,7 @@ CAMLexport void caml_flush(struct channel *channel) @@ -1359,39 +1467,11 @@ index 5f04a96..bedc0f0 100644 if (! caml_channel_binary_mode(channel)) caml_failwith("input_binary_int: not a binary channel"); -diff --git a/byterun/io.h b/byterun/io.h -index 64a8bf5..5a9c037 100644 ---- a/byterun/io.h -+++ b/byterun/io.h -@@ -78,12 +78,12 @@ CAMLextern value caml_alloc_channel(struct channel *chan); - - CAMLextern int caml_flush_partial (struct channel *); - CAMLextern void caml_flush (struct channel *); --CAMLextern void caml_putword (struct channel *, uint32); -+CAMLextern void caml_putword (struct channel *, uint32_t); - CAMLextern int caml_putblock (struct channel *, char *, intnat); - CAMLextern void caml_really_putblock (struct channel *, char *, intnat); - - CAMLextern unsigned char caml_refill (struct channel *); --CAMLextern uint32 caml_getword (struct channel *); -+CAMLextern uint32_t caml_getword (struct channel *); - CAMLextern int caml_getblock (struct channel *, char *, intnat); - CAMLextern int caml_really_getblock (struct channel *, char *, intnat); - -@@ -107,7 +107,7 @@ CAMLextern struct channel * caml_all_opened_channels; - #define Unlock_exn() \ - if (caml_channel_mutex_unlock_exn != NULL) (*caml_channel_mutex_unlock_exn)() - --/* Conversion between file_offset and int64 */ -+/* Conversion between file_offset and int64_t */ - - #define Val_file_offset(fofs) caml_copy_int64(fofs) - #define File_offset_val(v) ((file_offset) Int64_val(v)) diff --git a/byterun/md5.c b/byterun/md5.c -index 10ac76a..2dc90a2 100644 +index 5d748c1..7a996b6 100644 --- a/byterun/md5.c +++ b/byterun/md5.c -@@ -97,11 +97,11 @@ CAMLexport void caml_md5_block(unsigned char digest[16], +@@ -101,11 +101,11 @@ CAMLexport void caml_md5_block(unsigned char digest[16], #else static void byteReverse(unsigned char * buf, unsigned longs) { @@ -1406,7 +1486,7 @@ index 10ac76a..2dc90a2 100644 buf += 4; } while (--longs); } -@@ -129,12 +129,12 @@ CAMLexport void caml_MD5Init(struct MD5Context *ctx) +@@ -133,12 +133,12 @@ CAMLexport void caml_MD5Init(struct MD5Context *ctx) CAMLexport void caml_MD5Update(struct MD5Context *ctx, unsigned char *buf, uintnat len) { @@ -1421,7 +1501,7 @@ index 10ac76a..2dc90a2 100644 ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1] += len >> 29; -@@ -152,7 +152,7 @@ CAMLexport void caml_MD5Update(struct MD5Context *ctx, unsigned char *buf, +@@ -156,7 +156,7 @@ CAMLexport void caml_MD5Update(struct MD5Context *ctx, unsigned char *buf, } memcpy(p, buf, t); byteReverse(ctx->in, 16); @@ -1430,7 +1510,7 @@ index 10ac76a..2dc90a2 100644 buf += t; len -= t; } -@@ -161,7 +161,7 @@ CAMLexport void caml_MD5Update(struct MD5Context *ctx, unsigned char *buf, +@@ -165,7 +165,7 @@ CAMLexport void caml_MD5Update(struct MD5Context *ctx, unsigned char *buf, while (len >= 64) { memcpy(ctx->in, buf, 64); byteReverse(ctx->in, 16); @@ -1439,7 +1519,7 @@ index 10ac76a..2dc90a2 100644 buf += 64; len -= 64; } -@@ -196,7 +196,7 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx) +@@ -200,7 +200,7 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx) /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in, 16); @@ -1448,7 +1528,7 @@ index 10ac76a..2dc90a2 100644 /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); -@@ -207,10 +207,10 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx) +@@ -211,10 +211,10 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx) byteReverse(ctx->in, 14); /* Append length in bits and transform */ @@ -1462,7 +1542,7 @@ index 10ac76a..2dc90a2 100644 byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ -@@ -233,9 +233,9 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx) +@@ -237,9 +237,9 @@ CAMLexport void caml_MD5Final(unsigned char *digest, struct MD5Context *ctx) * reflect the addition of 16 longwords of new data. caml_MD5Update blocks * the data and converts bytes into longwords for this routine. */ @@ -1474,72 +1554,8 @@ index 10ac76a..2dc90a2 100644 a = buf[0]; b = buf[1]; -diff --git a/byterun/md5.h b/byterun/md5.h -index d8aff09..f63667d 100644 ---- a/byterun/md5.h -+++ b/byterun/md5.h -@@ -26,8 +26,8 @@ CAMLextern void caml_md5_block(unsigned char digest[16], - void * data, uintnat len); - - struct MD5Context { -- uint32 buf[4]; -- uint32 bits[2]; -+ uint32_t buf[4]; -+ uint32_t bits[2]; - unsigned char in[64]; - }; - -@@ -35,7 +35,7 @@ CAMLextern void caml_MD5Init (struct MD5Context *context); - CAMLextern void caml_MD5Update (struct MD5Context *context, unsigned char *buf, - uintnat len); - CAMLextern void caml_MD5Final (unsigned char *digest, struct MD5Context *ctx); --CAMLextern void caml_MD5Transform (uint32 *buf, uint32 *in); -+CAMLextern void caml_MD5Transform (uint32_t *buf, uint32_t *in); - - - #endif /* CAML_MD5_H */ -diff --git a/byterun/mlvalues.h b/byterun/mlvalues.h -index 268bcfe..a08948e 100644 ---- a/byterun/mlvalues.h -+++ b/byterun/mlvalues.h -@@ -38,8 +38,8 @@ extern "C" { - bp: Pointer to the first byte of a block. (a char *) - op: Pointer to the first field of a block. (a value *) - hp: Pointer to the header of a block. (a char *) -- int32: Four bytes on all architectures. -- int64: Eight bytes on all architectures. -+ int32_t: Four bytes on all architectures. -+ int64_t: Eight bytes on all architectures. - - Remark: A block size is always a multiple of the word size, and at least - one word plus the header. -@@ -161,7 +161,7 @@ bits 63 10 9 8 7 0 - /* Fields are numbered from 0. */ - #define Field(x, i) (((value *)(x)) [i]) /* Also an l-value. */ - --typedef int32 opcode_t; -+typedef int32_t opcode_t; - typedef opcode_t * code_t; - - /* NOTE: [Forward_tag] and [Infix_tag] must be just under -@@ -262,12 +262,12 @@ struct custom_operations; /* defined in [custom.h] */ - - /* Int32.t, Int64.t and Nativeint.t are represented as custom blocks. */ - --#define Int32_val(v) (*((int32 *) Data_custom_val(v))) -+#define Int32_val(v) (*((int32_t *) Data_custom_val(v))) - #define Nativeint_val(v) (*((intnat *) Data_custom_val(v))) - #ifndef ARCH_ALIGN_INT64 --#define Int64_val(v) (*((int64 *) Data_custom_val(v))) -+#define Int64_val(v) (*((int64_t *) Data_custom_val(v))) - #else --CAMLextern int64 caml_Int64_val(value v); -+CAMLextern int64_t caml_Int64_val(value v); - #define Int64_val(v) caml_Int64_val(v) - #endif - diff --git a/byterun/startup.c b/byterun/startup.c -index 3697220..ab926ef 100644 +index fb6e777..541aacd 100644 --- a/byterun/startup.c +++ b/byterun/startup.c @@ -79,7 +79,7 @@ static void init_atoms(void) @@ -1581,24 +1597,8 @@ index 3697220..ab926ef 100644 char * data; len = caml_seek_optional_section(fd, trail, name); -diff --git a/byterun/startup.h b/byterun/startup.h -index 3dda64b..3268d88 100644 ---- a/byterun/startup.h -+++ b/byterun/startup.h -@@ -30,9 +30,9 @@ enum { FILE_NOT_FOUND = -1, BAD_BYTECODE = -2 }; - extern int caml_attempt_open(char **name, struct exec_trailer *trail, - int do_open_script); - extern void caml_read_section_descriptors(int fd, struct exec_trailer *trail); --extern int32 caml_seek_optional_section(int fd, struct exec_trailer *trail, -+extern int32_t caml_seek_optional_section(int fd, struct exec_trailer *trail, - char *name); --extern int32 caml_seek_section(int fd, struct exec_trailer *trail, char *name); -+extern int32_t caml_seek_section(int fd, struct exec_trailer *trail, char *name); - - - #endif /* CAML_STARTUP_H */ diff --git a/byterun/str.c b/byterun/str.c -index 6effa91..9c7baa1 100644 +index a72b34c..d88c3d2 100644 --- a/byterun/str.c +++ b/byterun/str.c @@ -101,7 +101,7 @@ CAMLprim value caml_string_get32(value str, value index) @@ -1697,10 +1697,10 @@ index e8aa878..ccf1bf4 100644 #define HAS_STRERROR #define HAS_SOCKETS diff --git a/configure b/configure -index c04272c..092d467 100755 +index 6157157..1440baa 100755 --- a/configure +++ b/configure -@@ -619,26 +619,6 @@ case "$target" in +@@ -648,26 +648,6 @@ case "$target" in esac esac @@ -1727,7 +1727,7 @@ index c04272c..092d467 100755 # Shared library support shared_libraries_supported=false -@@ -1097,6 +1077,11 @@ if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \ +@@ -1129,6 +1109,11 @@ if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \ echo "#define HAS_IPV6" >> s.h fi @@ -1740,7 +1740,7 @@ index c04272c..092d467 100755 inf "unistd.h found." echo "#define HAS_UNISTD" >> s.h diff --git a/otherlibs/bigarray/bigarray_stubs.c b/otherlibs/bigarray/bigarray_stubs.c -index 7e63cbf..f2ccb92 100644 +index c98a92f..4638655 100644 --- a/otherlibs/bigarray/bigarray_stubs.c +++ b/otherlibs/bigarray/bigarray_stubs.c @@ -279,9 +279,9 @@ value caml_ba_get_N(value vb, value * vind, int nind) @@ -1877,7 +1877,7 @@ index 7e63cbf..f2ccb92 100644 break; } diff --git a/otherlibs/num/nat_stubs.c b/otherlibs/num/nat_stubs.c -index 9a62759..d718a05 100644 +index ae109ac..22614e1 100644 --- a/otherlibs/num/nat_stubs.c +++ b/otherlibs/num/nat_stubs.c @@ -347,9 +347,9 @@ static void serialize_nat(value nat, @@ -1933,7 +1933,7 @@ index 9a62759..d718a05 100644 h = caml_hash_mix_uint32(h, d); #endif diff --git a/otherlibs/unix/addrofstr.c b/otherlibs/unix/addrofstr.c -index e17841f..a2830ba 100644 +index c4bd2e7..207e1cd 100644 --- a/otherlibs/unix/addrofstr.c +++ b/otherlibs/unix/addrofstr.c @@ -73,7 +73,7 @@ CAMLprim value unix_inet_addr_of_string(value s) @@ -1946,7 +1946,7 @@ index e17841f..a2830ba 100644 #endif } diff --git a/stdlib/header.c b/stdlib/header.c -index cb3d995..93cdfeb 100644 +index b8d02ea..6f3dc54 100644 --- a/stdlib/header.c +++ b/stdlib/header.c @@ -133,7 +133,7 @@ static char * read_runtime_path(int fd) diff --git a/0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch b/0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch index fdf6ce5..dfda8ef 100644 --- a/0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch +++ b/0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch @@ -1,7 +1,7 @@ -From 8e493f90181b8b592185b2f9322575113b5ff7d5 Mon Sep 17 00:00:00 2001 +From 03f9a1532f4559bdd8da5edb9915d058f380d633 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 11 Sep 2014 14:49:54 +0100 -Subject: [PATCH 14/18] ppc, ppc64, ppc64le: Mark stack as non-executable. +Subject: [PATCH 14/16] ppc, ppc64, ppc64le: Mark stack as non-executable. The same fix as this one, which was only fully applied to i686 & x86-64: @@ -16,10 +16,10 @@ http://caml.inria.fr/mantis/view.php?id=4564 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp -index 0a26ed1..8e31b58 100644 +index 4344085..717ab12 100644 --- a/asmcomp/power/emit.mlp +++ b/asmcomp/power/emit.mlp -@@ -963,4 +963,5 @@ let end_assembly() = +@@ -927,4 +927,5 @@ let end_assembly() = ` .long ({emit_label lbl} - .) + {emit_int32 ofs}\n`); efa_def_label = (fun l -> `{emit_label l}:\n`); efa_string = (fun s -> emit_bytes_directive " .byte " (s ^ "\000")) diff --git a/0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch b/0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch index a417211..e44cbcd 100644 --- a/0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch +++ b/0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch @@ -1,7 +1,7 @@ -From df5201a35d02a13ad7ffd6fb38252851910cae43 Mon Sep 17 00:00:00 2001 +From 812ed668f8d37e1153552535070a0673772a2aea Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 24 Oct 2014 10:10:54 +0100 -Subject: [PATCH 15/18] ppc64/ppc64le: proc: Interim definitions for op_is_pure +Subject: [PATCH 15/16] ppc64/ppc64le: proc: Interim definitions for op_is_pure and regs_are_volatile. See: https://bugzilla.redhat.com/show_bug.cgi?id=1156300 diff --git a/0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch b/0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch deleted file mode 100644 index 3b82dc2..0000000 --- a/0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch +++ /dev/null @@ -1,79 +0,0 @@ -From d3ca0ccc0eccfecd4aa922decf99ca7d67d40fa7 Mon Sep 17 00:00:00 2001 -From: Mark Shinwell -Date: Wed, 6 May 2015 17:37:43 +0000 -Subject: [PATCH 16/18] Fix PR#6490: incorrect backtraces in gdb on AArch64. - (Also fixes the same problem for 32-bit ARM.) - -git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@16091 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 ---- - asmcomp/arm/emit.mlp | 4 +++- - asmcomp/arm64/emit.mlp | 6 ++++-- - asmcomp/emitaux.ml | 9 +++++++++ - asmcomp/emitaux.mli | 1 + - 4 files changed, 17 insertions(+), 3 deletions(-) - -diff --git a/asmcomp/arm/emit.mlp b/asmcomp/arm/emit.mlp -index 61035b8..4948fb2 100644 ---- a/asmcomp/arm/emit.mlp -+++ b/asmcomp/arm/emit.mlp -@@ -852,8 +852,10 @@ let fundecl fundecl = - let n = frame_size() in - if n > 0 then begin - ignore(emit_stack_adjustment (-n)); -- if !contains_calls then -+ if !contains_calls then begin -+ cfi_offset ~reg:14 (* lr *) ~offset:(-4); - ` str lr, [sp, #{emit_int(n - 4)}]\n` -+ end - end; - `{emit_label !tailrec_entry_point}:\n`; - emit_all 0 fundecl.fun_body; -diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp -index 734bd23..c5c30d4 100644 ---- a/asmcomp/arm64/emit.mlp -+++ b/asmcomp/arm64/emit.mlp -@@ -654,8 +654,10 @@ let fundecl fundecl = - let n = frame_size() in - if n > 0 then - emit_stack_adjustment (-n); -- if !contains_calls then -- ` str x30, [sp, #{emit_int (n-8)}]\n`; -+ if !contains_calls then begin -+ cfi_offset ~reg:30 (* return address *) ~offset:(-8); -+ ` str x30, [sp, #{emit_int (n-8)}]\n` -+ end; - `{emit_label !tailrec_entry_point}:\n`; - emit_all fundecl.fun_body; - List.iter emit_call_gc !call_gc_sites; -diff --git a/asmcomp/emitaux.ml b/asmcomp/emitaux.ml -index 24a621b..ec2e8f0 100644 ---- a/asmcomp/emitaux.ml -+++ b/asmcomp/emitaux.ml -@@ -195,6 +195,15 @@ let cfi_adjust_cfa_offset n = - emit_string "\t.cfi_adjust_cfa_offset\t"; emit_int n; emit_string "\n"; - end - -+let cfi_offset ~reg ~offset = -+ if is_cfi_enabled () then begin -+ emit_string "\t.cfi_offset "; -+ emit_int reg; -+ emit_string ", "; -+ emit_int offset; -+ emit_string "\n" -+ end -+ - (* Emit debug information *) - - (* This assoc list is expected to be very short *) -diff --git a/asmcomp/emitaux.mli b/asmcomp/emitaux.mli -index 486a583..e943da3 100644 ---- a/asmcomp/emitaux.mli -+++ b/asmcomp/emitaux.mli -@@ -56,3 +56,4 @@ val is_generic_function: string -> bool - val cfi_startproc : unit -> unit - val cfi_endproc : unit -> unit - val cfi_adjust_cfa_offset : int -> unit -+val cfi_offset : reg:int -> offset:int -> unit --- -2.3.1 - diff --git a/0016-ppc64le-Fix-calling-convention-of-external-functions.patch b/0016-ppc64le-Fix-calling-convention-of-external-functions.patch new file mode 100644 index 0000000..af4c246 --- /dev/null +++ b/0016-ppc64le-Fix-calling-convention-of-external-functions.patch @@ -0,0 +1,34 @@ +From c1ebccc0e1250d3efc303819b383f713132e66f8 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 28 May 2015 16:13:40 -0400 +Subject: [PATCH 16/16] ppc64le: Fix calling convention of external functions + with > 8 parameters (RHBZ#1225995). + +For external (ie. C) functions with more than 8 parameters, we must +pass the first 8 parameters in registers and then all the remaining +parameters on the stack. + +Unfortunately the original backend copied the stack offset from ppc64, +where it works, but the offset was wrong for ppc64le. + +By experimentation I found the correct offset. +--- + asmcomp/power64le/proc.ml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/asmcomp/power64le/proc.ml b/asmcomp/power64le/proc.ml +index 56473ac..c705695 100644 +--- a/asmcomp/power64le/proc.ml ++++ b/asmcomp/power64le/proc.ml +@@ -188,7 +188,7 @@ let poweropen_external_conventions first_int last_int + let loc_external_arguments = + match Config.system with + | "rhapsody" -> poweropen_external_conventions 0 7 100 112 +- | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 48 ++ | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 32 + | _ -> assert false + + let extcall_use_push = false +-- +2.3.1 + diff --git a/0017-ppc64le-Fix-calling-convention-of-external-functions.patch b/0017-ppc64le-Fix-calling-convention-of-external-functions.patch deleted file mode 100644 index b3d35da..0000000 --- a/0017-ppc64le-Fix-calling-convention-of-external-functions.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 5b7d4c5d1407115c2c685987be2669a9b0aafa78 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 28 May 2015 16:13:40 -0400 -Subject: [PATCH 17/18] ppc64le: Fix calling convention of external functions - with > 8 parameters (RHBZ#1225995). - -For external (ie. C) functions with more than 8 parameters, we must -pass the first 8 parameters in registers and then all the remaining -parameters on the stack. - -Unfortunately the original backend copied the stack offset from ppc64, -where it works, but the offset was wrong for ppc64le. - -By experimentation I found the correct offset. ---- - asmcomp/power64le/proc.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/asmcomp/power64le/proc.ml b/asmcomp/power64le/proc.ml -index 56473ac..c705695 100644 ---- a/asmcomp/power64le/proc.ml -+++ b/asmcomp/power64le/proc.ml -@@ -188,7 +188,7 @@ let poweropen_external_conventions first_int last_int - let loc_external_arguments = - match Config.system with - | "rhapsody" -> poweropen_external_conventions 0 7 100 112 -- | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 48 -+ | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 32 - | _ -> assert false - - let extcall_use_push = false --- -2.3.1 - diff --git a/0018-Fix-PR-6878-AArch64-conditional-branches-out-of-rang.patch b/0018-Fix-PR-6878-AArch64-conditional-branches-out-of-rang.patch deleted file mode 100644 index 718f3dc..0000000 --- a/0018-Fix-PR-6878-AArch64-conditional-branches-out-of-rang.patch +++ /dev/null @@ -1,1219 +0,0 @@ -From 2a2f55156c3d53f22095968f1785e79cca7676e7 Mon Sep 17 00:00:00 2001 -From: Mark Shinwell -Date: Wed, 10 Jun 2015 09:27:36 +0000 -Subject: [PATCH 18/18] Fix PR#6878: AArch64 conditional branches out of range. - (Introduces new, generic branch relaxation module.) - -git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@16168 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 -(cherry picked from commit d2a9da66eca1cb769e555b79a23b1ac64c01d1b5) ---- - .depend | 130 +++++++++-------- - Makefile | 2 + - asmcomp/amd64/emit.mlp | 6 + - asmcomp/arm64/arch.ml | 13 ++ - asmcomp/arm64/emit.mlp | 294 +++++++++++++++++++++++++++++++++++--- - asmcomp/branch_relaxation.ml | 138 ++++++++++++++++++ - asmcomp/branch_relaxation.mli | 26 ++++ - asmcomp/branch_relaxation_intf.ml | 63 ++++++++ - asmcomp/power/emit.mlp | 190 ++++++++++-------------- - 9 files changed, 666 insertions(+), 196 deletions(-) - create mode 100644 asmcomp/branch_relaxation.ml - create mode 100644 asmcomp/branch_relaxation.mli - create mode 100644 asmcomp/branch_relaxation_intf.ml - -diff --git a/.depend b/.depend -index 5d95a9b..813fbd7 100644 ---- a/.depend -+++ b/.depend -@@ -94,10 +94,10 @@ typing/ctype.cmi : typing/types.cmi typing/path.cmi parsing/longident.cmi \ - typing/ident.cmi typing/env.cmi parsing/asttypes.cmi - typing/datarepr.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi \ - parsing/asttypes.cmi -+typing/envaux.cmi : typing/subst.cmi typing/path.cmi typing/env.cmi - typing/env.cmi : utils/warnings.cmi typing/types.cmi typing/subst.cmi \ - typing/path.cmi parsing/longident.cmi parsing/location.cmi \ - typing/ident.cmi utils/consistbl.cmi parsing/asttypes.cmi --typing/envaux.cmi : typing/subst.cmi typing/path.cmi typing/env.cmi - typing/ident.cmi : - typing/includeclass.cmi : typing/types.cmi typing/env.cmi typing/ctype.cmi - typing/includecore.cmi : typing/types.cmi typing/typedtree.cmi \ -@@ -115,10 +115,10 @@ typing/parmatch.cmi : typing/types.cmi typing/typedtree.cmi \ - typing/path.cmi : typing/ident.cmi - typing/predef.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi - typing/primitive.cmi : -+typing/printtyped.cmi : typing/typedtree.cmi - typing/printtyp.cmi : typing/types.cmi typing/path.cmi \ - typing/outcometree.cmi parsing/longident.cmi typing/ident.cmi \ - typing/env.cmi --typing/printtyped.cmi : typing/typedtree.cmi - typing/stypes.cmi : typing/typedtree.cmi parsing/location.cmi \ - typing/annot.cmi - typing/subst.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi -@@ -131,11 +131,11 @@ typing/typecore.cmi : typing/types.cmi typing/typedtree.cmi typing/path.cmi \ - typing/typedecl.cmi : typing/types.cmi typing/typedtree.cmi typing/path.cmi \ - parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \ - typing/includecore.cmi typing/ident.cmi typing/env.cmi --typing/typedtree.cmi : typing/types.cmi typing/primitive.cmi typing/path.cmi \ -- parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \ -- typing/ident.cmi typing/env.cmi parsing/asttypes.cmi - typing/typedtreeIter.cmi : typing/typedtree.cmi parsing/asttypes.cmi - typing/typedtreeMap.cmi : typing/typedtree.cmi -+typing/typedtree.cmi : typing/types.cmi typing/primitive.cmi typing/path.cmi \ -+ parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \ -+ typing/ident.cmi typing/env.cmi parsing/asttypes.cmi - typing/typemod.cmi : typing/types.cmi typing/typedtree.cmi typing/path.cmi \ - parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \ - typing/includemod.cmi typing/ident.cmi typing/env.cmi \ -@@ -176,6 +176,12 @@ typing/datarepr.cmo : typing/types.cmi typing/path.cmi parsing/location.cmi \ - typing/datarepr.cmx : typing/types.cmx typing/path.cmx parsing/location.cmx \ - typing/ident.cmx typing/btype.cmx parsing/asttypes.cmi \ - typing/datarepr.cmi -+typing/envaux.cmo : typing/types.cmi typing/subst.cmi typing/printtyp.cmi \ -+ typing/path.cmi utils/misc.cmi typing/ident.cmi typing/env.cmi \ -+ parsing/asttypes.cmi typing/envaux.cmi -+typing/envaux.cmx : typing/types.cmx typing/subst.cmx typing/printtyp.cmx \ -+ typing/path.cmx utils/misc.cmx typing/ident.cmx typing/env.cmx \ -+ parsing/asttypes.cmi typing/envaux.cmi - typing/env.cmo : utils/warnings.cmi typing/types.cmi utils/tbl.cmi \ - typing/subst.cmi typing/predef.cmi typing/path.cmi utils/misc.cmi \ - parsing/longident.cmi parsing/location.cmi typing/ident.cmi \ -@@ -188,12 +194,6 @@ typing/env.cmx : utils/warnings.cmx typing/types.cmx utils/tbl.cmx \ - typing/datarepr.cmx utils/consistbl.cmx utils/config.cmx \ - typing/cmi_format.cmx utils/clflags.cmx typing/btype.cmx \ - parsing/asttypes.cmi typing/env.cmi --typing/envaux.cmo : typing/types.cmi typing/subst.cmi typing/printtyp.cmi \ -- typing/path.cmi utils/misc.cmi typing/ident.cmi typing/env.cmi \ -- parsing/asttypes.cmi typing/envaux.cmi --typing/envaux.cmx : typing/types.cmx typing/subst.cmx typing/printtyp.cmx \ -- typing/path.cmx utils/misc.cmx typing/ident.cmx typing/env.cmx \ -- parsing/asttypes.cmi typing/envaux.cmi - typing/ident.cmo : typing/ident.cmi - typing/ident.cmx : typing/ident.cmi - typing/includeclass.cmo : typing/types.cmi typing/printtyp.cmi \ -@@ -252,24 +252,24 @@ typing/predef.cmx : typing/types.cmx typing/path.cmx parsing/location.cmx \ - typing/ident.cmx typing/btype.cmx parsing/asttypes.cmi typing/predef.cmi - typing/primitive.cmo : utils/misc.cmi typing/primitive.cmi - typing/primitive.cmx : utils/misc.cmx typing/primitive.cmi --typing/printtyp.cmo : typing/types.cmi typing/primitive.cmi \ -- typing/predef.cmi typing/path.cmi typing/outcometree.cmi \ -- typing/oprint.cmi utils/misc.cmi parsing/longident.cmi \ -- parsing/location.cmi typing/ident.cmi typing/env.cmi typing/ctype.cmi \ -- utils/clflags.cmi typing/btype.cmi parsing/asttypes.cmi \ -- typing/printtyp.cmi --typing/printtyp.cmx : typing/types.cmx typing/primitive.cmx \ -- typing/predef.cmx typing/path.cmx typing/outcometree.cmi \ -- typing/oprint.cmx utils/misc.cmx parsing/longident.cmx \ -- parsing/location.cmx typing/ident.cmx typing/env.cmx typing/ctype.cmx \ -- utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi \ -- typing/printtyp.cmi - typing/printtyped.cmo : typing/typedtree.cmi parsing/printast.cmi \ - typing/path.cmi utils/misc.cmi parsing/longident.cmi parsing/location.cmi \ - typing/ident.cmi parsing/asttypes.cmi typing/printtyped.cmi - typing/printtyped.cmx : typing/typedtree.cmx parsing/printast.cmx \ - typing/path.cmx utils/misc.cmx parsing/longident.cmx parsing/location.cmx \ - typing/ident.cmx parsing/asttypes.cmi typing/printtyped.cmi -+typing/printtyp.cmo : typing/types.cmi typing/primitive.cmi \ -+ typing/predef.cmi typing/path.cmi typing/outcometree.cmi \ -+ typing/oprint.cmi utils/misc.cmi parsing/longident.cmi \ -+ parsing/location.cmi typing/ident.cmi typing/env.cmi typing/ctype.cmi \ -+ utils/clflags.cmi typing/btype.cmi parsing/asttypes.cmi \ -+ typing/printtyp.cmi -+typing/printtyp.cmx : typing/types.cmx typing/primitive.cmx \ -+ typing/predef.cmx typing/path.cmx typing/outcometree.cmi \ -+ typing/oprint.cmx utils/misc.cmx parsing/longident.cmx \ -+ parsing/location.cmx typing/ident.cmx typing/env.cmx typing/ctype.cmx \ -+ utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi \ -+ typing/printtyp.cmi - typing/stypes.cmo : typing/typedtree.cmi typing/printtyp.cmi \ - parsing/location.cmi utils/clflags.cmi typing/annot.cmi typing/stypes.cmi - typing/stypes.cmx : typing/typedtree.cmx typing/printtyp.cmx \ -@@ -332,14 +332,6 @@ typing/typedecl.cmx : utils/warnings.cmx typing/typetexp.cmx \ - typing/ident.cmx typing/env.cmx typing/ctype.cmx utils/config.cmx \ - utils/clflags.cmx typing/btype.cmx parsing/asttypes.cmi \ - parsing/ast_helper.cmx typing/typedecl.cmi --typing/typedtree.cmo : typing/types.cmi typing/primitive.cmi typing/path.cmi \ -- parsing/parsetree.cmi utils/misc.cmi parsing/longident.cmi \ -- parsing/location.cmi typing/ident.cmi typing/env.cmi parsing/asttypes.cmi \ -- typing/typedtree.cmi --typing/typedtree.cmx : typing/types.cmx typing/primitive.cmx typing/path.cmx \ -- parsing/parsetree.cmi utils/misc.cmx parsing/longident.cmx \ -- parsing/location.cmx typing/ident.cmx typing/env.cmx parsing/asttypes.cmi \ -- typing/typedtree.cmi - typing/typedtreeIter.cmo : typing/typedtree.cmi utils/misc.cmi \ - parsing/asttypes.cmi typing/typedtreeIter.cmi - typing/typedtreeIter.cmx : typing/typedtree.cmx utils/misc.cmx \ -@@ -348,6 +340,14 @@ typing/typedtreeMap.cmo : typing/typedtree.cmi utils/misc.cmi \ - typing/typedtreeMap.cmi - typing/typedtreeMap.cmx : typing/typedtree.cmx utils/misc.cmx \ - typing/typedtreeMap.cmi -+typing/typedtree.cmo : typing/types.cmi typing/primitive.cmi typing/path.cmi \ -+ parsing/parsetree.cmi utils/misc.cmi parsing/longident.cmi \ -+ parsing/location.cmi typing/ident.cmi typing/env.cmi parsing/asttypes.cmi \ -+ typing/typedtree.cmi -+typing/typedtree.cmx : typing/types.cmx typing/primitive.cmx typing/path.cmx \ -+ parsing/parsetree.cmi utils/misc.cmx parsing/longident.cmx \ -+ parsing/location.cmx typing/ident.cmx typing/env.cmx parsing/asttypes.cmi \ -+ typing/typedtree.cmi - typing/typemod.cmo : utils/warnings.cmi typing/typetexp.cmi typing/types.cmi \ - typing/typedtree.cmi typing/typedecl.cmi typing/typecore.cmi \ - typing/typeclass.cmi typing/subst.cmi typing/stypes.cmi \ -@@ -578,27 +578,29 @@ bytecomp/typeopt.cmo : typing/types.cmi typing/typedtree.cmi \ - bytecomp/typeopt.cmx : typing/types.cmx typing/typedtree.cmx \ - typing/predef.cmx typing/path.cmx bytecomp/lambda.cmx typing/ident.cmx \ - typing/env.cmx typing/ctype.cmx bytecomp/typeopt.cmi --asmcomp/CSEgen.cmi : asmcomp/mach.cmi - asmcomp/asmgen.cmi : bytecomp/lambda.cmi asmcomp/cmm.cmi - asmcomp/asmlibrarian.cmi : - asmcomp/asmlink.cmi : asmcomp/cmx_format.cmi - asmcomp/asmpackager.cmi : typing/env.cmi -+asmcomp/branch_relaxation.cmi : asmcomp/linearize.cmi \ -+ asmcomp/branch_relaxation_intf.cmo - asmcomp/clambda.cmi : bytecomp/lambda.cmi typing/ident.cmi \ - asmcomp/debuginfo.cmi parsing/asttypes.cmi - asmcomp/closure.cmi : bytecomp/lambda.cmi asmcomp/clambda.cmi --asmcomp/cmm.cmi : bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi - asmcomp/cmmgen.cmi : asmcomp/cmx_format.cmi asmcomp/cmm.cmi \ - asmcomp/clambda.cmi -+asmcomp/cmm.cmi : bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi - asmcomp/cmx_format.cmi : asmcomp/clambda.cmi - asmcomp/codegen.cmi : asmcomp/cmm.cmi - asmcomp/coloring.cmi : - asmcomp/comballoc.cmi : asmcomp/mach.cmi - asmcomp/compilenv.cmi : typing/ident.cmi asmcomp/cmx_format.cmi \ - asmcomp/clambda.cmi -+asmcomp/CSEgen.cmi : asmcomp/mach.cmi - asmcomp/deadcode.cmi : asmcomp/mach.cmi - asmcomp/debuginfo.cmi : parsing/location.cmi bytecomp/lambda.cmi --asmcomp/emit.cmi : asmcomp/linearize.cmi asmcomp/cmm.cmi - asmcomp/emitaux.cmi : asmcomp/debuginfo.cmi -+asmcomp/emit.cmi : asmcomp/linearize.cmi asmcomp/cmm.cmi - asmcomp/interf.cmi : asmcomp/mach.cmi - asmcomp/linearize.cmi : asmcomp/reg.cmi asmcomp/mach.cmi bytecomp/lambda.cmi \ - asmcomp/debuginfo.cmi -@@ -611,8 +613,8 @@ asmcomp/printlinear.cmi : asmcomp/linearize.cmi - asmcomp/printmach.cmi : asmcomp/reg.cmi asmcomp/mach.cmi - asmcomp/proc.cmi : asmcomp/reg.cmi asmcomp/mach.cmi - asmcomp/reg.cmi : typing/ident.cmi asmcomp/cmm.cmi --asmcomp/reload.cmi : asmcomp/mach.cmi - asmcomp/reloadgen.cmi : asmcomp/reg.cmi asmcomp/mach.cmi -+asmcomp/reload.cmi : asmcomp/mach.cmi - asmcomp/schedgen.cmi : asmcomp/mach.cmi asmcomp/linearize.cmi - asmcomp/scheduling.cmi : asmcomp/linearize.cmi - asmcomp/selectgen.cmi : utils/tbl.cmi asmcomp/reg.cmi asmcomp/mach.cmi \ -@@ -621,12 +623,6 @@ asmcomp/selection.cmi : asmcomp/mach.cmi asmcomp/cmm.cmi - asmcomp/spill.cmi : asmcomp/mach.cmi - asmcomp/split.cmi : asmcomp/mach.cmi - asmcomp/strmatch.cmi : asmcomp/cmm.cmi --asmcomp/CSE.cmo : asmcomp/mach.cmi asmcomp/CSEgen.cmi asmcomp/arch.cmo --asmcomp/CSE.cmx : asmcomp/mach.cmx asmcomp/CSEgen.cmx asmcomp/arch.cmx --asmcomp/CSEgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \ -- asmcomp/CSEgen.cmi --asmcomp/CSEgen.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \ -- asmcomp/CSEgen.cmi - asmcomp/arch.cmo : - asmcomp/arch.cmx : - asmcomp/asmgen.cmo : bytecomp/translmod.cmi asmcomp/split.cmi \ -@@ -677,6 +673,14 @@ asmcomp/asmpackager.cmx : typing/typemod.cmx bytecomp/translmod.cmx \ - utils/config.cmx asmcomp/compilenv.cmx asmcomp/cmx_format.cmi \ - utils/clflags.cmx utils/ccomp.cmx asmcomp/asmlink.cmx asmcomp/asmgen.cmx \ - asmcomp/asmpackager.cmi -+asmcomp/branch_relaxation_intf.cmo : asmcomp/linearize.cmi asmcomp/arch.cmo -+asmcomp/branch_relaxation_intf.cmx : asmcomp/linearize.cmx asmcomp/arch.cmx -+asmcomp/branch_relaxation.cmo : utils/misc.cmi asmcomp/mach.cmi \ -+ asmcomp/linearize.cmi asmcomp/cmm.cmi asmcomp/branch_relaxation_intf.cmo \ -+ asmcomp/branch_relaxation.cmi -+asmcomp/branch_relaxation.cmx : utils/misc.cmx asmcomp/mach.cmx \ -+ asmcomp/linearize.cmx asmcomp/cmm.cmx asmcomp/branch_relaxation_intf.cmx \ -+ asmcomp/branch_relaxation.cmi - asmcomp/clambda.cmo : bytecomp/lambda.cmi typing/ident.cmi \ - asmcomp/debuginfo.cmi parsing/asttypes.cmi asmcomp/clambda.cmi - asmcomp/clambda.cmx : bytecomp/lambda.cmx typing/ident.cmx \ -@@ -691,10 +695,6 @@ asmcomp/closure.cmx : utils/tbl.cmx bytecomp/switch.cmx typing/primitive.cmx \ - asmcomp/debuginfo.cmx asmcomp/compilenv.cmx utils/clflags.cmx \ - asmcomp/clambda.cmx parsing/asttypes.cmi asmcomp/arch.cmx \ - asmcomp/closure.cmi --asmcomp/cmm.cmo : bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi \ -- asmcomp/arch.cmo asmcomp/cmm.cmi --asmcomp/cmm.cmx : bytecomp/lambda.cmx typing/ident.cmx asmcomp/debuginfo.cmx \ -- asmcomp/arch.cmx asmcomp/cmm.cmi - asmcomp/cmmgen.cmo : typing/types.cmi bytecomp/switch.cmi \ - asmcomp/strmatch.cmi asmcomp/proc.cmi typing/primitive.cmi utils/misc.cmi \ - bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi \ -@@ -707,6 +707,10 @@ asmcomp/cmmgen.cmx : typing/types.cmx bytecomp/switch.cmx \ - utils/config.cmx asmcomp/compilenv.cmx asmcomp/cmx_format.cmi \ - asmcomp/cmm.cmx utils/clflags.cmx asmcomp/clambda.cmx \ - parsing/asttypes.cmi asmcomp/arch.cmx asmcomp/cmmgen.cmi -+asmcomp/cmm.cmo : bytecomp/lambda.cmi typing/ident.cmi asmcomp/debuginfo.cmi \ -+ asmcomp/arch.cmo asmcomp/cmm.cmi -+asmcomp/cmm.cmx : bytecomp/lambda.cmx typing/ident.cmx asmcomp/debuginfo.cmx \ -+ asmcomp/arch.cmx asmcomp/cmm.cmi - asmcomp/codegen.cmo : asmcomp/split.cmi asmcomp/spill.cmi asmcomp/reload.cmi \ - asmcomp/reg.cmi asmcomp/printmach.cmi asmcomp/printlinear.cmi \ - asmcomp/printcmm.cmi asmcomp/liveness.cmi asmcomp/linearize.cmi \ -@@ -729,6 +733,12 @@ asmcomp/compilenv.cmo : utils/misc.cmi parsing/location.cmi typing/ident.cmi \ - asmcomp/compilenv.cmx : utils/misc.cmx parsing/location.cmx typing/ident.cmx \ - typing/env.cmx utils/config.cmx asmcomp/cmx_format.cmi \ - asmcomp/clambda.cmx asmcomp/compilenv.cmi -+asmcomp/CSEgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \ -+ asmcomp/CSEgen.cmi -+asmcomp/CSEgen.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \ -+ asmcomp/CSEgen.cmi -+asmcomp/CSE.cmo : asmcomp/mach.cmi asmcomp/CSEgen.cmi asmcomp/arch.cmo -+asmcomp/CSE.cmx : asmcomp/mach.cmx asmcomp/CSEgen.cmx asmcomp/arch.cmx - asmcomp/deadcode.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \ - asmcomp/deadcode.cmi - asmcomp/deadcode.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \ -@@ -737,20 +747,20 @@ asmcomp/debuginfo.cmo : parsing/location.cmi bytecomp/lambda.cmi \ - asmcomp/debuginfo.cmi - asmcomp/debuginfo.cmx : parsing/location.cmx bytecomp/lambda.cmx \ - asmcomp/debuginfo.cmi -+asmcomp/emitaux.cmo : asmcomp/linearize.cmi asmcomp/debuginfo.cmi \ -+ utils/config.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emitaux.cmi -+asmcomp/emitaux.cmx : asmcomp/linearize.cmx asmcomp/debuginfo.cmx \ -+ utils/config.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emitaux.cmi - asmcomp/emit.cmo : asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi \ - asmcomp/mach.cmi asmcomp/linearize.cmi bytecomp/lambda.cmi \ - asmcomp/emitaux.cmi asmcomp/debuginfo.cmi utils/config.cmi \ -- asmcomp/compilenv.cmi asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo \ -- asmcomp/emit.cmi -+ asmcomp/compilenv.cmi asmcomp/cmm.cmi utils/clflags.cmi \ -+ asmcomp/branch_relaxation.cmi asmcomp/arch.cmo asmcomp/emit.cmi - asmcomp/emit.cmx : asmcomp/reg.cmx asmcomp/proc.cmx utils/misc.cmx \ - asmcomp/mach.cmx asmcomp/linearize.cmx bytecomp/lambda.cmx \ - asmcomp/emitaux.cmx asmcomp/debuginfo.cmx utils/config.cmx \ -- asmcomp/compilenv.cmx asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx \ -- asmcomp/emit.cmi --asmcomp/emitaux.cmo : asmcomp/linearize.cmi asmcomp/debuginfo.cmi \ -- utils/config.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emitaux.cmi --asmcomp/emitaux.cmx : asmcomp/linearize.cmx asmcomp/debuginfo.cmx \ -- utils/config.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emitaux.cmi -+ asmcomp/compilenv.cmx asmcomp/cmm.cmx utils/clflags.cmx \ -+ asmcomp/branch_relaxation.cmx asmcomp/arch.cmx asmcomp/emit.cmi - asmcomp/interf.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \ - asmcomp/interf.cmi - asmcomp/interf.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \ -@@ -803,14 +813,14 @@ asmcomp/proc.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \ - asmcomp/arch.cmx asmcomp/proc.cmi - asmcomp/reg.cmo : typing/ident.cmi asmcomp/cmm.cmi asmcomp/reg.cmi - asmcomp/reg.cmx : typing/ident.cmx asmcomp/cmm.cmx asmcomp/reg.cmi -+asmcomp/reloadgen.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \ -+ asmcomp/reloadgen.cmi -+asmcomp/reloadgen.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \ -+ asmcomp/reloadgen.cmi - asmcomp/reload.cmo : asmcomp/reloadgen.cmi asmcomp/reg.cmi asmcomp/mach.cmi \ - asmcomp/cmm.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/reload.cmi - asmcomp/reload.cmx : asmcomp/reloadgen.cmx asmcomp/reg.cmx asmcomp/mach.cmx \ - asmcomp/cmm.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/reload.cmi --asmcomp/reloadgen.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \ -- asmcomp/reloadgen.cmi --asmcomp/reloadgen.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \ -- asmcomp/reloadgen.cmi - asmcomp/schedgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \ - asmcomp/linearize.cmi asmcomp/cmm.cmi asmcomp/arch.cmo \ - asmcomp/schedgen.cmi -@@ -849,8 +859,8 @@ driver/compenv.cmi : - driver/compile.cmi : - driver/compmisc.cmi : typing/env.cmi - driver/errors.cmi : --driver/main.cmi : - driver/main_args.cmi : -+driver/main.cmi : - driver/optcompile.cmi : - driver/opterrors.cmi : - driver/optmain.cmi : -@@ -885,6 +895,8 @@ driver/compmisc.cmx : typing/typemod.cmx utils/misc.cmx \ - parsing/asttypes.cmi driver/compmisc.cmi - driver/errors.cmo : parsing/location.cmi driver/errors.cmi - driver/errors.cmx : parsing/location.cmx driver/errors.cmi -+driver/main_args.cmo : utils/warnings.cmi driver/main_args.cmi -+driver/main_args.cmx : utils/warnings.cmx driver/main_args.cmi - driver/main.cmo : utils/warnings.cmi utils/misc.cmi driver/main_args.cmi \ - parsing/location.cmi utils/config.cmi driver/compmisc.cmi \ - driver/compile.cmi driver/compenv.cmi utils/clflags.cmi \ -@@ -895,8 +907,6 @@ driver/main.cmx : utils/warnings.cmx utils/misc.cmx driver/main_args.cmx \ - driver/compile.cmx driver/compenv.cmx utils/clflags.cmx \ - bytecomp/bytepackager.cmx bytecomp/bytelink.cmx \ - bytecomp/bytelibrarian.cmx driver/main.cmi --driver/main_args.cmo : utils/warnings.cmi driver/main_args.cmi --driver/main_args.cmx : utils/warnings.cmx driver/main_args.cmi - driver/optcompile.cmo : utils/warnings.cmi typing/typemod.cmi \ - typing/typedtree.cmi typing/typecore.cmi bytecomp/translmod.cmi \ - typing/stypes.cmi bytecomp/simplif.cmi typing/printtyped.cmi \ -diff --git a/Makefile b/Makefile -index 6c0e7e6..7a20e2c 100644 ---- a/Makefile -+++ b/Makefile -@@ -94,6 +94,8 @@ ASMCOMP=asmcomp/arch.cmo asmcomp/debuginfo.cmo \ - asmcomp/deadcode.cmo \ - asmcomp/printlinear.cmo asmcomp/linearize.cmo \ - asmcomp/schedgen.cmo asmcomp/scheduling.cmo \ -+ asmcomp/branch_relaxation_intf.cmo \ -+ asmcomp/branch_relaxation.cmo \ - asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \ - asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo \ - driver/opterrors.cmo driver/optcompile.cmo -diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp -index b576ece..d56d0f5 100644 ---- a/asmcomp/amd64/emit.mlp -+++ b/asmcomp/amd64/emit.mlp -@@ -20,6 +20,12 @@ open Mach - open Linearize - open Emitaux - -+(* [Branch_relaxation] is not used in this file, but is required by -+ emit.mlp files for certain other targets; the reference here ensures -+ that when releases are being prepared the .depend files are correct -+ for all targets. *) -+open! Branch_relaxation -+ - let macosx = (Config.system = "macosx") - let mingw64 = (Config.system = "mingw64") - let cygwin = (Config.system = "cygwin") -diff --git a/asmcomp/arm64/arch.ml b/asmcomp/arm64/arch.ml -index bfbe183..3e62da8 100644 ---- a/asmcomp/arm64/arch.ml -+++ b/asmcomp/arm64/arch.ml -@@ -34,8 +34,12 @@ type addressing_mode = - (* Specific operations *) - - type specific_operation = -+ | Ifar_alloc of int -+ | Ifar_intop_checkbound -+ | Ifar_intop_imm_checkbound of int - | Ishiftarith of arith_operation * int - | Ishiftcheckbound of int -+ | Ifar_shiftcheckbound of int - | Imuladd (* multiply and add *) - | Imulsub (* multiply and subtract *) - | Inegmulf (* floating-point negate and multiply *) -@@ -91,6 +95,12 @@ let print_addressing printreg addr ppf arg = - - let print_specific_operation printreg op ppf arg = - match op with -+ | Ifar_alloc n -> -+ fprintf ppf "(far) alloc %i" n -+ | Ifar_intop_checkbound -> -+ fprintf ppf "%a (far) check > %a" printreg arg.(0) printreg arg.(1) -+ | Ifar_intop_imm_checkbound n -> -+ fprintf ppf "%a (far) check > %i" printreg arg.(0) n - | Ishiftarith(op, shift) -> - let op_name = function - | Ishiftadd -> "+" -@@ -103,6 +113,9 @@ let print_specific_operation printreg op ppf arg = - printreg arg.(0) (op_name op) printreg arg.(1) shift_mark - | Ishiftcheckbound n -> - fprintf ppf "check %a >> %i > %a" printreg arg.(0) n printreg arg.(1) -+ | Ifar_shiftcheckbound n -> -+ fprintf ppf -+ "(far) check %a >> %i > %a" printreg arg.(0) n printreg arg.(1) - | Imuladd -> - fprintf ppf "(%a * %a) + %a" - printreg arg.(0) -diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp -index c5c30d4..8576eeb 100644 ---- a/asmcomp/arm64/emit.mlp -+++ b/asmcomp/arm64/emit.mlp -@@ -231,6 +231,32 @@ let emit_intconst dst n = - in - if n < 0n then emit_neg true 48 else emit_pos true 48 - -+let num_instructions_for_intconst n = -+ let num_instructions = ref 0 in -+ let rec count_pos first shift = -+ if shift < 0 then begin -+ if first then incr num_instructions -+ end else begin -+ let s = Nativeint.(logand (shift_right_logical n shift) 0xFFFFn) in -+ if s = 0n then count_pos first (shift - 16) else begin -+ incr num_instructions; -+ count_pos false (shift - 16) -+ end -+ end -+ and count_neg first shift = -+ if shift < 0 then begin -+ if first then incr num_instructions -+ end else begin -+ let s = Nativeint.(logand (shift_right_logical n shift) 0xFFFFn) in -+ if s = 0xFFFFn then count_neg first (shift - 16) else begin -+ incr num_instructions; -+ count_neg false (shift - 16) -+ end -+ end -+ in -+ if n < 0n then count_neg true 48 else count_pos true 48; -+ !num_instructions -+ - (* Recognize float constants appropriate for FMOV dst, #fpimm instruction: - "a normalized binary floating point encoding with 1 sign bit, 4 - bits of fraction and a 3-bit exponent" *) -@@ -302,6 +328,217 @@ let emit_load_symbol_addr dst s = - ` ldr {emit_reg dst}, [{emit_reg dst}, #:got_lo12:{emit_symbol s}]\n` - end - -+(* The following functions are used for calculating the sizes of the -+ call GC and bounds check points emitted out-of-line from the function -+ body. See branch_relaxation.mli. *) -+ -+let num_call_gc_and_check_bound_points instr = -+ let rec loop instr ((call_gc, check_bound) as totals) = -+ match instr.desc with -+ | Lend -> totals -+ | Lop (Ialloc _) when !fastcode_flag -> -+ loop instr.next (call_gc + 1, check_bound) -+ | Lop (Iintop Icheckbound) -+ | Lop (Iintop_imm (Icheckbound, _)) -+ | Lop (Ispecific (Ishiftcheckbound _)) -> -+ let check_bound = -+ (* When not in debug mode, there is at most one check-bound point. *) -+ if not !Clflags.debug then 1 -+ else check_bound + 1 -+ in -+ loop instr.next (call_gc, check_bound) -+ (* The following four should never be seen, since this function is run -+ before branch relaxation. *) -+ | Lop (Ispecific (Ifar_alloc _)) -+ | Lop (Ispecific Ifar_intop_checkbound) -+ | Lop (Ispecific (Ifar_intop_imm_checkbound _)) -+ | Lop (Ispecific (Ifar_shiftcheckbound _)) -> assert false -+ | _ -> loop instr.next totals -+ in -+ loop instr (0, 0) -+ -+let max_out_of_line_code_offset instr ~num_call_gc ~num_check_bound = -+ if num_call_gc < 1 && num_check_bound < 1 then 0 -+ else begin -+ let size_of_call_gc = 2 in -+ let size_of_check_bound = 1 in -+ let size_of_last_thing = -+ (* Call-GC points come before check-bound points. *) -+ if num_check_bound >= 1 then size_of_check_bound else size_of_call_gc -+ in -+ let total_size = -+ size_of_call_gc*num_call_gc + size_of_check_bound*num_check_bound -+ in -+ let max_offset = total_size - size_of_last_thing in -+ assert (max_offset >= 0); -+ max_offset -+ end -+ -+module BR = Branch_relaxation.Make (struct -+ (* CR-someday mshinwell: B and BL have +/- 128Mb ranges; for the moment we -+ assume we will never exceed this. It would seem to be most likely to -+ occur for branches between functions; in this case, the linker should be -+ able to insert veneers anyway. (See section 4.6.7 of the document -+ "ELF for the ARM 64-bit architecture (AArch64)".) *) -+ -+ type distance = int -+ -+ module Cond_branch = struct -+ type t = TB | CB | Bcc -+ -+ let all = [TB; CB; Bcc] -+ -+ (* AArch64 instructions are 32 bits wide, so [distance] in this module -+ means units of 32-bit words. *) -+ let max_displacement = function -+ | TB -> 32 * 1024 / 4 (* +/- 32Kb *) -+ | CB | Bcc -> 1 * 1024 * 1024 / 4 (* +/- 1Mb *) -+ -+ let classify_instr = function -+ | Lop (Ialloc _) -+ | Lop (Iintop Icheckbound) -+ | Lop (Iintop_imm (Icheckbound, _)) -+ | Lop (Ispecific (Ishiftcheckbound _)) -> Some Bcc -+ (* The various "far" variants in [specific_operation] don't need to -+ return [Some] here, since their code sequences never contain any -+ conditional branches that might need relaxing. *) -+ | Lcondbranch (Itruetest, _) -+ | Lcondbranch (Ifalsetest, _) -> Some CB -+ | Lcondbranch (Iinttest _, _) -+ | Lcondbranch (Iinttest_imm _, _) -+ | Lcondbranch (Ifloattest _, _) -> Some Bcc -+ | Lcondbranch (Ioddtest, _) -+ | Lcondbranch (Ieventest, _) -> Some TB -+ | Lcondbranch3 _ -> Some Bcc -+ | _ -> None -+ end -+ -+ let offset_pc_at_branch = 0 -+ -+ let epilogue_size () = -+ if !contains_calls then 3 else 2 -+ -+ let instr_size = function -+ | Lend -> 0 -+ | Lop (Imove | Ispill | Ireload) -> 1 -+ | Lop (Iconst_int n | Iconst_blockheader n) -> -+ num_instructions_for_intconst n -+ | Lop (Iconst_float _) -> 2 -+ | Lop (Iconst_symbol _) -> 2 -+ | Lop (Icall_ind) -> 1 -+ | Lop (Icall_imm _) -> 1 -+ | Lop (Itailcall_ind) -> epilogue_size () -+ | Lop (Itailcall_imm s) -> -+ if s = !function_name then 1 else epilogue_size () -+ | Lop (Iextcall (_, false)) -> 1 -+ | Lop (Iextcall (_, true)) -> 3 -+ | Lop (Istackoffset _) -> 2 -+ | Lop (Iload (size, addr)) | Lop (Istore (size, addr, _)) -> -+ let based = match addr with Iindexed _ -> 0 | Ibased _ -> 1 in -+ based + begin match size with Single -> 2 | _ -> 1 end -+ | Lop (Ialloc _) when !fastcode_flag -> 4 -+ | Lop (Ispecific (Ifar_alloc _)) when !fastcode_flag -> 5 -+ | Lop (Ialloc num_words) | Lop (Ispecific (Ifar_alloc num_words)) -> -+ begin match num_words with -+ | 16 | 24 | 32 -> 1 -+ | _ -> 1 + num_instructions_for_intconst (Nativeint.of_int num_words) -+ end -+ | Lop (Iintop (Icomp _)) -> 2 -+ | Lop (Iintop_imm (Icomp _, _)) -> 2 -+ | Lop (Iintop Icheckbound) -> 2 -+ | Lop (Ispecific Ifar_intop_checkbound) -> 3 -+ | Lop (Iintop_imm (Icheckbound, _)) -> 2 -+ | Lop (Ispecific (Ifar_intop_imm_checkbound _)) -> 3 -+ | Lop (Ispecific (Ishiftcheckbound _)) -> 2 -+ | Lop (Ispecific (Ifar_shiftcheckbound _)) -> 3 -+ | Lop (Iintop Imod) -> 2 -+ | Lop (Iintop Imulh) -> 1 -+ | Lop (Iintop _) -> 1 -+ | Lop (Iintop_imm _) -> 1 -+ | Lop (Ifloatofint | Iintoffloat | Iabsf | Inegf | Ispecific Isqrtf) -> 1 -+ | Lop (Iaddf | Isubf | Imulf | Idivf | Ispecific Inegmulf) -> 1 -+ | Lop (Ispecific (Imuladdf | Inegmuladdf | Imulsubf | Inegmulsubf)) -> 1 -+ | Lop (Ispecific (Ishiftarith _)) -> 1 -+ | Lop (Ispecific (Imuladd | Imulsub)) -> 1 -+ | Lop (Ispecific (Ibswap 16)) -> 2 -+ | Lop (Ispecific (Ibswap _)) -> 1 -+ | Lreloadretaddr -> 0 -+ | Lreturn -> epilogue_size () -+ | Llabel _ -> 0 -+ | Lbranch _ -> 1 -+ | Lcondbranch (tst, _) -> -+ begin match tst with -+ | Itruetest -> 1 -+ | Ifalsetest -> 1 -+ | Iinttest _ -> 2 -+ | Iinttest_imm _ -> 2 -+ | Ifloattest _ -> 2 -+ | Ioddtest -> 1 -+ | Ieventest -> 1 -+ end -+ | Lcondbranch3 (lbl0, lbl1, lbl2) -> -+ 1 + begin match lbl0 with None -> 0 | Some _ -> 1 end -+ + begin match lbl1 with None -> 0 | Some _ -> 1 end -+ + begin match lbl2 with None -> 0 | Some _ -> 1 end -+ | Lswitch jumptbl -> 3 + Array.length jumptbl -+ | Lsetuptrap _ -> 2 -+ | Lpushtrap -> 3 -+ | Lpoptrap -> 1 -+ | Lraise k -> -+ begin match !Clflags.debug, k with -+ | true, (Lambda.Raise_regular | Lambda.Raise_reraise) -> 1 -+ | false, _ -+ | true, Lambda.Raise_notrace -> 4 -+ end -+ -+ let relax_allocation ~num_words = -+ Lop (Ispecific (Ifar_alloc num_words)) -+ -+ let relax_intop_checkbound () = -+ Lop (Ispecific Ifar_intop_checkbound) -+ -+ let relax_intop_imm_checkbound ~bound = -+ Lop (Ispecific (Ifar_intop_imm_checkbound bound)) -+ -+ let relax_specific_op = function -+ | Ishiftcheckbound shift -> Lop (Ispecific (Ifar_shiftcheckbound shift)) -+ | _ -> assert false -+end) -+ -+(* Output the assembly code for allocation. *) -+ -+let assembly_code_for_allocation i ~n ~far = -+ let lbl_frame = record_frame_label i.live i.dbg in -+ if !fastcode_flag then begin -+ let lbl_redo = new_label() in -+ let lbl_call_gc = new_label() in -+ `{emit_label lbl_redo}:`; -+ ` sub {emit_reg reg_alloc_ptr}, {emit_reg reg_alloc_ptr}, #{emit_int n}\n`; -+ ` cmp {emit_reg reg_alloc_ptr}, {emit_reg reg_alloc_limit}\n`; -+ ` add {emit_reg i.res.(0)}, {emit_reg reg_alloc_ptr}, #8\n`; -+ if not far then begin -+ ` b.lo {emit_label lbl_call_gc}\n` -+ end else begin -+ let lbl = new_label () in -+ ` b.cs {emit_label lbl}\n`; -+ ` b {emit_label lbl_call_gc}\n`; -+ `{emit_label lbl}:\n` -+ end; -+ call_gc_sites := -+ { gc_lbl = lbl_call_gc; -+ gc_return_lbl = lbl_redo; -+ gc_frame_lbl = lbl_frame } :: !call_gc_sites -+ end else begin -+ begin match n with -+ | 16 -> ` bl {emit_symbol "caml_alloc1"}\n` -+ | 24 -> ` bl {emit_symbol "caml_alloc2"}\n` -+ | 32 -> ` bl {emit_symbol "caml_alloc3"}\n` -+ | _ -> emit_intconst reg_x15 (Nativeint.of_int n); -+ ` bl {emit_symbol "caml_allocN"}\n` -+ end; -+ `{emit_label lbl_frame}: add {emit_reg i.res.(0)}, {emit_reg reg_alloc_ptr}, #8\n` -+ end -+ - (* Output the assembly code for an instruction *) - - let emit_instr i = -@@ -410,29 +647,9 @@ let emit_instr i = - ` str {emit_reg src}, {emit_addressing addr base}\n` - end - | Lop(Ialloc n) -> -- let lbl_frame = record_frame_label i.live i.dbg in -- if !fastcode_flag then begin -- let lbl_redo = new_label() in -- let lbl_call_gc = new_label() in -- `{emit_label lbl_redo}:`; -- ` sub {emit_reg reg_alloc_ptr}, {emit_reg reg_alloc_ptr}, #{emit_int n}\n`; -- ` cmp {emit_reg reg_alloc_ptr}, {emit_reg reg_alloc_limit}\n`; -- ` add {emit_reg i.res.(0)}, {emit_reg reg_alloc_ptr}, #8\n`; -- ` b.lo {emit_label lbl_call_gc}\n`; -- call_gc_sites := -- { gc_lbl = lbl_call_gc; -- gc_return_lbl = lbl_redo; -- gc_frame_lbl = lbl_frame } :: !call_gc_sites -- end else begin -- begin match n with -- | 16 -> ` bl {emit_symbol "caml_alloc1"}\n` -- | 24 -> ` bl {emit_symbol "caml_alloc2"}\n` -- | 32 -> ` bl {emit_symbol "caml_alloc3"}\n` -- | _ -> emit_intconst reg_x15 (Nativeint.of_int n); -- ` bl {emit_symbol "caml_allocN"}\n` -- end; -- `{emit_label lbl_frame}: add {emit_reg i.res.(0)}, {emit_reg reg_alloc_ptr}, #8\n` -- end -+ assembly_code_for_allocation i ~n ~far:false -+ | Lop(Ispecific (Ifar_alloc n)) -> -+ assembly_code_for_allocation i ~n ~far:true - | Lop(Iintop(Icomp cmp)) -> - ` cmp {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; - ` cset {emit_reg i.res.(0)}, {emit_string (name_for_comparison cmp)}\n` -@@ -443,14 +660,35 @@ let emit_instr i = - let lbl = bound_error_label i.dbg in - ` cmp {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; - ` b.ls {emit_label lbl}\n` -+ | Lop(Ispecific Ifar_intop_checkbound) -> -+ let lbl = bound_error_label i.dbg in -+ let lbl2 = new_label () in -+ ` cmp {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; -+ ` b.hi {emit_label lbl2}\n`; -+ ` b {emit_label lbl}\n`; -+ `{emit_label lbl2}:\n`; - | Lop(Iintop_imm(Icheckbound, n)) -> - let lbl = bound_error_label i.dbg in - ` cmp {emit_reg i.arg.(0)}, #{emit_int n}\n`; - ` b.ls {emit_label lbl}\n` -+ | Lop(Ispecific(Ifar_intop_imm_checkbound bound)) -> -+ let lbl = bound_error_label i.dbg in -+ let lbl2 = new_label () in -+ ` cmp {emit_reg i.arg.(0)}, #{emit_int bound}\n`; -+ ` b.hi {emit_label lbl2}\n`; -+ ` b {emit_label lbl}\n`; -+ `{emit_label lbl2}:\n`; - | Lop(Ispecific(Ishiftcheckbound shift)) -> - let lbl = bound_error_label i.dbg in - ` cmp {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}, lsr #{emit_int shift}\n`; - ` b.cs {emit_label lbl}\n` -+ | Lop(Ispecific(Ifar_shiftcheckbound shift)) -> -+ let lbl = bound_error_label i.dbg in -+ let lbl2 = new_label () in -+ ` cmp {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}, lsr #{emit_int shift}\n`; -+ ` b.lo {emit_label lbl2}\n`; -+ ` b {emit_label lbl}\n`; -+ `{emit_label lbl2}:\n`; - | Lop(Iintop Imod) -> - ` sdiv {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; - ` msub {emit_reg i.res.(0)}, {emit_reg reg_tmp1}, {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}\n` -@@ -659,9 +897,19 @@ let fundecl fundecl = - ` str x30, [sp, #{emit_int (n-8)}]\n` - end; - `{emit_label !tailrec_entry_point}:\n`; -+ let num_call_gc, num_check_bound = -+ num_call_gc_and_check_bound_points fundecl.fun_body -+ in -+ let max_out_of_line_code_offset = -+ max_out_of_line_code_offset fundecl.fun_body ~num_call_gc -+ ~num_check_bound -+ in -+ BR.relax fundecl.fun_body ~max_out_of_line_code_offset; - emit_all fundecl.fun_body; - List.iter emit_call_gc !call_gc_sites; - List.iter emit_call_bound_error !bound_error_sites; -+ assert (List.length !call_gc_sites = num_call_gc); -+ assert (List.length !bound_error_sites = num_check_bound); - cfi_endproc(); - ` .type {emit_symbol fundecl.fun_name}, %function\n`; - ` .size {emit_symbol fundecl.fun_name}, .-{emit_symbol fundecl.fun_name}\n`; -diff --git a/asmcomp/branch_relaxation.ml b/asmcomp/branch_relaxation.ml -new file mode 100644 -index 0000000..d4609e4 ---- /dev/null -+++ b/asmcomp/branch_relaxation.ml -@@ -0,0 +1,138 @@ -+(***********************************************************************) -+(* *) -+(* OCaml *) -+(* *) -+(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) -+(* Mark Shinwell, Jane Street Europe *) -+(* *) -+(* Copyright 1996 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. *) -+(* *) -+(***********************************************************************) -+ -+open Mach -+open Linearize -+ -+module Make (T : Branch_relaxation_intf.S) = struct -+ let label_map code = -+ let map = Hashtbl.create 37 in -+ let rec fill_map pc instr = -+ match instr.desc with -+ | Lend -> (pc, map) -+ | Llabel lbl -> Hashtbl.add map lbl pc; fill_map pc instr.next -+ | op -> fill_map (pc + T.instr_size op) instr.next -+ in -+ fill_map 0 code -+ -+ let branch_overflows map pc_branch lbl_dest max_branch_offset = -+ let pc_dest = Hashtbl.find map lbl_dest in -+ let delta = pc_dest - (pc_branch + T.offset_pc_at_branch) in -+ delta <= -max_branch_offset || delta >= max_branch_offset -+ -+ let opt_branch_overflows map pc_branch opt_lbl_dest max_branch_offset = -+ match opt_lbl_dest with -+ | None -> false -+ | Some lbl_dest -> -+ branch_overflows map pc_branch lbl_dest max_branch_offset -+ -+ let instr_overflows ~code_size ~max_out_of_line_code_offset instr map pc = -+ match T.Cond_branch.classify_instr instr.desc with -+ | None -> false -+ | Some branch -> -+ let max_branch_offset = -+ (* Remember to cut some slack for multi-word instructions (in the -+ [Linearize] sense of the word) where the branch can be anywhere in -+ the middle. 12 words of slack is plenty. *) -+ T.Cond_branch.max_displacement branch - 12 -+ in -+ match instr.desc with -+ | Lop (Ialloc _) -+ | Lop (Iintop Icheckbound) -+ | Lop (Iintop_imm (Icheckbound, _)) -+ | Lop (Ispecific _) -> -+ (* We assume that any branches eligible for relaxation generated -+ by these instructions only branch forward. We further assume -+ that any of these may branch to an out-of-line code block. *) -+ code_size + max_out_of_line_code_offset - pc >= max_branch_offset -+ | Lcondbranch (_, lbl) -> -+ branch_overflows map pc lbl max_branch_offset -+ | Lcondbranch3 (lbl0, lbl1, lbl2) -> -+ opt_branch_overflows map pc lbl0 max_branch_offset -+ || opt_branch_overflows map pc lbl1 max_branch_offset -+ || opt_branch_overflows map pc lbl2 max_branch_offset -+ | _ -> -+ Misc.fatal_error "Unsupported instruction for branch relaxation" -+ -+ let fixup_branches ~code_size ~max_out_of_line_code_offset map code = -+ let expand_optbranch lbl n arg next = -+ match lbl with -+ | None -> next -+ | Some l -> -+ instr_cons (Lcondbranch (Iinttest_imm (Isigned Cmm.Ceq, n), l)) -+ arg [||] next -+ in -+ let rec fixup did_fix pc instr = -+ match instr.desc with -+ | Lend -> did_fix -+ | _ -> -+ let overflows = -+ instr_overflows ~code_size ~max_out_of_line_code_offset instr map pc -+ in -+ if not overflows then -+ fixup did_fix (pc + T.instr_size instr.desc) instr.next -+ else -+ match instr.desc with -+ | Lop (Ialloc num_words) -> -+ instr.desc <- T.relax_allocation ~num_words; -+ fixup true (pc + T.instr_size instr.desc) instr.next -+ | Lop (Iintop Icheckbound) -> -+ instr.desc <- T.relax_intop_checkbound (); -+ fixup true (pc + T.instr_size instr.desc) instr.next -+ | Lop (Iintop_imm (Icheckbound, bound)) -> -+ instr.desc <- T.relax_intop_imm_checkbound ~bound; -+ fixup true (pc + T.instr_size instr.desc) instr.next -+ | Lop (Ispecific specific) -> -+ instr.desc <- T.relax_specific_op specific; -+ fixup true (pc + T.instr_size instr.desc) instr.next -+ | Lcondbranch (test, lbl) -> -+ let lbl2 = new_label() in -+ let cont = -+ instr_cons (Lbranch lbl) [||] [||] -+ (instr_cons (Llabel lbl2) [||] [||] instr.next) -+ in -+ instr.desc <- Lcondbranch (invert_test test, lbl2); -+ instr.next <- cont; -+ fixup true (pc + T.instr_size instr.desc) instr.next -+ | Lcondbranch3 (lbl0, lbl1, lbl2) -> -+ let cont = -+ expand_optbranch lbl0 0 instr.arg -+ (expand_optbranch lbl1 1 instr.arg -+ (expand_optbranch lbl2 2 instr.arg instr.next)) -+ in -+ instr.desc <- cont.desc; -+ instr.next <- cont.next; -+ fixup true pc instr -+ | _ -> -+ (* Any other instruction has already been rejected in -+ [instr_overflows] above. -+ We can *never* get here. *) -+ assert false -+ in -+ fixup false 0 code -+ -+ (* Iterate branch expansion till all conditional branches are OK *) -+ -+ let rec relax code ~max_out_of_line_code_offset = -+ let min_of_max_branch_offsets = -+ List.fold_left (fun min_of_max_branch_offsets branch -> -+ min min_of_max_branch_offsets -+ (T.Cond_branch.max_displacement branch)) -+ max_int T.Cond_branch.all -+ in -+ let (code_size, map) = label_map code in -+ if code_size >= min_of_max_branch_offsets -+ && fixup_branches ~code_size ~max_out_of_line_code_offset map code -+ then relax code ~max_out_of_line_code_offset -+ else () -+end -diff --git a/asmcomp/branch_relaxation.mli b/asmcomp/branch_relaxation.mli -new file mode 100644 -index 0000000..9d517b1 ---- /dev/null -+++ b/asmcomp/branch_relaxation.mli -@@ -0,0 +1,26 @@ -+(***********************************************************************) -+(* *) -+(* OCaml *) -+(* *) -+(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) -+(* Mark Shinwell, Jane Street Europe *) -+(* *) -+(* Copyright 1996 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. *) -+(* *) -+(***********************************************************************) -+ -+(* Fix up conditional branches that exceed hardware-allowed ranges. *) -+ -+module Make (T : Branch_relaxation_intf.S) : sig -+ val relax -+ : Linearize.instruction -+ (* [max_offset_of_out_of_line_code] specifies the furthest distance, -+ measured from the first address immediately after the last instruction -+ of the function, that may be branched to from within the function in -+ order to execute "out of line" code blocks such as call GC and -+ bounds check points. *) -+ -> max_out_of_line_code_offset:T.distance -+ -> unit -+end -diff --git a/asmcomp/branch_relaxation_intf.ml b/asmcomp/branch_relaxation_intf.ml -new file mode 100644 -index 0000000..610d0d0 ---- /dev/null -+++ b/asmcomp/branch_relaxation_intf.ml -@@ -0,0 +1,63 @@ -+(***********************************************************************) -+(* *) -+(* OCaml *) -+(* *) -+(* Mark Shinwell, Jane Street Europe *) -+(* *) -+(* Copyright 1996 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. *) -+(* *) -+(***********************************************************************) -+ -+module type S = sig -+ (* The distance between two instructions, in arbitrary units (typically -+ the natural word size of instructions). *) -+ type distance = int -+ -+ module Cond_branch : sig -+ (* The various types of conditional branches for a given target that -+ may require relaxation. *) -+ type t -+ -+ (* All values of type [t] that the emitter may produce. *) -+ val all : t list -+ -+ (* If [max_displacement branch] is [n] then [branch] is assumed to -+ reach any address in the range [pc - n, pc + n] (inclusive), after -+ the [pc] of the branch has been adjusted by [offset_pc_at_branch] -+ (see below). *) -+ val max_displacement : t -> distance -+ -+ (* Which variety of conditional branch may be produced by the emitter for a -+ given instruction description. For the moment we assume that only one -+ such variety per instruction description is needed. -+ -+ N.B. The only instructions supported are the following: -+ - Lop (Ialloc _) -+ - Lop (Iintop Icheckbound) -+ - Lop (Iintop_imm (Icheckbound, _)) -+ - Lop (Ispecific _) -+ - Lcondbranch (_, _) -+ - Lcondbranch3 (_, _, _) -+ [classify_instr] is expected to return [None] when called on any -+ instruction not in this list. *) -+ val classify_instr : Linearize.instruction_desc -> t option -+ end -+ -+ (* The value to be added to the program counter (in [distance] units) -+ when it is at a branch instruction, prior to calculating the distance -+ to a branch target. *) -+ val offset_pc_at_branch : distance -+ -+ (* The maximum size of a given instruction. *) -+ val instr_size : Linearize.instruction_desc -> distance -+ -+ (* Insertion of target-specific code to relax operations that cannot be -+ relaxed generically. It is assumed that these rewrites do not change -+ the size of out-of-line code (cf. branch_relaxation.mli). *) -+ val relax_allocation : num_words:int -> Linearize.instruction_desc -+ val relax_intop_checkbound : unit -> Linearize.instruction_desc -+ val relax_intop_imm_checkbound : bound:int -> Linearize.instruction_desc -+ val relax_specific_op : Arch.specific_operation -> Linearize.instruction_desc -+end -diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp -index 8e31b58..717ab12 100644 ---- a/asmcomp/power/emit.mlp -+++ b/asmcomp/power/emit.mlp -@@ -308,126 +308,87 @@ let defined_functions = ref StringSet.empty - (* Label of glue code for calling the GC *) - let call_gc_label = ref 0 - --(* Fixup conditional branches that exceed hardware allowed range *) -+module BR = Branch_relaxation.Make (struct -+ type distance = int - --let load_store_size = function -- Ibased(s, d) -> 2 -- | Iindexed ofs -> if is_immediate ofs then 1 else 3 -- | Iindexed2 -> 1 -+ module Cond_branch = struct -+ type t = Branch - --let instr_size = function -- Lend -> 0 -- | Lop(Imove | Ispill | Ireload) -> 1 -- | Lop(Iconst_int n | Iconst_blockheader n) -> -- if is_native_immediate n then 1 else 2 -- | Lop(Iconst_float s) -> 2 -- | Lop(Iconst_symbol s) -> 2 -- | Lop(Icall_ind) -> 2 -- | Lop(Icall_imm s) -> 1 -- | Lop(Itailcall_ind) -> 5 -- | Lop(Itailcall_imm s) -> if s = !function_name then 1 else 4 -- | Lop(Iextcall(s, true)) -> 3 -- | Lop(Iextcall(s, false)) -> if pic_externals then 4 else 1 -- | Lop(Istackoffset n) -> 1 -- | Lop(Iload(chunk, addr)) -> -+ let all = [Branch] -+ -+ let max_displacement = function -+ (* 14-bit signed offset in words. *) -+ | Branch -> 8192 -+ -+ let classify_instr = function -+ | Lop (Ialloc _) -+ (* [Ialloc_far] does not need to be here, since its code sequence -+ never involves any conditional branches that might need relaxing. *) -+ | Lcondbranch _ -+ | Lcondbranch3 _ -> Some Branch -+ | _ -> None -+ end -+ -+ let offset_pc_at_branch = 1 -+ -+ let load_store_size = function -+ | Ibased(s, d) -> 2 -+ | Iindexed ofs -> if is_immediate ofs then 1 else 3 -+ | Iindexed2 -> 1 -+ -+ let instr_size = function -+ | Lend -> 0 -+ | Lop(Imove | Ispill | Ireload) -> 1 -+ | Lop(Iconst_int n | Iconst_blockheader n) -> -+ if is_native_immediate n then 1 else 2 -+ | Lop(Iconst_float s) -> 2 -+ | Lop(Iconst_symbol s) -> 2 -+ | Lop(Icall_ind) -> 2 -+ | Lop(Icall_imm s) -> 1 -+ | Lop(Itailcall_ind) -> 5 -+ | Lop(Itailcall_imm s) -> if s = !function_name then 1 else 4 -+ | Lop(Iextcall(s, true)) -> 3 -+ | Lop(Iextcall(s, false)) -> if pic_externals then 4 else 1 -+ | Lop(Istackoffset n) -> 1 -+ | Lop(Iload(chunk, addr)) -> - if chunk = Byte_signed - then load_store_size addr + 1 - else load_store_size addr -- | Lop(Istore(chunk, addr, _)) -> load_store_size addr -- | Lop(Ialloc n) -> 4 -- | Lop(Ispecific(Ialloc_far n)) -> 5 -- | Lop(Iintop Imod) -> 3 -- | Lop(Iintop(Icomp cmp)) -> 4 -- | Lop(Iintop op) -> 1 -- | Lop(Iintop_imm(Icomp cmp, n)) -> 4 -- | Lop(Iintop_imm(op, n)) -> 1 -- | Lop(Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf) -> 1 -- | Lop(Ifloatofint) -> 9 -- | Lop(Iintoffloat) -> 4 -- | Lop(Ispecific sop) -> 1 -- | Lreloadretaddr -> 2 -- | Lreturn -> 2 -- | Llabel lbl -> 0 -- | Lbranch lbl -> 1 -- | Lcondbranch(tst, lbl) -> 2 -- | Lcondbranch3(lbl0, lbl1, lbl2) -> -+ | Lop(Istore(chunk, addr, _)) -> load_store_size addr -+ | Lop(Ialloc n) -> 4 -+ | Lop(Ispecific(Ialloc_far n)) -> 5 -+ | Lop(Iintop Imod) -> 3 -+ | Lop(Iintop(Icomp cmp)) -> 4 -+ | Lop(Iintop op) -> 1 -+ | Lop(Iintop_imm(Icomp cmp, n)) -> 4 -+ | Lop(Iintop_imm(op, n)) -> 1 -+ | Lop(Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf) -> 1 -+ | Lop(Ifloatofint) -> 9 -+ | Lop(Iintoffloat) -> 4 -+ | Lop(Ispecific sop) -> 1 -+ | Lreloadretaddr -> 2 -+ | Lreturn -> 2 -+ | Llabel lbl -> 0 -+ | Lbranch lbl -> 1 -+ | Lcondbranch(tst, lbl) -> 2 -+ | Lcondbranch3(lbl0, lbl1, lbl2) -> - 1 + (if lbl0 = None then 0 else 1) - + (if lbl1 = None then 0 else 1) - + (if lbl2 = None then 0 else 1) -- | Lswitch jumptbl -> 8 -- | Lsetuptrap lbl -> 1 -- | Lpushtrap -> 4 -- | Lpoptrap -> 2 -- | Lraise _ -> 6 -- --let label_map code = -- let map = Hashtbl.create 37 in -- let rec fill_map pc instr = -- match instr.desc with -- Lend -> (pc, map) -- | Llabel lbl -> Hashtbl.add map lbl pc; fill_map pc instr.next -- | op -> fill_map (pc + instr_size op) instr.next -- in fill_map 0 code -- --let max_branch_offset = 8180 --(* 14-bit signed offset in words. Remember to cut some slack -- for multi-word instructions where the branch can be anywhere in -- the middle. 12 words of slack is plenty. *) -- --let branch_overflows map pc_branch lbl_dest = -- let pc_dest = Hashtbl.find map lbl_dest in -- let delta = pc_dest - (pc_branch + 1) in -- delta <= -max_branch_offset || delta >= max_branch_offset -- --let opt_branch_overflows map pc_branch opt_lbl_dest = -- match opt_lbl_dest with -- None -> false -- | Some lbl_dest -> branch_overflows map pc_branch lbl_dest -- --let fixup_branches codesize map code = -- let expand_optbranch lbl n arg next = -- match lbl with -- None -> next -- | Some l -> -- instr_cons (Lcondbranch(Iinttest_imm(Isigned Ceq, n), l)) -- arg [||] next in -- let rec fixup did_fix pc instr = -- match instr.desc with -- Lend -> did_fix -- | Lcondbranch(test, lbl) when branch_overflows map pc lbl -> -- let lbl2 = new_label() in -- let cont = -- instr_cons (Lbranch lbl) [||] [||] -- (instr_cons (Llabel lbl2) [||] [||] instr.next) in -- instr.desc <- Lcondbranch(invert_test test, lbl2); -- instr.next <- cont; -- fixup true (pc + 2) instr.next -- | Lcondbranch3(lbl0, lbl1, lbl2) -- when opt_branch_overflows map pc lbl0 -- || opt_branch_overflows map pc lbl1 -- || opt_branch_overflows map pc lbl2 -> -- let cont = -- expand_optbranch lbl0 0 instr.arg -- (expand_optbranch lbl1 1 instr.arg -- (expand_optbranch lbl2 2 instr.arg instr.next)) in -- instr.desc <- cont.desc; -- instr.next <- cont.next; -- fixup true pc instr -- | Lop(Ialloc n) when codesize - pc >= max_branch_offset -> -- instr.desc <- Lop(Ispecific(Ialloc_far n)); -- fixup true (pc + 4) instr.next -- | op -> -- fixup did_fix (pc + instr_size op) instr.next -- in fixup false 0 code -- --(* Iterate branch expansion till all conditional branches are OK *) -- --let rec branch_normalization code = -- let (codesize, map) = label_map code in -- if codesize >= max_branch_offset && fixup_branches codesize map code -- then branch_normalization code -- else () -- -+ | Lswitch jumptbl -> 8 -+ | Lsetuptrap lbl -> 1 -+ | Lpushtrap -> 4 -+ | Lpoptrap -> 2 -+ | Lraise _ -> 6 -+ -+ let relax_allocation ~num_words = Lop (Ispecific (Ialloc_far num_words)) -+ -+ (* [classify_addr], above, never identifies these instructions as needing -+ relaxing. As such, these functions should never be called. *) -+ let relax_specific_op _ = assert false -+ let relax_intop_checkbound () = assert false -+ let relax_intop_imm_checkbound ~bound:_ = assert false -+end) - - (* Output the assembly code for an instruction *) - -@@ -848,7 +809,10 @@ let fundecl fundecl = - ` addi {emit_gpr 1}, {emit_gpr 1}, {emit_int(-n)}\n` - end; - `{emit_label !tailrec_entry_point}:\n`; -- branch_normalization fundecl.fun_body; -+ (* On this target, there is at most one "out of line" code block per -+ function: a single "call GC" point. It comes immediately after the -+ function's body. *) -+ BR.relax fundecl.fun_body ~max_out_of_line_code_offset:0; - emit_all fundecl.fun_body; - (* Emit the glue code to call the GC *) - if !call_gc_label > 0 then begin --- -2.3.1 - diff --git a/ocaml.spec b/ocaml.spec index 79b0d65..e226029 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -16,8 +16,8 @@ %endif Name: ocaml -Version: 4.02.1 -Release: 7%{?dist} +Version: 4.02.2 +Release: 0.rc1.1%{?dist} Summary: OCaml compiler and programming environment @@ -25,7 +25,9 @@ License: QPL and (LGPLv2+ with exceptions) URL: http://www.ocaml.org -Source0: http://caml.inria.fr/pub/distrib/ocaml-4.02/%{name}-%{version}.tar.gz +# There's no 4.02.2+rc1 tarball, but you can grab it from github here: +# https://github.com/ocaml/ocaml/tarball/4.02.2+rc1 +Source0: ocaml-ocaml-4.02.2-rc1-0-g2eb6db8.tar.gz Source1: http://caml.inria.fr/pub/distrib/ocaml-4.02/ocaml-4.02-refman-html.tar.gz Source2: http://caml.inria.fr/pub/distrib/ocaml-4.02/ocaml-4.02-refman.pdf Source3: http://caml.inria.fr/pub/distrib/ocaml-4.02/ocaml-4.02-refman.info.tar.gz @@ -60,9 +62,7 @@ Patch0012: 0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch Patch0013: 0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch Patch0014: 0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch Patch0015: 0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch -Patch0016: 0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch -Patch0017: 0017-ppc64le-Fix-calling-convention-of-external-functions.patch -Patch0018: 0018-Fix-PR-6878-AArch64-conditional-branches-out-of-rang.patch +Patch0016: 0016-ppc64le-Fix-calling-convention-of-external-functions.patch # Add BFD support so that ocamlobjinfo supports *.cmxs format (RHBZ#1113735). BuildRequires: binutils-devel @@ -194,9 +194,12 @@ may not be portable between versions. %prep -%setup -q -T -b 0 -n %{name}-%{version} -%setup -q -T -D -a 1 -n %{name}-%{version} -%setup -q -T -D -a 3 -n %{name}-%{version} +%setup -q -T -b 0 -n ocaml-ocaml-2eb6db8 +%setup -q -T -D -a 1 -n ocaml-ocaml-2eb6db8 +%setup -q -T -D -a 3 -n ocaml-ocaml-2eb6db8 +#%setup -q -T -b 0 -n %{name}-%{version} +#%setup -q -T -D -a 1 -n %{name}-%{version} +#%setup -q -T -D -a 3 -n %{name}-%{version} cp %{SOURCE2} refman.pdf git init @@ -343,6 +346,7 @@ fi %{_libdir}/ocaml/*.cmxa %{_libdir}/ocaml/*.cmx %{_libdir}/ocaml/*.o +%{_libdir}/ocaml/libasmrun_shared.so %endif %{_libdir}/ocaml/*.mli %{_libdir}/ocaml/libcamlrun_shared.so @@ -424,6 +428,11 @@ fi %changelog +* Tue Jul 16 2015 Richard W.M. Jones - 4.02.2-0.rc1.1 +- New upstream version: 4.02.2+rc1. +- Dropped two aarch64 patches which are now included upstream. +- Includes libasmrun_shared.so (RHBZ#1195025). + * Wed Jun 10 2015 Richard W.M. Jones - 4.02.1-7 - aarch64: Use upstream version of patch that fixes RHBZ#1224815. diff --git a/sources b/sources index 61d5e5f..a98504e 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ 20b691d71d36df69f9cb16ab4521ed49 ocaml-4.02-refman-html.tar.gz 265b7db123e925e8b7b70ca2266b4206 ocaml-4.02-refman.info.tar.gz 1d683029a6ef48e34cc24eb1982cdd05 ocaml-4.02-refman.pdf -3c35318eefd201f96797c093c920b343 ocaml-4.02.1.tar.gz +5444ee57d65d457d3524d293a51f3ae8 ocaml-ocaml-4.02.2-rc1-0-g2eb6db8.tar.gz