-
Notifications
You must be signed in to change notification settings - Fork 6
autofocus for array resource #25
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
Open
MorelElian
wants to merge
47
commits into
main
Choose a base branch
from
feat/autofocus
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
Author
|
To add : modifies in the candidate and a read in the formula |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Autofocus
Principle
We want to be able to type-check function calls that require only a subset of array resources:
Basic Example:
Will be transformed into
Global flow
Whenever a contract needs to be type-checked, each required resource is processed in two steps.
In the first pass, typing is performed without inference or autofocus. If no available resource can satisfy the requirement, inference and autofocus are then enabled.
Among the available resources, we attempt to determine a sequence of simple ghost focuses that can produce the resource expected by the callee.
A focus corresponds to the instantiation of the iterator variable associated with a resource group.
If the resource has multiple dimensions, each focus represents the instantiation of the iterator for one dimension.
A focus is feasible when it is possible to instantiate the iterator to a specific value that yields the index in the required resource.
Once this list of focuses has been determined, we annotate the function call accordingly.
During the final elaboration phase, this ghost sequence is then materialized.
What works for now
For all the cases below, we managed to : catch the need for a focus, compute the focus list, and annotate the corresponding function call
To be tested
Those are notes for me, maybe you see other things ?
To be added
Those are notes for me, maybe you see other things ?
__modfies(... ~> UninitCell)whichbecomes ... ~>Cell: we cannot directly match the reverse ghost with the ghostExample :
Next steps
Files change / added
ast.ml: Added elaborate trm in the trm contextresource_computation.ml: Added support for autofocus algorithm : infer phase, and re-typing of the ghost sequence.resource_autofocus.ml: core autofocus algorithmspecification.cpp: supported caseIssues
Issue with the ghost:
I am using the function
ghost_admitted_rewritewhich should produces something like:but here i'm only getting :
[&]() { ...}(); }I don't see the "ghost call"
Issue with evar_ctx with un-const int
For the following example:
If i remove the
constfromconst int c = 3I am unable to correctly substitutec_calleebycin the contract resource of thecomplex_access_ok_2function.Do you know where does this issue come from ?
Issue with get
Produces a mis-placed seq
Issue with indirection
Not able to type the resource
Questions
trm_compute_resources, should it be done in another pass / differently ?For modifies that transform UninitCell in Cell, which resource should we return? (a Cell + Uninit Cell for the rest of the array ?)