summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changes2
-rw-r--r--asmcomp/closure.ml4
-rw-r--r--driver/main_args.ml9
-rw-r--r--driver/main_args.mli1
-rw-r--r--driver/optmain.ml1
-rw-r--r--tools/ocamloptp.ml1
-rw-r--r--utils/clflags.ml2
-rw-r--r--utils/clflags.mli1
8 files changed, 18 insertions, 3 deletions
diff --git a/Changes b/Changes
index 98b4f3eb6..8cf03ef55 100644
--- a/Changes
+++ b/Changes
@@ -100,6 +100,8 @@ Compilers:
(Vladimir Brankov)
- PR#6017: a new format implementation based on GADTs
(BenoƮt Vaugon and Gabriel Scherer)
+- PR#6389: ocamlopt -opaque option for incremental native compilation
+ (Pierre Chambart, Gabriel Scherer)
Toplevel interactive system:
- PR#5377: New "#show_*" directives
diff --git a/asmcomp/closure.ml b/asmcomp/closure.ml
index 9d3749d44..24e866de2 100644
--- a/asmcomp/closure.ml
+++ b/asmcomp/closure.ml
@@ -1291,6 +1291,8 @@ let intro size lam =
global_approx := Array.init size (fun i -> Value_global_field (id, i));
Compilenv.set_global_approx(Value_tuple !global_approx);
let (ulam, approx) = close Tbl.empty Tbl.empty lam in
- collect_exported_structured_constants (Value_tuple !global_approx);
+ if !Clflags.opaque
+ then Compilenv.set_global_approx(Value_unknown)
+ else collect_exported_structured_constants (Value_tuple !global_approx);
global_approx := [||];
ulam
diff --git a/driver/main_args.ml b/driver/main_args.ml
index dd04352ea..829bc9c74 100644
--- a/driver/main_args.ml
+++ b/driver/main_args.ml
@@ -446,6 +446,12 @@ let mk_dstartup f =
"-dstartup", Arg.Unit f, " (undocumented)"
;;
+let mk_opaque f =
+ "-opaque", Arg.Unit f,
+ " Does not generate cross-module optimization information\n\
+ \ (reduces necessary recompilation on module change)"
+;;
+
let mk__ f =
"-", Arg.String f,
"<file> Treat <file> as a file name (even if it starts with `-')"
@@ -515,7 +521,6 @@ module type Compiler_options = sig
val _v : unit -> unit
val _verbose : unit -> unit
val _where : unit -> unit
-
val _nopervasives : unit -> unit
end
;;
@@ -578,6 +583,7 @@ module type Optcomp_options = sig
val _pp : string -> unit
val _S : unit -> unit
val _shared : unit -> unit
+ val _opaque : unit -> unit
end;;
module type Opttop_options = sig
@@ -794,6 +800,7 @@ struct
mk_dscheduling F._dscheduling;
mk_dlinear F._dlinear;
mk_dstartup F._dstartup;
+ mk_opaque F._opaque;
]
end;;
diff --git a/driver/main_args.mli b/driver/main_args.mli
index e4a9c58f5..9a69c799e 100644
--- a/driver/main_args.mli
+++ b/driver/main_args.mli
@@ -137,6 +137,7 @@ module type Optcomp_options = sig
val _pp : string -> unit
val _S : unit -> unit
val _shared : unit -> unit
+ val _opaque : unit -> unit
end;;
module type Opttop_options = sig
diff --git a/driver/optmain.ml b/driver/optmain.ml
index a520a8ce1..cd36e7bd7 100644
--- a/driver/optmain.ml
+++ b/driver/optmain.ml
@@ -149,6 +149,7 @@ module Options = Main_args.Make_optcomp_options (struct
let _dscheduling = set dump_scheduling
let _dlinear = set dump_linear
let _dstartup = set keep_startup_file
+ let _opaque = set opaque
let anonymous = anonymous
end);;
diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml
index 178f7c2d2..4e299c96e 100644
--- a/tools/ocamloptp.ml
+++ b/tools/ocamloptp.ml
@@ -120,6 +120,7 @@ module Options = Main_args.Make_optcomp_options (struct
let _dscheduling = option "-dscheduling"
let _dlinear = option "-dlinear"
let _dstartup = option "-dstartup"
+ let _opaque = option "-opaque"
let anonymous = process_file
end);;
diff --git a/utils/clflags.ml b/utils/clflags.ml
index f582a4655..e771fec5d 100644
--- a/utils/clflags.ml
+++ b/utils/clflags.ml
@@ -71,6 +71,7 @@ and dump_instr = ref false (* -dinstr *)
let keep_asm_file = ref false (* -S *)
let optimize_for_speed = ref true (* -compact *)
+and opaque = ref false (* -opaque *)
and dump_cmm = ref false (* -dcmm *)
let dump_selection = ref false (* -dsel *)
@@ -86,7 +87,6 @@ let dump_scheduling = ref false (* -dscheduling *)
let dump_linear = ref false (* -dlinear *)
let keep_startup_file = ref false (* -dstartup *)
let dump_combine = ref false (* -dcombine *)
-
let native_code = ref false (* set to true under ocamlopt *)
let inline_threshold = ref 10
let force_slash = ref false (* for ocamldep *)
diff --git a/utils/clflags.mli b/utils/clflags.mli
index 5474157c3..97dca6f49 100644
--- a/utils/clflags.mli
+++ b/utils/clflags.mli
@@ -92,3 +92,4 @@ val runtime_variant : string ref
val force_slash : bool ref
val keep_locs : bool ref
val unsafe_string : bool ref
+val opaque : bool ref