Skip to content

[NO MERGE] Exclusive key path fix #16016

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 3 commits into from

Conversation

gottesmm
Copy link
Contributor

No description provided.

gottesmm and others added 3 commits April 17, 2018 18:10
…clusivity".

This is a special @_semantics attribute that preserves exclusivity even if we
are eliminating exclusivity in other parts of a module in release mode. This is
done by:

1. Teaching the Access Marker Elimination pass to skip any function with the
semantics tag.

2. Requiring all functions with the semantics tag to be noinline. This ensures
that the SIL level inliner will not inline these functions into any callers
without the protection of the semantics tag. This is enforced in IRGenPrepare
and ensures that our access markers will live to IRGen time.

3. In IRGenPrepare, we convert these functions from noinline to always
inline. After IRGen this then allows for the LLVM inliner to inline these
trivial functions that just perform the exclusivity checks ensuring that we do
not have extra calls in the fast path.

This ensures that we can fix the keypaths exclusivity issue without having to
enable exclusivity across the entire stdlib and deal with any of the potential
performance issues therein.

rdar://39335800
Add dynamic enforcement of exclusive access when a KeyPath directly accesses a final
stored property on an instance of a class. For read-only projections, this begins and ends
the access immediately. For mutable projections, this uses the ClassHolder to perform
a long-term access that lasts as long as the lifetime of the ClassHolder.

rdar://problem/31972680
…ift_dumpTrackedAccesses().

This makes it easy to perform printf debugging in the debugger. I have found it
to be useful in understanding programs around exclusivity quickly.
writeAndPerform(&c[keyPath: \C.f]) {
let x = c[keyPath: \C.f]
_blackHole(x)
// CHECK-LABEL: Overlapping Key Path Write Access and Key Path Read Access
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@atrick This is the one that is failing now.

@gottesmm gottesmm changed the title Exclusive key path fix [NO MERGE] Exclusive key path fix Apr 18, 2018
@gottesmm gottesmm closed this May 11, 2018
@gottesmm gottesmm deleted the exclusive-key-path-fix branch May 11, 2018 19:48
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