@@ -1239,7 +1239,7 @@ void IRGenModule::emitGlobalLists() {
1239
1239
// Eagerly emit functions that are externally visible. Functions that are
1240
1240
// dynamic replacements must also be eagerly emitted.
1241
1241
static bool isLazilyEmittedFunction (SILFunction &f, SILModule &m) {
1242
- // Embedded Swift only emits specialized function, so don't emit genreic
1242
+ // Embedded Swift only emits specialized function, so don't emit generic
1243
1243
// functions, even if they're externally visible.
1244
1244
if (f.getASTContext ().LangOpts .hasFeature (Feature::Embedded) &&
1245
1245
f.getLoweredFunctionType ()->getSubstGenericSignature ()) {
@@ -1412,13 +1412,19 @@ deleteAndReenqueueForEmissionValuesDependentOnCanonicalPrespecializedMetadataRec
1412
1412
void IRGenerator::emitLazyDefinitions () {
1413
1413
if (SIL.getASTContext ().LangOpts .hasFeature (Feature::Embedded)) {
1414
1414
// In embedded Swift, the compiler cannot emit any metadata, etc.
1415
- LazyTypeMetadata.clear ();
1416
- LazySpecializedTypeMetadataRecords.clear ();
1417
- LazyTypeContextDescriptors.clear ();
1418
- LazyOpaqueTypeDescriptors.clear ();
1419
- LazyCanonicalSpecializedMetadataAccessors.clear ();
1420
- LazyMetadataAccessors.clear ();
1421
- LazyWitnessTables.clear ();
1415
+ assert (LazyTypeMetadata.empty ());
1416
+ assert (LazySpecializedTypeMetadataRecords.empty ());
1417
+ assert (LazyTypeContextDescriptors.empty ());
1418
+ assert (LazyOpaqueTypeDescriptors.empty ());
1419
+ assert (LazyFieldDescriptors.empty ());
1420
+ // LazyFunctionDefinitions are allowed, but they must not be generic
1421
+ for (SILFunction *f : LazyFunctionDefinitions) {
1422
+ assert (!f->getLoweredFunctionType ()->getSubstGenericSignature ());
1423
+ }
1424
+ assert (LazyWitnessTables.empty ());
1425
+ assert (LazyCanonicalSpecializedMetadataAccessors.empty ());
1426
+ assert (LazyMetadataAccessors.empty ());
1427
+ // LazySpecializedClassMetadata is allowed
1422
1428
}
1423
1429
1424
1430
while (!LazyTypeMetadata.empty () ||
@@ -1493,9 +1499,8 @@ void IRGenerator::emitLazyDefinitions() {
1493
1499
while (!LazyFunctionDefinitions.empty ()) {
1494
1500
SILFunction *f = LazyFunctionDefinitions.pop_back_val ();
1495
1501
CurrentIGMPtr IGM = getGenModule (f);
1496
- // XXX TODO
1497
- // assert(!f->isPossiblyUsedExternally()
1498
- // && "function with externally-visible linkage emitted lazily?");
1502
+ assert (!f->isPossiblyUsedExternally ()
1503
+ && " function with externally-visible linkage emitted lazily?" );
1499
1504
IGM->emitSILFunction (f);
1500
1505
}
1501
1506
@@ -1536,6 +1541,10 @@ void IRGenerator::addLazyFunction(SILFunction *f) {
1536
1541
// Add it to the queue if it hasn't already been put there.
1537
1542
if (!LazilyEmittedFunctions.insert (f).second )
1538
1543
return ;
1544
+
1545
+ if (SIL.getASTContext ().LangOpts .hasFeature (Feature::Embedded)) {
1546
+ assert (!f->getLoweredFunctionType ()->getSubstGenericSignature ());
1547
+ }
1539
1548
1540
1549
assert (!FinishedEmittingLazyDefinitions);
1541
1550
LazyFunctionDefinitions.push_back (f);
0 commit comments