Skip to content

Add stronger SILVerifier support for formal access. #16880

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

Closed
wants to merge 5 commits into from
Closed

Add stronger SILVerifier support for formal access. #16880

wants to merge 5 commits into from

Conversation

atrick
Copy link
Contributor

@atrick atrick commented May 29, 2018

Ensure that all formal access follows recognizable patterns
at all points in the SIL pipeline.

This is important to run acccess enforcement optimization late in the pipeline.

This is a single-commit PR building on #16877

atrick added 3 commits May 27, 2018 01:43
This information was getting lost in SIL printing/parsing.
Some passes rely on it. Regardless of whether passes should rely on it,
it is totally unacceptable for the SIL passes to have subtle differences
in behavior depending on the frontend mode. So, if we don't want passes
to rely on global variable decls, that needs to be enforced by the API
independent of how the frontend is invoked or how SIL is serialized.
Move the utilities that are required for recognizing SILGlobalVariable access
into SILGlobalVariable.[h|cpp].

Structural SIL properties that are assumed by the optimizer, and thus required
for SIL verification, should never be embedded in SILOptimizer passes, or even
in SILOptimizer/Utils. Structural SIL properties need to be defined in
/SIL. They are as much part of the SIL language as the opcode list.

These particular utilities are required for working with SILGlobalVariables, and
will be used by a whole-module access enforcement optimization.

The primary API for recognizing SIL globals is `getVariableOfGlobalInit`. It is
required to find the association between the addressor SILFunction marked
[global_init], and the SILGlobalVariable being addressed.

Other helper APIs expose more details about the addressor's SIL patterns and are
useful for transforming the initializer itself into an optimized form.
@atrick
Copy link
Contributor Author

atrick commented May 29, 2018

@swift-ci test.

@atrick
Copy link
Contributor Author

atrick commented May 29, 2018

@swift-ci test source compatibility.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 0f5fbb61aab1c7fd074f9ee10eb4ad5fb4725469

@gottesmm
Copy link
Contributor

+1! Static verification FTW!

atrick added 2 commits May 28, 2018 22:57
AccessedStorage now properly represents access to global variables, even if they
haven't been fully optimized down to global_addr instructions.

This is essential for optimizing dynamic exclusivity checks. As a
verified SIL property, all access to globals and class properties
needs to be identifiable.
Ensure that all formal access follows recognizable patterns
at all points in the SIL pipeline.

This is important to run acccess enforcement optimization late in the pipeline.
@atrick
Copy link
Contributor Author

atrick commented May 29, 2018

@swift-ci test source compatibility.

@atrick
Copy link
Contributor Author

atrick commented May 29, 2018

This PR can't be merged until I handle all the access patterns that show up in debug builds.

@atrick
Copy link
Contributor Author

atrick commented May 29, 2018

Closing and folding the change into #16877.

@atrick atrick closed this May 29, 2018
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.

3 participants