@@ -124,7 +124,7 @@ SILModule::~SILModule() {
124
124
assert (numAllocatedSlabs == freeSlabs.size () && " leaking slabs in SILModule" );
125
125
#endif
126
126
127
- assert (!hasUnresolvedOpenedArchetypeDefinitions ());
127
+ assert (!hasUnresolvedLocalArchetypeDefinitions ());
128
128
129
129
// Decrement ref count for each SILGlobalVariable with static initializers.
130
130
for (SILGlobalVariable &v : silGlobals) {
@@ -259,15 +259,15 @@ void *SILModule::allocateInst(unsigned Size, unsigned Align) const {
259
259
}
260
260
261
261
void SILModule::willDeleteInstruction (SILInstruction *I) {
262
- // Update RootOpenedArchetypeDefs .
263
- I->forEachDefinedOpenedArchetype ([&](CanOpenedArchetypeType archeTy,
264
- SILValue dependency) {
265
- OpenedArchetypeKey key = {archeTy, I->getFunction ()};
262
+ // Update RootLocalArchetypeDefs .
263
+ I->forEachDefinedLocalArchetype ([&](CanLocalArchetypeType archeTy,
264
+ SILValue dependency) {
265
+ LocalArchetypeKey key = {archeTy, I->getFunction ()};
266
266
// In case `willDeleteInstruction` is called twice for the
267
267
// same instruction, we need to check if the archetype is really
268
268
// still in the map for this instruction.
269
- if (RootOpenedArchetypeDefs .lookup (key) == dependency)
270
- RootOpenedArchetypeDefs .erase (key);
269
+ if (RootLocalArchetypeDefs .lookup (key) == dependency)
270
+ RootLocalArchetypeDefs .erase (key);
271
271
});
272
272
}
273
273
@@ -704,21 +704,21 @@ void SILModule::registerDeserializationNotificationHandler(
704
704
deserializationNotificationHandlers.add (std::move (handler));
705
705
}
706
706
707
- SILValue SILModule::getRootOpenedArchetypeDef (CanOpenedArchetypeType archetype,
708
- SILFunction *inFunction) {
707
+ SILValue SILModule::getRootLocalArchetypeDef (CanLocalArchetypeType archetype,
708
+ SILFunction *inFunction) {
709
709
assert (archetype->isRoot ());
710
710
711
- SILValue &def = RootOpenedArchetypeDefs [{archetype, inFunction}];
711
+ SILValue &def = RootLocalArchetypeDefs [{archetype, inFunction}];
712
712
if (!def) {
713
- numUnresolvedOpenedArchetypes ++;
713
+ numUnresolvedLocalArchetypes ++;
714
714
def = ::new PlaceholderValue (SILType::getPrimitiveAddressType (archetype));
715
715
}
716
716
717
717
return def;
718
718
}
719
719
720
- bool SILModule::hasUnresolvedOpenedArchetypeDefinitions () {
721
- return numUnresolvedOpenedArchetypes != 0 ;
720
+ bool SILModule::hasUnresolvedLocalArchetypeDefinitions () {
721
+ return numUnresolvedLocalArchetypes != 0 ;
722
722
}
723
723
724
724
// / Get a unique index for a struct or class field in layout order.
@@ -764,40 +764,40 @@ unsigned SILModule::getCaseIndex(EnumElementDecl *enumElement) {
764
764
}
765
765
766
766
void SILModule::notifyAddedInstruction (SILInstruction *inst) {
767
- inst->forEachDefinedOpenedArchetype ([&](CanOpenedArchetypeType archeTy,
768
- SILValue dependency) {
769
- SILValue &val = RootOpenedArchetypeDefs [{archeTy, inst->getFunction ()}];
767
+ inst->forEachDefinedLocalArchetype ([&](CanLocalArchetypeType archeTy,
768
+ SILValue dependency) {
769
+ SILValue &val = RootLocalArchetypeDefs [{archeTy, inst->getFunction ()}];
770
770
if (val) {
771
771
if (!isa<PlaceholderValue>(val)) {
772
772
// Print a useful error message (and not just abort with an assert).
773
- llvm::errs () << " re-definition of root opened archetype in function "
773
+ llvm::errs () << " re-definition of root local archetype in function "
774
774
<< inst->getFunction ()->getName () << " :\n " ;
775
775
inst->print (llvm::errs ());
776
776
llvm::errs () << " previously defined in function "
777
777
<< val->getFunction ()->getName () << " :\n " ;
778
778
val->print (llvm::errs ());
779
779
abort ();
780
780
}
781
- // The opened archetype was unresolved so far. Replace the placeholder
781
+ // The local archetype was unresolved so far. Replace the placeholder
782
782
// by inst.
783
783
auto *placeholder = cast<PlaceholderValue>(val);
784
784
placeholder->replaceAllUsesWith (dependency);
785
785
::delete placeholder;
786
- numUnresolvedOpenedArchetypes --;
786
+ numUnresolvedLocalArchetypes --;
787
787
}
788
788
val = dependency;
789
789
});
790
790
}
791
791
792
792
void SILModule::notifyMovedInstruction (SILInstruction *inst,
793
793
SILFunction *fromFunction) {
794
- inst->forEachDefinedOpenedArchetype ([&](CanOpenedArchetypeType archeTy,
795
- SILValue dependency) {
796
- OpenedArchetypeKey key = {archeTy, fromFunction};
797
- assert (RootOpenedArchetypeDefs .lookup (key) == dependency &&
794
+ inst->forEachDefinedLocalArchetype ([&](CanLocalArchetypeType archeTy,
795
+ SILValue dependency) {
796
+ LocalArchetypeKey key = {archeTy, fromFunction};
797
+ assert (RootLocalArchetypeDefs .lookup (key) == dependency &&
798
798
" archetype def was not registered" );
799
- RootOpenedArchetypeDefs .erase (key);
800
- RootOpenedArchetypeDefs [{archeTy, inst->getFunction ()}] = dependency;
799
+ RootLocalArchetypeDefs .erase (key);
800
+ RootLocalArchetypeDefs [{archeTy, inst->getFunction ()}] = dependency;
801
801
});
802
802
}
803
803
0 commit comments