-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[WIP] Serialize local functions inside transparent functions #1814
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
Conversation
@swift-ci Please test |
e1a26ff
to
89125ff
Compare
@swift-ci Please test |
auto Tuple = static_cast<const TupleTypeMetadata *>(type); | ||
return Tuple->NumElements; | ||
} | ||
|
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.
Was this reordering intentional?
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.
Yeah, it is in its own patch. Unless I'm missing something the old ordering was a mistake?
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.
Why does it matter?
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.
It feels more natural to put the tuple functions together, after the '// -- Tuple destructuring.' section. Previously swift_TupleMirror_count came first, then some other unrelated functions, then the rest of the TupleMirror stuff.
If you prefer I can drop this patch, it's not related to anything else in the series. Arguably moving code around destroys 'git blame' history, but I have some other changes to this file that are not yet committed, so I decided to fix this nit.
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.
Nah, it's fine. Just wondering why.
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.
It's so much harder to make your code look good when the language doesn't enforce bottom-up function order ;)
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.
Yeah, the generative approach to declarations in ML family languages is so much more elegant than this multi-pass declarative crap
89125ff
to
b939500
Compare
@swift-ci Please test |
b939500
to
24ac970
Compare
@swift-ci Please test |
24ac970
to
b4ed608
Compare
@swift-ci Please test |
b4ed608
to
dc29e3c
Compare
@swift-ci Please test |
21a6693
to
38f9841
Compare
@swift-ci Please test |
38f9841
to
ed8974d
Compare
@swift-ci Please test |
…il-serialize-all When we're not serializing SIL for all function bodies, @_transparent functions can only reference internal functions that are declared @_versioned, otherwise there's no serialized body and no public entry point, so any client that inlines the @_transparent function will not be able to link. This patch adds the minimum set of @_versioned declarations to allow a non-optimized build of the standard library and overlays. Recall that this attribute is just a temporary hack to make progress on building the standard library with resilience enabled. Once availability and resilience learn about each other, @_versioned will be replaced by having an availability annotation on an internal declaration. Invariants will be diagnosed by Sema instead of asserting in the SIL verifier. Finally, the set of "internal but available" declarations will eventually be audited instead of determined by experimentation. This almost closes out https://bugs.swift.org/browse/SR-267. The remaining issue is an interaction between SIL optimizations and serialization that will be fixed with some upcoming changes to the optimizer.
The original SILFunction may be [fragile] because it came from an imported module, or maybe it was [fragile] because it was declared @_transparent by the user. Furthermore, the devirtualizer can devirtualize calls inside [fragile] functions, pointing them at non-fragile functions. FIXME: For resilience, we cannot devirtualize this stuff anyway. Instead, try to not set [fragile] on clones unless needed.
Let's abuse the [thunk] attribute to mean "serialize the body of this function but only if it is referenced from a [fragile] function."
ed8974d
to
daed4b3
Compare
@swift-ci Please test |
Note to self:
|
[pull] swiftwasm from master
No description provided.