C: fix GC

This commit is contained in:
Alexey Andreev 2019-07-09 14:41:53 +03:00
parent 3ed75a97d4
commit 8a359c6434

View File

@ -312,16 +312,16 @@ public final class GC {
if (!object.toAddress().isLessThan(currentRegionEnd)) {
currentRegionIndex = (int) ((object.toAddress().toLong() - heapAddress().toLong()) / regionSize());
Region currentRegion = Structure.add(Region.class, regionsAddress(), currentRegionIndex);
if (currentRegion.start == 0) {
do {
if (++currentRegionIndex == regionsCount) {
object = limit.toStructure();
break loop;
}
currentRegion = Structure.add(Region.class, regionsAddress(), currentRegionIndex);
} while (currentRegion.start == 0);
while (currentRegion.start == 0) {
if (++currentRegionIndex == regionsCount) {
object = limit.toStructure();
break loop;
}
currentRegion = Structure.add(Region.class, regionsAddress(), currentRegionIndex);
}
currentRegionEnd = currentRegion.toAddress().add(regionSize());
Address newRegionStart = heapAddress().add(currentRegionIndex * regionSize());
object = newRegionStart.add(currentRegion.start - 1).toStructure();
currentRegionEnd = newRegionStart.add(regionSize());
}
} else {
if (lastFreeSpace != null) {