Skip to content

Not pushing conditions using permission introspection further in#853

Merged
marcoeilers merged 4 commits into
masterfrom
meilers_cond_perms_disable_for_perm_introspection
Jun 17, 2024
Merged

Not pushing conditions using permission introspection further in#853
marcoeilers merged 4 commits into
masterfrom
meilers_cond_perms_disable_for_perm_introspection

Conversation

@marcoeilers

@marcoeilers marcoeilers commented Jun 13, 2024

Copy link
Copy Markdown
Contributor

The --conditionalizePermissions command line option rewrites implications and ternary expressions to avoid branching.
The general pattern is that e1 ==> acc(e2.f, e3) is rewritten to acc(e2.f, e1 ? e3 : none.

This rewriting is not always sound if the condition (e1 in this case) uses permission introspection.
Example:

inhale P1(x)
exhale perm(P1(x)) >= write ==> (P1(x) && P1(x))

must not be rewritten to

inhale P1(x)
exhale acc(P1(x), perm(P1(x)) >= write ? write : none) && acc(P1(x), perm(P1(x)) >= write ? write : none)

since the value of perm(P1(x)) >= write changes.

This PR conservatively prevents any rewriting where the condition contains perm or forperm.
This fixes one issue mentioned in #851.

@jcp19 jcp19 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code looks ok to me, I have a few questions about the tests though

Comment thread src/test/scala/SiliconTestsConditionalizePermissions.scala
Comment thread src/test/resources/conditionalizePermissions/silicon_0008.vpr
Comment thread src/test/resources/conditionalizePermissions/let.vpr
Comment thread src/test/resources/conditionalizePermissions/silicon_0008.vpr
Comment thread src/test/resources/conditionalizePermissions/let.vpr
@marcoeilers marcoeilers enabled auto-merge June 17, 2024 14:08
@marcoeilers marcoeilers merged commit 67a1edc into master Jun 17, 2024
@marcoeilers marcoeilers deleted the meilers_cond_perms_disable_for_perm_introspection branch July 1, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants