Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] Refactor most of Decl_kinds #10419

Merged
merged 10 commits into from Jul 3, 2019
Merged

[api] Refactor most of Decl_kinds #10419

merged 10 commits into from Jul 3, 2019

Conversation

ejgallego
Copy link
Member

@ejgallego ejgallego commented Jun 21, 2019

We move the bulk of Decl_kinds to a better place [namely
interp/decls] and refactor the use of this information quite a bit.

The information seems to be used almost only for Dumpglob, so it
certainly should end there to achieve a cleaner core.

In particular the use of "variable" data stored in Decls seems very suspicious.

IMO this may need a bit more work, but this should be a good start, I wonder what people who know more about this variable data stuff can say.

Overlays:

@ejgallego ejgallego added kind: cleanup Code removal, deprecation, refactorings, etc. needs: merge of dependency This PR depends on another PR being merged first. labels Jun 21, 2019
@ejgallego
Copy link
Member Author

ejgallego commented Jun 21, 2019

Sadly this had to depend on the previous kind cleanup, last 4 commits are the relevant ones.

@ejgallego
Copy link
Member Author

cc: #10417

@ejgallego ejgallego force-pushed the heads+test branch 11 times, most recently from 5c0729d to cbe628a Compare June 25, 2019 16:44
@ejgallego ejgallego removed the needs: merge of dependency This PR depends on another PR being merged first. label Jun 25, 2019
@ejgallego
Copy link
Member Author

ejgallego commented Jun 25, 2019

Ok, this may still need some thinking but IMHO the bulk is ready for review.

This PR also answers a question posed by @maximedenes about Decl_kinds some time ago on Gitter.

@ejgallego ejgallego marked this pull request as ready for review June 25, 2019 16:44
@ejgallego ejgallego added this to Ready in Emilio's PR Jun 25, 2019
We move the bulk of `Decl_kinds` to a better place [namely
`interp/decls`] and refactor the use of this information quite a bit.

The information seems to be used almost only for `Dumpglob`, so it
certainly should end there to achieve a cleaner core.

Note the previous commits, as well as the annotations regarding the
dubious use of the "variable" data managed by the `Decls` file.

IMO this needs more work, but this should be a good start.
The whole business of cst_kind is fishy tho, it seems to me that it
should be removed from the libobject path.
They are clearly not at the same importance level, thus we use a named
parameter and isolate the kinds as to allow further improvements and
refactoring.
We remove two flags that were seldom used in favor of named parameters.
We can use logical kind for the same purpose, which is mainly
dumpglob, so `goal_object_kind` was never matched against, making this
transformation safe.
`declare_definition` didn't improve a lot the declare path and was
used only once on interesting code. Also, it had many optional
parameters. The declare path is critical enough as to care about a
tidy API.
ejgallego added a commit to ejgallego/coq that referenced this pull request Jul 1, 2019
Copy link
Contributor

@SkySkimmer SkySkimmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by the AlreadyDeclared name change, see comment.

pretyping/heads.ml Show resolved Hide resolved
tactics/hints.ml Show resolved Hide resolved
tactics/declare.ml Outdated Show resolved Hide resolved
@SkySkimmer SkySkimmer self-requested a review July 2, 2019 10:14
val variable_opacity : variable -> bool

(* Used in declare, very dubious *)
val variable_context : variable -> Univ.ContextSet.t
val variable_polymorphic : variable -> bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 can be removed: #10461.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!


val add_variable_data : variable -> variable_data -> unit

(* Not used *)
val variable_path : variable -> DirPath.t
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why keep it then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I though we could address the refactoring of this module in its own PR.

We cleanup a few imports on Declare, and indeed we find a suspicious
exception `AlreadyDeclared` present in `CErrors` where it should not
be there.

We move it to `Declare`, waiting for more investigation.
We should have this in the check target, but meanwhile we have to do
manual housekeeping here.
@ejgallego
Copy link
Member Author

Wrong label for exception fixed.

ejgallego added a commit to ejgallego/Mtac2 that referenced this pull request Jul 2, 2019
@SkySkimmer
Copy link
Contributor

