mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Exclusivity] Add deserialization callbacks from the optimizer.
AccessMarkerElimination now registers a callback so that any subsequently
deserialized function bodies will have access markers stripped for optimization.
rdar:31908496 Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of
incompatible type!") in SILPerformanceInliner
This commit is contained in:
@@ -74,6 +74,12 @@ class SILModule::SerializationCallback : public SerializedSILLoader::Callback {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void didDeserializeFunctionBody(ModuleDecl *M, SILFunction *fn) override {
|
||||
// Callbacks are currently applied in the order they are registered.
|
||||
for (auto callBack : fn->getModule().getDeserializationCallbacks())
|
||||
callBack(M, fn);
|
||||
}
|
||||
};
|
||||
|
||||
SILModule::SILModule(ModuleDecl *SwiftModule, SILOptions &Options,
|
||||
@@ -726,6 +732,18 @@ lookUpFunctionInVTable(ClassDecl *Class, SILDeclRef Member) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SILModule::registerDeserializationCallback(
|
||||
SILFunctionBodyCallback callBack) {
|
||||
if (std::find(DeserializationCallbacks.begin(),
|
||||
DeserializationCallbacks.end(), callBack)
|
||||
== DeserializationCallbacks.end())
|
||||
DeserializationCallbacks.push_back(callBack);
|
||||
}
|
||||
|
||||
ArrayRef<SILModule::SILFunctionBodyCallback>
|
||||
SILModule::getDeserializationCallbacks() {
|
||||
return DeserializationCallbacks;
|
||||
}
|
||||
|
||||
void SILModule::
|
||||
registerDeleteNotificationHandler(DeleteNotificationHandler* Handler) {
|
||||
|
||||
Reference in New Issue
Block a user