aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/nativecode.ml
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-10-24 21:29:41 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-10-24 21:29:41 +0000
commit6da011a8677676462b24940a6171fb22615c3fbb (patch)
tree0df385cc8b8d72b3465d7745d2b97283245c7ed5 /kernel/nativecode.ml
parent133a2143413a723d1d4e3dead5ffa8458f61afa8 (diff)
More monomorphic List.mem + List.assoc + ...
To reduce the amount of syntactic noise, we now provide a few inner modules Int.List, Id.List, String.List, Sorts.List which contain some monomorphic (or semi-monomorphic) functions such as mem, assoc, ... NB: for Int.List.mem and co we reuse List.memq and so on. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16936 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'kernel/nativecode.ml')
-rw-r--r--kernel/nativecode.ml12
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/nativecode.ml b/kernel/nativecode.ml
index d656eceb6..fd8844e00 100644
--- a/kernel/nativecode.ml
+++ b/kernel/nativecode.ml
@@ -615,14 +615,14 @@ let get_rel env id i =
List.nth env.env_rel (i-1)
else
let i = i - env.env_bound in
- try List.assoc_f Int.equal i !(env.env_urel)
+ try Int.List.assoc i !(env.env_urel)
with Not_found ->
let local = MLlocal (fresh_lname id) in
env.env_urel := (i,local) :: !(env.env_urel);
local
let get_var env id =
- try List.assoc_f Id.equal id !(env.env_named)
+ try Id.List.assoc id !(env.env_named)
with Not_found ->
let local = MLlocal (fresh_lname (Name id)) in
env.env_named := (id, local)::!(env.env_named);
@@ -1501,18 +1501,20 @@ let compile_constant env prefix ~interactive con body =
let loaded_native_files = ref ([] : string list)
+let is_loaded_native_file s = String.List.mem s !loaded_native_files
+
let register_native_file s =
- if not (List.mem s !loaded_native_files) then
+ if not (is_loaded_native_file s) then
loaded_native_files := s :: !loaded_native_files
let is_code_loaded ~interactive name =
match !name with
| NotLinked -> false
| LinkedInteractive (s,_) ->
- if (interactive && List.mem s !loaded_native_files) then true
+ if (interactive && is_loaded_native_file s) then true
else (name := NotLinked; false)
| Linked (s,_) ->
- if List.mem s !loaded_native_files then true
+ if is_loaded_native_file s then true
else (name := NotLinked; false)
let param_name = Name (id_of_string "params")