aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2018-07-17 13:51:59 +0200
committerPierre-Marie Pédrot2018-07-24 14:13:11 +0200
commit4da752354f04090cc69c3d85a34059b8d9e28be2 (patch)
tree4184a6469d2067d1849ee04f38df6644ddd7c321 /kernel
parent388e65b550a6dd12fa4e59b26e03a831ebd842ce (diff)
Properly disable native compilation when -native-compiler is unset.
There was a function used by the pretyper that did not check that the flag was set, leading to native compilation even when the configure flag was off.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/nativeconv.ml22
-rw-r--r--kernel/nativelib.ml1
2 files changed, 12 insertions, 11 deletions
diff --git a/kernel/nativeconv.ml b/kernel/nativeconv.ml
index e97dbd0d67..931b8bbc86 100644
--- a/kernel/nativeconv.ml
+++ b/kernel/nativeconv.ml
@@ -135,7 +135,18 @@ and conv_fix env lvl t1 f1 t2 f2 cu =
else aux (i+1) (conv_val env CONV flvl fi1 fi2 cu) in
aux 0 cu
+let warn_no_native_compiler =
+ let open Pp in
+ CWarnings.create ~name:"native-compiler-disabled" ~category:"native-compiler"
+ (fun () -> strbrk "Native compiler is disabled," ++
+ strbrk " falling back to VM conversion test.")
+
let native_conv_gen pb sigma env univs t1 t2 =
+ if not Coq_config.native_compiler then begin
+ warn_no_native_compiler ();
+ Vconv.vm_conv_gen pb env univs t1 t2
+ end
+ else
let ml_filename, prefix = get_ml_filename () in
let code, upds = mk_conv_code env sigma prefix t1 t2 in
match compile ml_filename code ~profile:false with
@@ -152,19 +163,8 @@ let native_conv_gen pb sigma env univs t1 t2 =
end
| _ -> anomaly (Pp.str "Compilation failure.")
-let warn_no_native_compiler =
- let open Pp in
- CWarnings.create ~name:"native-compiler-disabled" ~category:"native-compiler"
- (fun () -> strbrk "Native compiler is disabled," ++
- strbrk " falling back to VM conversion test.")
-
(* Wrapper for [native_conv] above *)
let native_conv cv_pb sigma env t1 t2 =
- if not Coq_config.native_compiler then begin
- warn_no_native_compiler ();
- Vconv.vm_conv cv_pb env t1 t2
- end
- else
let univs = Environ.universes env in
let b =
if cv_pb = CUMUL then Constr.leq_constr_univs univs t1 t2
diff --git a/kernel/nativelib.ml b/kernel/nativelib.ml
index 31ad364911..f784509b6f 100644
--- a/kernel/nativelib.ml
+++ b/kernel/nativelib.ml
@@ -67,6 +67,7 @@ let warn_native_compiler_failed =
CWarnings.create ~name:"native-compiler-failed" ~category:"native-compiler" print
let call_compiler ?profile:(profile=false) ml_filename =
+ let () = assert Coq_config.native_compiler in
let load_path = !get_load_paths () in
let load_path = List.map (fun dn -> dn / output_dir) load_path in
let include_dirs = List.flatten (List.map (fun x -> ["-I"; x]) (include_dirs () @ load_path)) in