Bench said: https://ci.inria.fr/coq/view/benchmarking/job/benchmark-part-of-the-branch/740/console

┌────────────────────────┬─────────────────────────┬─────────────────────────────────────────────┬─────────────────────────────────────────────┬───────────────────────────────┬────────────────────────────┐
│                        │      user time [s]      │                 CPU cycles                  │              CPU instructions               │     max resident mem [KB]     │         mem faults         │
│                        │                         │                                             │                                             │                               │                            │
│           package_name │     NEW     OLD PDIFF   │               NEW               OLD PDIFF   │               NEW               OLD PDIFF   │        NEW        OLD PDIFF   │     NEW     OLD    PDIFF   │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│ coq-mathcomp-odd-order │ 1442.50 1458.75 -1.11 % │     4019138244673     4065469797816 -1.14 % │     6892441543259     6892542837063 -0.00 % │    1260556    1261184 -0.05 % │      47      47    +0.00 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│               coq-hott │  336.69  339.86 -0.93 % │      916733980534      923761093517 -0.76 % │     1395810923662     1395881699780 -0.01 % │     476688     476760 -0.02 % │     461     246   +87.40 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│  coq-mathcomp-fingroup │   51.22   51.61 -0.76 % │      142900339278      143564018087 -0.46 % │      186634618068      186627699278 +0.00 % │     561848     561932 -0.01 % │       6       6    +0.00 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│               coq-corn │ 1451.26 1459.70 -0.58 % │     4048098364168     4070176691336 -0.54 % │     6014993897014     6016086079992 -0.02 % │     890852     890964 -0.01 % │       2      90   -97.78 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│       coq-math-classes │  216.26  217.33 -0.49 % │      603926547891      606216779064 -0.38 % │      767971490360      768009387247 -0.00 % │     514432     514728 -0.06 % │      38      21   +80.95 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│             coq-geocoq │ 1930.25 1939.29 -0.47 % │     5383889804479     5410473326192 -0.49 % │     7841829160819     7841906972372 -0.00 % │    1255740    1255052 +0.05 % │     197     321   -38.63 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│ coq-fiat-crypto-legacy │ 6285.61 6312.88 -0.43 % │    17495599522421    17565490583381 -0.40 % │    28549599928989    28541812067200 +0.03 % │    2384160    2382872 +0.05 % │    1241    1285    -3.42 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│       coq-fiat-parsers │  634.21  636.91 -0.42 % │     1775033664920     1779992713008 -0.28 % │     2689610457186     2689406053915 +0.01 % │    3224380    3232320 -0.25 % │     366     735   -50.20 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│          coq-fourcolor │ 2159.80 2168.60 -0.41 % │     6024004942988     6048210323515 -0.40 % │    11362187341614    11361292780277 +0.01 % │     927492     927232 +0.03 % │      14       0     +nan % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│              coq-flocq │  459.60  461.38 -0.39 % │     1279308999366     1284256664082 -0.39 % │     1776323854898     1776450666727 -0.01 % │    1148336    1142520 +0.51 % │     335     130  +157.69 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│     coq-mathcomp-field │  230.76  231.58 -0.35 % │      642860814926      644919880708 -0.32 % │      919014944992      919089449538 -0.01 % │     750228     750076 +0.02 % │       0      74  -100.00 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│  coq-mathcomp-solvable │  189.12  189.72 -0.32 % │      526662207439      528062321307 -0.27 % │      704260592764      704072098767 +0.03 % │     784608     784692 -0.01 % │      11       8   +37.50 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│ coq-mathcomp-ssreflect │   40.05   40.16 -0.27 % │      110726732783      110760794607 -0.03 % │      133923775340      133873444937 +0.04 % │     520132     520276 -0.03 % │     139      10 +1290.00 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│        coq-fiat-crypto │ 3786.32 3796.34 -0.26 % │    10516481159588    10539476614002 -0.22 % │    16527919785618    16530098322822 -0.01 % │    2334888    2336228 -0.06 % │    1072     978    +9.61 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│        coq-lambda-rust │ 1526.89 1529.98 -0.20 % │     4255945102481     4262139709277 -0.15 % │     5646700255264     5637792099288 +0.16 % │    1477424    1481060 -0.25 % │       0       0     +nan % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│            coq-unimath │ 3073.79 3079.25 -0.18 % │     8562257962815     8579532086053 -0.20 % │    15404796362866    15407973302118 -0.02 % │    3761044    3774284 -0.35 % │     596     545    +9.36 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│         coq-verdi-raft │ 1316.64 1318.68 -0.15 % │     3672397520260     3676508243756 -0.11 % │     4987729015889     4987340684401 +0.01 % │    1811308    1811348 -0.00 % │       0     105  -100.00 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│ coq-mathcomp-character │  181.66  181.94 -0.15 % │      505997325697      507255845935 -0.25 % │      669759252350      669793966554 -0.01 % │     845092     847148 -0.24 % │      99      43  +130.23 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│              coq-color │  696.78  697.00 -0.03 % │     1946091235560     1945294823675 +0.04 % │     2327521860977     2327162211101 +0.02 % │    1339852    1339892 -0.00 % │     306     503   -39.17 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│            coq-bignums │   68.96   68.97 -0.01 % │      191242708676      192014270524 -0.40 % │      253786520957      253769648570 +0.01 % │     491880     491696 +0.04 % │     183     156   +17.31 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│   coq-mathcomp-algebra │  165.37  165.16 +0.13 % │      459576132797      459995051268 -0.09 % │      568845304033      568839510083 +0.00 % │     609352     612216 -0.47 % │      16      14   +14.29 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│          coq-fiat-core │  108.10  107.92 +0.17 % │      307724213915      307527350654 +0.06 % │      385569641074      384981576798 +0.15 % │     484204     484192 +0.00 % │     642     242  +165.29 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│         coq-coquelicot │   75.88   75.72 +0.21 % │      207703072389      207988297992 -0.14 % │      251943295283      251596054142 +0.14 % │     653860     653968 -0.02 % │     480     204  +135.29 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│              coq-verdi │  119.20  118.72 +0.40 % │      331229536648      329968434377 +0.38 % │      418059547370      417521062464 +0.13 % │     558920     558420 +0.09 % │       8       6   +33.33 % │
├────────────────────────┼─────────────────────────┼─────────────────────────────────────────────┼─────────────────────────────────────────────┼───────────────────────────────┼────────────────────────────┤
│             coq-sf-plf │   44.12   43.92 +0.46 % │      122673324601      122751929229 -0.06 % │      158931340360      158919558689 +0.01 % │     480676     488832 -1.67 % │     293      23 +1173.91 % │
└────────────────────────┴─────────────────────────┴─────────────────────────────────────────────┴─────────────────────────────────────────────┴───────────────────────────────┴────────────────────────────┘

Copy link
Contributor

@SkySkimmer SkySkimmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good

@SkySkimmer SkySkimmer self-assigned this Jul 3, 2019
@SkySkimmer SkySkimmer added this to the 8.11+beta1 milestone Jul 3, 2019
SkySkimmer added a commit to SkySkimmer/coq that referenced this pull request Jul 3, 2019
Reviewed-by: SkySkimmer
Ack-by: herbelin
SkySkimmer added a commit to coq-community/paramcoq that referenced this pull request Jul 3, 2019
@SkySkimmer SkySkimmer merged commit 6256757 into coq:master Jul 3, 2019
Emilio's PR automation moved this from Ready to Done Jul 3, 2019
bors bot added a commit to Mtac2/Mtac2 that referenced this pull request Jul 3, 2019
218: [coq] Overlay for coq/coq#10419 r=Janno a=ejgallego



Co-authored-by: Emilio Jesus Gallego Arias <e+git@x80.org>
@ejgallego ejgallego deleted the heads+test branch July 3, 2019 10:55
gares added a commit to LPCIC/coq-elpi that referenced this pull request Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: cleanup Code removal, deprecation, refactorings, etc.
Projects
Emilio's PR
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants