[master] RFR: Read class from object header [v2]
rkennke at openjdk.java.net
Wed Jul 28 09:07:23 UTC 2021
> This changes the Hotspot runtime to load the Klass* from the header instead of the dedicated Klass* word. The dedicated word is only still used for verification and for access by generated code (the former will eventually go away, the latter will be implemented separately).
> Currently, this means we need to coordinate with the ObjectSynchronizer: when encountering a header that is a stack lock or a monitor, the header is displaced. Worse, if it is a stack-locked that is owned by a thread other than the calling thread, we must first inflate the lock to a full monitor. This is particularily bad for GCs. Luckily, most paths only do this at a safepoint, where we can actually safely access foreign stack locks and don't need to worry about inflation. Notably exception is concurrent marking by G1GC, which can cause inflation of locks, but it doesn't hurt very much.
> It's really bad for Shenandoah and ZGC, though: when relocating objects, GC needs to know the object size of the from-space copy. However, this can cause inflation, and inflation creates new WeakHandle in the resulting monitor, and that would be initialized with a from-space copy, which is a no-go during evacuation/relocation.
> That said, I have been told that work is under way to get rid of displaced headers altogether, which would neatly solve all those problems. I have no desire to make complicated workarounds for Shenandoah GC and ZGC. I disabled both in my own builds for now, and will implement them as soon as the monitor changes arrive.
> In a couple of places in GC we need to access the header carefully: when concurrently forwarding (by parallel GC threads), we need to ensure we access the Klass* from an unforwarded header, and must also ensure to avoid re-loading the Klass* once we have the good header (that is why so many asserts have been removed - they would potentially re-load the Klass* from a header that may now be forwarded).
> - [x] tier1
> - [x] tier2
> - [x] hotspot_gc
> (all without Shenandoah and ZGC, see above)
Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
Disable Shenandoah and ZGC in GA jobs
- all: https://git.openjdk.java.net/lilliput/pull/12/files
- new: https://git.openjdk.java.net/lilliput/pull/12/files/f98e3545..3203a503
- full: https://webrevs.openjdk.java.net/?repo=lilliput&pr=12&range=01
- incr: https://webrevs.openjdk.java.net/?repo=lilliput&pr=12&range=00-01
Stats: 7 lines in 1 file changed: 7 ins; 0 del; 0 mod
Fetch: git fetch https://git.openjdk.java.net/lilliput pull/12/head:pull/12
More information about the lilliput-dev