swift
fdc0e08d - SILGen: Emit literal closures at the abstraction level of their context.

Commit
4 years ago
SILGen: Emit literal closures at the abstraction level of their context. 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.
Author
Committer
Parents
Loading