Using CInline
to inline local letbindings
#470
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an alternative to #469. In FStarLang/FStar#3418 (which this depends on to really work), I am making F* interpret the
CInline
attribute for local definitions too, and setting a flag in the relevant binder in the extracted krml AST. This PR makes krml pick it up and trigger inlining.For instance, this function:
Now extracts to
Some questions:
0- Does it make sense to reinterpret
CInline
? I could add another attribute if not.1- I think this may require bumping the krml ast version? I see the comment about adding constructors only at the end, but I suppose adding a field to a record is just a backwards-incompatible change...
2- Other than that I wonder if we should have a list of meta instead, like in the ML AST. That would make future extensions easier.
3- Also I would like to add an expected output test for this--- I wrote some makefiles to do it in F* (FStarLang/FStar#3417), but perhaps these tests are better located in this repo? We already have a bit of a circular dependency since we check krmllib in F*, so it wouldn't be crazy to keep them there.