mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[deserialization] Create the SILLoader for a SILModule lazily the first time deserialization occurs instead of when the SILModule is created.
This enables us to get around timing issues when we create a SILModule before we have finished loading all Swift Modules. This manifested itself in sil-opt where we were unable to deserialize from the standard library when optimizing a separate *.sil file. Swift SVN r15670
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "swift/AST/SILOptions.h"
|
||||
#include "swift/Basic/LangOptions.h"
|
||||
#include "swift/Basic/Range.h"
|
||||
#include "swift/Basic/NullablePtr.h"
|
||||
#include "swift/SIL/SILDeclRef.h"
|
||||
#include "swift/SIL/SILFunction.h"
|
||||
#include "swift/SIL/SILGlobalVariable.h"
|
||||
@@ -144,7 +145,12 @@ private:
|
||||
std::unique_ptr<SerializationCallback> Callback;
|
||||
|
||||
/// The SILLoader used when linking functions into this module.
|
||||
SerializedSILLoader *SILLoader;
|
||||
///
|
||||
/// This is lazily initialized the first time we attempt to
|
||||
/// deserialize. Previously this was created when the SILModule was
|
||||
/// constructed. In certain cases this was before all Modules had been loaded
|
||||
/// causeing us to not
|
||||
NullablePtr<SerializedSILLoader> SILLoader;
|
||||
|
||||
/// The external SIL source to use when linking this module.
|
||||
SILExternalSource *ExternalSource = nullptr;
|
||||
@@ -156,6 +162,10 @@ private:
|
||||
SILModule(const SILModule&) = delete;
|
||||
void operator=(const SILModule&) = delete;
|
||||
|
||||
/// Method which returns the SerializedSILLoader, creating the loader if it
|
||||
/// has not been created yet.
|
||||
SerializedSILLoader *getSILLoader();
|
||||
|
||||
public:
|
||||
~SILModule();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user