-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[embedded] Lay the groundwork for embedded Swift #68244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
52cea42
349d37a
4878991
9f75a26
48513f3
2d61de8
09edae3
5203053
26d223a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,9 @@ enum class RuntimeEffect : unsigned { | |
| /// The runtime function calls ObjectiveC methods. | ||
| ObjectiveC = 0x40, | ||
|
|
||
| /// Witness methods, boxing, unboxing, initializing, etc. | ||
| Existential = 0x80, | ||
|
||
|
|
||
| /// Not modelled currently. | ||
| Concurrency = 0x0, | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1316,6 +1316,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args, | |
| } | ||
| Opts.BypassResilienceChecks |= Args.hasArg(OPT_bypass_resilience); | ||
|
|
||
| if (FrontendOpts.EnableLibraryEvolution && Opts.hasFeature(Feature::Embedded)) { | ||
|
||
| Diags.diagnose(SourceLoc(), diag::evolution_with_embedded); | ||
| HadError = true; | ||
| } | ||
|
|
||
| return HadError || UnsupportedOS || UnsupportedArch; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1239,6 +1239,13 @@ void IRGenModule::emitGlobalLists() { | |
| // Eagerly emit functions that are externally visible. Functions that are | ||
| // dynamic replacements must also be eagerly emitted. | ||
| static bool isLazilyEmittedFunction(SILFunction &f, SILModule &m) { | ||
| // Embedded Swift only emits specialized function, so don't emit genreic | ||
| // functions, even if they're externally visible. | ||
| if (f.getASTContext().LangOpts.hasFeature(Feature::Embedded) && | ||
| f.getLoweredFunctionType()->getSubstGenericSignature()) { | ||
| return true; | ||
| } | ||
|
|
||
| if (f.isPossiblyUsedExternally()) | ||
| return false; | ||
|
|
||
|
|
@@ -1403,6 +1410,18 @@ deleteAndReenqueueForEmissionValuesDependentOnCanonicalPrespecializedMetadataRec | |
| /// Emit any lazy definitions (of globals or functions or whatever | ||
| /// else) that we require. | ||
| void IRGenerator::emitLazyDefinitions() { | ||
| if (SIL.getASTContext().LangOpts.hasFeature(Feature::Embedded)) { | ||
| // In embedded Swift, the compiler cannot emit any metadata, etc. | ||
| LazyTypeMetadata.clear(); | ||
|
||
| LazySpecializedTypeMetadataRecords.clear(); | ||
| LazyTypeContextDescriptors.clear(); | ||
| LazyOpaqueTypeDescriptors.clear(); | ||
| LazyFunctionDefinitions.clear(); | ||
| LazyCanonicalSpecializedMetadataAccessors.clear(); | ||
| LazyMetadataAccessors.clear(); | ||
| LazyWitnessTables.clear(); | ||
| } | ||
|
|
||
| while (!LazyTypeMetadata.empty() || | ||
| !LazySpecializedTypeMetadataRecords.empty() || | ||
| !LazyTypeContextDescriptors.empty() || | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addAllPerformanceAnnotatedFunctionsandaddAllAnnotatedGlobalInitOnceFunctionsshould be called in the else-branch of this if-statement