Enforce another invariant for dominator calculation that would have caught another hard-to-find bug.
This commit is contained in:
parent
a09ad70de5
commit
5761474bec
@ -957,6 +957,9 @@ class BitVector:
|
||||
def __ne__(self, other: object) -> bool:
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __len__(self) -> int:
|
||||
return len(self.__bits)
|
||||
|
||||
@property
|
||||
def bitsSet(self) -> Set[int]:
|
||||
return {i for i in self.__bits if self.__bits[i]}
|
||||
@ -1270,6 +1273,12 @@ class ByteCodeDecompiler(VerboseOutput):
|
||||
dominators: Dict[int, BitVector] = {chunk.id: BitVector(chunklen, init=True) for chunk in chunks}
|
||||
dominators[start_id].setAllBitsTo(False).setBit(start_id)
|
||||
|
||||
# Verify that the chunk IDs are contiguous. Otherwise this algorithm fails, since it
|
||||
# assigns an integer ID to each bit in a bitfield contiguously.
|
||||
for chunk in chunks:
|
||||
if chunk.id < 0 or chunk.id >= len(chunks):
|
||||
raise Exception("Chunk ID {chunk.id} is outside of our created BitVector, the ID space of chunks is non-contiguous!")
|
||||
|
||||
changed = True
|
||||
while changed:
|
||||
changed = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user