mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Support for @noescape SILFunctionTypes. These are the underlying SIL changes necessary to implement the new closure capture ABI. Note: This includes a change to function name mangling that primarily affects reabstraction thunks. The new ABI will allow stack allocation of non-escaping closures as a simple optimization. The new ABI, and the stack allocation optimization, also require closure context to be @guaranteed. That will be implemented as the next step. Many SIL passes pattern match partial_apply sequences. These all needed to be fixed to handle the convert_function that SILGen now emits. The conversion is now needed whenever a function declaration, which has an escaping type, is passed into a @NoEscape argument. In addition to supporting new SIL patterns, some optimizations like inlining and SIL combine are now stronger which could perturb some benchmark results. These underlying SIL changes should be merged now to avoid conflicting with other work. Minor benchmark discrepancies can be investigated as part of the stack-allocation work. * Add a noescape attribute to SILFunctionType. And set this attribute correctly when lowering formal function types to SILFunctionTypes based on @escaping. This will allow stack allocation of closures, and unblock a related ABI change. * Flip the polarity on @noescape on SILFunctionType and clarify that we don't default it. * Emit withoutActuallyEscaping using a convert_function instruction. It might be better to use a specialized instruction here, but I'll leave that up to Andy. Andy: And I'll leave that to Arnold who is implementing SIL support for guaranteed ownership of thick function types. * Fix SILGen and SIL Parsing. * Fix the LoadableByAddress pass. * Fix ClosureSpecializer. * Fix performance inliner constant propagation. * Fix the PartialApplyCombiner. * Adjust SILFunctionType for thunks. * Add mangling for @noescape/@escaping. * Fix test cases for @noescape attribute, mangling, convert_function, etc. * Fix exclusivity test cases. * Fix AccessEnforcement. * Fix SILCombine of convert_function -> apply. * Fix ObjC bridging thunks. * Various MandatoryInlining fixes. * Fix SILCombine optimizeApplyOfConvertFunction. * Fix more test cases after merging (again). * Fix ClosureSpecializer. Hande convert_function cloning. Be conservative when combining convert_function. Most of our code doesn't know how to deal with function type mismatches yet. * Fix MandatoryInlining. Be conservative with function conversion. The inliner does not yet know how to cast arguments or convert between throwing forms. * Fix PartialApplyCombiner.
46 KiB
46 KiB