[master] RFR: 8323192: [Lilliput] Implement new Serial Full GC
Roman Kennke
rkennke at openjdk.org
Fri Jan 12 13:45:21 UTC 2024
This implements a compressor-style compacting full-GC for the Serial GC, which does not require storing any forwarding pointers in object headers.
For a description of the algorithm, see the text block at the beginning of serialCompressor.hpp.
Notice that the algorithm uses extra memory: 1/64th of the heap-size is allocated for the marking bitmap and another 1/64th of the heap-size is allocated for the block-offset-table. On the other hand, it does not use storage for preserved-marks table, which is very unpredictable (often it is quite small, but if a workload churns locks or mass-i-hashes objects, it can become pretty large).
Performance:
I tested performance using the following program, which exxagerates the performance impact of the algorithm. Real-world workloads would be more dominated by the copying.
public class Retain {
static final int RETAINED = Integer.getInteger("retained", 10_000_000);
static final int GCS = Integer.getInteger("gcs", 100);
static Object[] OBJECTS = new Object[RETAINED];
public static void main(String... args) {
for (int t = 0; t < GCS; t++) {
for (int c = 0; c < RETAINED; c++) {
OBJECTS[c] = new Object();
}
System.gc();
}
}
}
The new algorithm can be tested by:
`java -XX:+UseSerialGC -XX:+UnlockExperimentalVMOptions -XX:+UseCompressorFullGC -Xlog:gc*:file=compressor.txt Retain
`
Average time for full-GCs on by machine:
- baseline: 394.61ms
- compressor: 411.61ms (+4.3%)
Testing:
- [x] tier1 +UseSerialGC +UseFullGCCompressor x86_64
- [x] tier1 +UseSerialGC +UseFullGCCompressor x86
- [ ] tier1 +UseSerialGC +UseFullGCCompressor aarch64
- [x] tier1 +UseSerialGC +UseCompactObjectHeaders x86_64
- [x] tier1 +UseSerialGC +UseCompactObjectHeaders x86
- [ ] tier1 +UseSerialGC +UseCompactObjectHeaders aarch64
-------------
Commit messages:
- Add missing include
- More cleanups and docs
- Better space iteration, some docs, etc
- Array chunking
- Various stuff
- Add missing fwd declaration
- No tabs
- Initial prototype
Changes: https://git.openjdk.org/lilliput/pull/122/files
Webrev: https://webrevs.openjdk.org/?repo=lilliput&pr=122&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8323192
Stats: 871 lines in 11 files changed: 853 ins; 15 del; 3 mod
Patch: https://git.openjdk.org/lilliput/pull/122.diff
Fetch: git fetch https://git.openjdk.org/lilliput.git pull/122/head:pull/122
PR: https://git.openjdk.org/lilliput/pull/122
More information about the lilliput-dev
mailing list