-
Notifications
You must be signed in to change notification settings - Fork 7
Bugfix var local name #44
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
50bbebe
working on dependencies
yannilefki 7218943
solved the span issue with Variable.local_name
yannilefki 2a5405b
command for dependency debugging
yannilefki caaebf0
answered commits and resolved small mistakes
yannilefki 37c729e
more readable viewdoc documentation for dark theme users
yannilefki cbcd027
writing unit tests and commenting
yannilefki d395d96
bugfix : the call to resolve_target in find_var was singling out rege…
yannilefki 73b0843
unit tests. wip : adding it to batch.ml after understanding how it wo…
yannilefki 4d20b91
small debug flags
yannilefki b50ae1f
1. Finished unit tests and polishing comments.
yannilefki 73f90ca
I commented a test that raised a failure.
yannilefki 52d36de
PR cleaning
yannilefki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ let analyse_stats_details : bool ref = ref false | |
| (** [dump_ast_details]: flag to dump OptiTrust AST, both in the form of a '.ast' and '_enc.cpp' files. *) | ||
| let dump_ast_details : bool ref = ref false | ||
|
|
||
| (* TODO : deprecate once optilambda surface display works *) | ||
| (** [pretty_matrix_notation]: flag to display matrix macros with syntactic sugar: | ||
| MALLOC2(n, m, sizeof(T)) --> malloc(sizeof(T[n][m])) | ||
| x[MINDEX2(n, m, i, j)] --> x[i;j] | ||
|
|
@@ -124,16 +125,20 @@ let set_optilambda_repr repr = | |
| This allows for the propagation of the backtrace. *) | ||
| let stop_on_first_resource_error = ref true | ||
|
|
||
| (* TODO Yanni : reevaluate *) | ||
| (** [resource_typing_enabled]: if false, never attempt typing resources and never introduce ghosts. *) | ||
| let resource_typing_enabled = ref true | ||
|
|
||
| (* TODO Yanni : reevaluate *) | ||
| (** [check_validity]: perform validation of transformations *) | ||
| let check_validity = ref false | ||
|
|
||
| (* TODO Yanni : reevaluate *) | ||
| (** [preserve_specs_only]: allow code transformation that preserve the specification without necessarily preserving the semantics | ||
| TODO: update code which was also using check_validity for this purpose *) | ||
| let preserve_specs_only = ref false | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is equivalent to [Annotated] mode. |
||
|
|
||
| (* TODO Yanni : reevaluate *) | ||
| (** [disable_resource_typing ()] should be called when using OptiTrust without resources. *) | ||
| let disable_resource_typing () = | ||
| resource_typing_enabled := false; | ||
|
|
@@ -145,6 +150,7 @@ let reparse_between_steps = ref false | |
| (** [recompute_resources_between_steps]: always recompute resources between two steps *) | ||
| let recompute_resources_between_steps = ref false | ||
|
|
||
| (* TODO Yanni : depreciate - should always be true *) | ||
| (** [use_resources_with_models]: use resources of the form "p ~~> v" instead of "p ~> Cell". In the long term, this flag should disappear as we should be able to unify those two modes into one, using clever syntactic sugar and unification features. *) | ||
| let use_resources_with_models = ref false | ||
|
|
||
|
|
@@ -265,6 +271,7 @@ let string_to_steps_selector (s:string) : steps_selector = | |
| | "all" -> Steps_all | ||
| | _ -> failwith "invalid step selector, should be one of 'none', 'script', 'important', 'effectful', 'all'" | ||
|
|
||
| (* TODO : the trace would be smaller once we share terms in the trace *) | ||
| (* Options to control which steps are exported in the trace. | ||
| Be careful that a step not exported cannot be viewed even in step diff mode. *) | ||
| let save_steps : steps_selector option ref = ref None | ||
|
|
||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| include Optitrust_utils | ||
| include Optitrust_ast | ||
| include Ast | ||
| include Trm | ||
| include Typ | ||
| include Contextualized_error | ||
| include Mark | ||
| (* include Target *) | ||
| include Trm_pattern | ||
|
|
||
| module Trm = struct | ||
| include Trm | ||
| (* short aliases *) | ||
| let var = trm_var | ||
| let struct_access = trm_struct_access | ||
| let array_access = trm_array_access | ||
| let get_stringreprid = trm_get_stringreprid | ||
|
|
||
| let pattern_var = trm_pattern_var | ||
| end | ||
|
|
||
| (* module Show.At = Show.At *) | ||
|
|
||
| let debug_path = true | ||
|
|
||
| let trm_seq_nobrace = Nobrace.trm_seq | ||
| let trm_seq_nobrace_nomarks = Nobrace.trm_seq_nomarks | ||
|
|
||
| type seq_component = | ||
| | Trm of trm | ||
| | TrmList of trm list | ||
| | TrmMlist of trm mlist | ||
| | Mark of mark | ||
| | MarkList of mark list | ||
| | SeqComponents of seq_component list | ||
|
|
||
| let trm_seq_helper ?(annot : trm_annot option) ?(loc : location) ?(result: var option) ?(braces = true) (components: seq_component list) : trm = | ||
| let rec aux cs acc = List.fold_right (fun comp acc -> | ||
| match comp with | ||
| | Trm t -> Mlist.push_front t acc | ||
| | TrmList tl -> Mlist.merge (Mlist.of_list tl) acc | ||
| | TrmMlist tml -> Mlist.merge tml acc | ||
| | Mark "" -> acc | ||
| | Mark m -> Mlist.insert_mark_at 0 m acc | ||
| | MarkList ms -> Mlist.insert_marks_at 0 ms acc | ||
| | SeqComponents cs -> aux cs acc | ||
| ) cs acc in | ||
| let mlist = aux components (Mlist.empty ()) in | ||
| if braces then | ||
| trm_seq ?annot ?loc ?result mlist | ||
| else begin | ||
| assert (annot = None); | ||
| assert (loc = None); | ||
| trm_seq_nobrace ?result mlist | ||
| end | ||
|
|
||
| let update_span_helper (span : Dir.span) (t_seq : trm) (f : trm mlist -> seq_component list) : trm = | ||
| let instrs, result = trm_inv ~error:"expected seq" trm_seq_inv t_seq in | ||
| if span.start > span.stop then begin | ||
| failwith "update_span_helper: This span is impossible [%n; %n]" span.start span.stop | ||
| end else begin | ||
| let (span_instrs, instrs_after) = Mlist.split ~left_bias:false span.stop instrs in | ||
| let (instrs_before, span_instrs) = Mlist.split ~left_bias:true span.start span_instrs in | ||
| let new_span_components = f span_instrs in | ||
| trm_seq_helper ~annot:t_seq.annot ?result [ | ||
| TrmMlist instrs_before; | ||
| SeqComponents new_span_components; | ||
| TrmMlist instrs_after; | ||
| ] | ||
| end | ||
|
|
||
| let skip_includes (t : trm) : trm = | ||
| match trm_seq_inv t with | ||
| | Some (instrs, None) -> | ||
| let not_include = Mlist.filter (fun t -> not (trm_is_include t)) instrs in | ||
| trm_seq not_include | ||
| | _ -> failwith "skip_includes should be called on the root of the AST" | ||
|
|
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
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
|
yannilefki marked this conversation as resolved.
|
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now equivalent to mode [AnnotatedAndVerified], and is not expected to be asked by transformations anymore.