|
13 | 13 | /// This pass eliminates 'unknown' access enforcement by selecting either
|
14 | 14 | /// static or dynamic enforcement.
|
15 | 15 | ///
|
16 |
| -/// TODO: This is currently a module transform so that closures can be |
17 |
| -/// transformed after their parent scope is analyzed. This isn't a big problem |
18 |
| -/// now because AccessMarkerElimination is also a module pass that follows this |
19 |
| -/// pass. However, we would like to mostly eliminate module transforms. This |
20 |
| -/// could be done by changing the PassManager to follow CloseScopeAnalysis. A |
21 |
| -/// new ClosureTransform type would be pipelined just like FunctionTransform, |
22 |
| -/// but would have an entry point that handled a parent closure scope and all |
23 |
| -/// its children in one invocation. For function pipelining to be upheld, we |
24 |
| -/// would need to verify that BasicCalleeAnalysis never conflicts with |
25 |
| -/// ClosureScopeAnalysis. i.e. we could never create a caller->callee edge when |
26 |
| -/// the callee is passed as a function argument. Normal FunctionTransforms would |
27 |
| -/// then be called on each closure function and its parent scope before calling |
28 |
| -/// the ClosureTransform. |
| 16 | +/// TODO: This is currently a module transform so that it can process closures |
| 17 | +/// after analyzing their parent scope. This isn't a big problem now because |
| 18 | +/// AccessMarkerElimination is also a module pass that follows this pass, so all |
| 19 | +/// markers will still be present when this pass runs. However, we would like to |
| 20 | +/// mostly eliminate module transforms. This could be done by changing the |
| 21 | +/// PassManager to follow ClosureScopeAnalysis. A new ClosureTransform type |
| 22 | +/// would be pipelined just like FunctionTransform, but would have an entry |
| 23 | +/// point that handled a parent closure scope and all its children in one |
| 24 | +/// invocation. For function pipelining to be upheld, we would need to verify |
| 25 | +/// that BasicCalleeAnalysis never conflicts with ClosureScopeAnalysis. i.e. we |
| 26 | +/// could never create a caller->callee edge when the callee is passed as a |
| 27 | +/// function argument. Normal FunctionTransforms would then be called on each |
| 28 | +/// closure function and its parent scope before calling the ClosureTransform. |
29 | 29 | ///
|
30 | 30 | /// FIXME: handle boxes used by copy_value when neither copy is captured.
|
31 | 31 | ///
|
@@ -521,6 +521,12 @@ struct SourceAccess {
|
521 | 521 | };
|
522 | 522 |
|
523 | 523 | /// The pass.
|
| 524 | +/// |
| 525 | +/// This can't be a SILFunctionTransform because DynamicCaptures need to be |
| 526 | +/// recorded while analyzing a closure's parent scopes before processing the |
| 527 | +/// closures. |
| 528 | +/// |
| 529 | +/// TODO: Make this a "ClosureTransform". See the file-level comments above. |
524 | 530 | class AccessEnforcementSelection : public SILModuleTransform {
|
525 | 531 | // Reference back to the known dynamically enforced non-escaping closure
|
526 | 532 | // arguments in this module. Parent scopes are processed before the closures
|
@@ -554,6 +560,12 @@ void AccessEnforcementSelection::run() {
|
554 | 560 | }
|
555 | 561 |
|
556 | 562 | void AccessEnforcementSelection::processFunction(SILFunction *F) {
|
| 563 | + if (F->wasDeserializedCanonical()) { |
| 564 | + DEBUG(llvm::dbgs() << "Skipping Access Enforcement Selection of " |
| 565 | + "deserialized " |
| 566 | + << F->getName() << "\n"); |
| 567 | + return; |
| 568 | + } |
557 | 569 | DEBUG(llvm::dbgs() << "Access Enforcement Selection in " << F->getName()
|
558 | 570 | << "\n");
|
559 | 571 | #ifndef NDEBUG
|
|
0 commit comments