mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: change SILModule's scheduledForDeletion from a double linked list to a std::vector
This commit is contained in:
@@ -217,7 +217,7 @@ private:
|
|||||||
/// This avoids dangling instruction pointers within the run of a pass and in
|
/// This avoids dangling instruction pointers within the run of a pass and in
|
||||||
/// analysis caches. Note that the analysis invalidation mechanism ensures
|
/// analysis caches. Note that the analysis invalidation mechanism ensures
|
||||||
/// that analysis caches are invalidated before flushDeletedInsts().
|
/// that analysis caches are invalidated before flushDeletedInsts().
|
||||||
llvm::iplist<SILInstruction> scheduledForDeletion;
|
std::vector<SILInstruction*> scheduledForDeletion;
|
||||||
|
|
||||||
/// The swift Module associated with this SILModule.
|
/// The swift Module associated with this SILModule.
|
||||||
ModuleDecl *TheSwiftModule;
|
ModuleDecl *TheSwiftModule;
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ void SILModule::checkForLeaks() const {
|
|||||||
if (!getOptions().checkSILModuleLeaks)
|
if (!getOptions().checkSILModuleLeaks)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int instsInModule = std::distance(scheduledForDeletion.begin(),
|
int instsInModule = scheduledForDeletion.size();
|
||||||
scheduledForDeletion.end());
|
|
||||||
for (const SILFunction &F : *this) {
|
for (const SILFunction &F : *this) {
|
||||||
const SILFunction *sn = &F;
|
const SILFunction *sn = &F;
|
||||||
do {
|
do {
|
||||||
@@ -280,11 +280,11 @@ void SILModule::scheduleForDeletion(SILInstruction *I) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SILModule::flushDeletedInsts() {
|
void SILModule::flushDeletedInsts() {
|
||||||
while (!scheduledForDeletion.empty()) {
|
for (SILInstruction *instToDelete : scheduledForDeletion) {
|
||||||
SILInstruction *inst = &*scheduledForDeletion.begin();
|
SILInstruction::destroy(instToDelete);
|
||||||
scheduledForDeletion.erase(inst);
|
AlignedFree(instToDelete);
|
||||||
AlignedFree(inst);
|
|
||||||
}
|
}
|
||||||
|
scheduledForDeletion.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
SILWitnessTable *
|
SILWitnessTable *
|
||||||
|
|||||||
Reference in New Issue
Block a user