privatestaticvoid allocateStuff() { for (int i = 0; i < 1000; ++i) {
Object o = new Object();
treeMap.put(o.hashCode(), o);
}
}
publicstaticvoid testHomogeneousCompaction() {
System.out.println("Attempting homogeneous compaction"); finalboolean supportHSC = supportHomogeneousSpaceCompact();
Object o = new Object(); long addressBefore = objectAddress(o); long addressAfter;
allocateStuff(); finalboolean success = performHomogeneousSpaceCompact();
allocateStuff();
System.out.println("Homogeneous compaction support=" + supportHSC + " success=" + success); if (supportHSC != success) {
System.out.println("error: Expected " + supportHSC + " but got " + success);
} if (success) {
allocateStuff();
addressAfter = objectAddress(o); // This relies on the compaction copying from one space to another space and there being no // overlap. if (addressBefore == addressAfter) {
System.out.println("error: Expected different adddress " + addressBefore + " vs " +
addressAfter);
}
} if (supportHSC) {
incrementDisableMovingGC(); if (performHomogeneousSpaceCompact()) {
System.out.println("error: Compaction succeeded when moving GC is disabled");
}
decrementDisableMovingGC(); if (!performHomogeneousSpaceCompact()) {
System.out.println("error: Compaction failed when moving GC is enabled");
}
}
}
// Methods to get access to ART internals. privatestaticnativeboolean supportHomogeneousSpaceCompact(); privatestaticnativeboolean performHomogeneousSpaceCompact(); privatestaticnativevoid incrementDisableMovingGC(); privatestaticnativevoid decrementDisableMovingGC(); privatestaticnativelong objectAddress(Object object);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.