-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SILGen: Emit literal closures at the abstraction level of their context. #38816
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
SILGen: Emit literal closures at the abstraction level of their context. #38816
Conversation
@swift-ci Please benchmark |
Performance (x86_64): -O
Code size: -O
Performance (x86_64): -Osize
Code size: -Osize
Performance (x86_64): -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
0538438
to
6542234
Compare
@swift-ci Please test |
Build failed |
Build failed |
6542234
to
ae1193f
Compare
@swift-ci Please test |
Build failed |
ae1193f
to
e75e2dc
Compare
@swift-ci Please test |
Literal closures are only ever directly referenced in the context of the expression they're written in, so it's wasteful to emit them at their fully-substituted calling convention and then reabstract them if they're passed directly to a generic function. Avoid this by saving the abstraction pattern of the context before emitting the closure, and then lowering its main entry point's calling convention at that level of abstraction. Generalize some of the prolog/epilog code to handle converting arguments and returns to the correct representation for a different abstraction level.
e75e2dc
to
309500d
Compare
@swift-ci Please test |
Build failed |
@swift-ci Please test macOS |
Build failed |
@swift-ci Please smoke test macOS |
Literal closures are only ever directly referenced in the context of the expression they're written in,
so it's wasteful to emit them at their fully-substituted calling convention and then reabstract them if
they're passed directly to a generic function. Avoid this by saving the abstraction pattern of the context
before emitting the closure, and then lowering its main entry point's calling convention at that
level of abstraction. Generalize some of the prolog/epilog code to handle converting arguments and returns
to the correct representation for a different abstraction level.