aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2017-04-06 17:34:23 +0200
committerPierre-Marie Pédrot2017-04-06 17:54:41 +0200
commitd6175b9980808ff91f1299ca26a9a49a117169ca (patch)
treef4bf86dc768b66e37d4519f771222f08c5fad333 /plugins
parent2794b3c91bbbef115303b40f2e494ad97467dc9e (diff)
Fix a normalization hotspot in computation of constr keys.
Getting a key only needs to observe the root of a term. This hotspot was observed in HoTT.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ltac/extratactics.ml412
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/ltac/extratactics.ml4 b/plugins/ltac/extratactics.ml4
index b34afd51bd..1ec52718a5 100644
--- a/plugins/ltac/extratactics.ml4
+++ b/plugins/ltac/extratactics.ml4
@@ -1087,10 +1087,14 @@ END
(** library/keys *)
VERNAC COMMAND EXTEND Declare_keys CLASSIFIED AS SIDEFF
-| [ "Declare" "Equivalent" "Keys" constr(c) constr(c') ] -> [
- let it c = EConstr.Unsafe.to_constr (snd (Constrintern.interp_open_constr (Global.env ()) Evd.empty c)) in
- let k1 = Keys.constr_key (it c) in
- let k2 = Keys.constr_key (it c') in
+| [ "Declare" "Equivalent" "Keys" constr(c) constr(c') ] -> [
+ let get_key c =
+ let (evd, c) = Constrintern.interp_open_constr (Global.env ()) Evd.empty c in
+ let kind c = EConstr.kind evd c in
+ Keys.constr_key kind c
+ in
+ let k1 = get_key c in
+ let k2 = get_key c' in
match k1, k2 with
| Some k1, Some k2 -> Keys.declare_equiv_keys k1 k2
| _ -> () ]