mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Remove unused deserialized SILFunctions.
The deserializer holds a reference to the deserialized SILFunction, which prevents Dead Function Elimination from erasing them. We have a tradeoff on how often we should clean up the unused deserialized SILFunctions. If we clean up at every optimization iteration, we may end up deserializing the same SILFunction multiple times. For now, we clean up only after we are done with the optimization iteration. rdar://17046033 Swift SVN r18697
This commit is contained in:
@@ -163,22 +163,24 @@ public:
|
||||
/// The deserialized value.
|
||||
T Value;
|
||||
|
||||
/// The offset. Set to 0 when fully deserialized.
|
||||
/// The offset.
|
||||
serialization::BitOffset Offset;
|
||||
|
||||
unsigned IsFullyDeserialized : 1;
|
||||
|
||||
public:
|
||||
/*implicit*/ PartiallySerialized(serialization::BitOffset offset)
|
||||
: Value(), Offset(offset) {}
|
||||
: Value(), Offset(offset), IsFullyDeserialized(0) {}
|
||||
|
||||
/*implicit*/ PartiallySerialized(RawBitOffset offset)
|
||||
: Value(), Offset(offset) {}
|
||||
: Value(), Offset(offset), IsFullyDeserialized(0) {}
|
||||
|
||||
bool isDeserialized() const {
|
||||
return Value != T();
|
||||
}
|
||||
|
||||
bool isFullyDeserialized() const {
|
||||
return isDeserialized() && Offset == 0;
|
||||
return isDeserialized() && IsFullyDeserialized;
|
||||
}
|
||||
|
||||
serialization::BitOffset getOffset() const {
|
||||
@@ -191,10 +193,15 @@ public:
|
||||
return Value;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
IsFullyDeserialized = 0;
|
||||
Value = T();
|
||||
}
|
||||
|
||||
void set(T value, bool isFullyDeserialized) {
|
||||
assert(!isDeserialized() || Value == value);
|
||||
Value = value;
|
||||
if (isFullyDeserialized) Offset = 0;
|
||||
IsFullyDeserialized = isFullyDeserialized;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user