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

jasminc: Add a -slice f command line argument #414

Merged
merged 1 commit into from
Apr 19, 2023
Merged

jasminc: Add a -slice f command line argument #414

merged 1 commit into from
Apr 19, 2023

Conversation

vbgl
Copy link
Member

@vbgl vbgl commented Apr 19, 2023

Slicing removes from a program functions and global variables that are not reachable from the selected functions.

This feature has been requested in the context of safety checking: it allows to analyze a single entry-point within a larger program.

Nonetheless it may be used for different purposes and in particular it makes the already available -checkCTon and -ec arguments somehow redundant.

cc @tfaoliveira

else if List.exists (String.equal n.fn_name) fs then
inspect_stmt (with_fun k n) fd.f_body
else k)
{ vars = Sv.empty; funs = Sf.empty }
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the code will be simpler if funs (line 50) is initialised with something like "Sf.of_list (List.map (fun fn -> (find fn in fds))".
It has two advantages, line 47 and 48 can be removed. And we can use find to produce a proper error message if the user gives a name that does not exists.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. I’ll give it a try.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thanks for the suggestion.

Slicing removes from a program functions and global variables that are
not reachable from the selected functions.

This feature has been requested in the context of safety checking: it
allows to analyze a single entry-point within a larger program.

Nonetheless it may be used for different purposes and in particular it
makes the already available `-checkCTon` and `-ec` arguments somehow
redundant.
@bgregoir bgregoir merged commit 10ed67b into main Apr 19, 2023
@bgregoir bgregoir deleted the slicing branch April 19, 2023 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants