RFR: 8241825: Make compressed oops and compressed class pointers independent on x86_64

Erik Österlund erik.osterlund at oracle.com
Fri Apr 24 08:17:08 UTC 2020


Hi,

Today, the use of compressed class pointers assumes the use of 
compressed oops.
This patch loosens up the relationship between compressed oops and 
compressed
class pointers, so that compressed class pointers can be used without 
compressed
oops. This benefits for example ZGC that wants compressed class 
pointers, but
not compressed oops, effectively giving ZGC 4 bytes smaller objects.

Much of the complexity of the change is that r12 used to be used by 
compressed
class pointers as some kind of semi-fast temp register that one would 
restore
to the compressed oops heap base (or zero). That made it effectively a 
slightly
optimized spilling mechanism used to find a temp register. I replaced that
mechanism with a plain old normal temp register that you pass in as a 
parameter.
The bad news is that I had to find available temp registers in a lot of 
places.
The good news is that almost always were there temp registers available 
for free,
and hence the new temp register is even faster than the old optimized 
spilling
mechanism. Because we almost never need any spilling at all in the 
contexts where
this is used.

Since I want the 4 new bytes to actually make objects smaller, I poked 
the new
layout code a bit so that the klass gap is made available for fields. 
That used
to be made available only with compressed oops enabled, due to 
restrictions in
the layout code. Our new layout code does not have such restrictions, and so
I will make the 4 bytes available for fields when the new layout code is 
used
and compressed class pointers are used.

Now I'm only fixing this for HotSpot x86_64. Ideally the use of 
compressed oops
and compressed class pointers should not be entangled in other platforms and
Graal. But that is beyond the scope of this change, and I will let them 
behave
the way that they used to, to be potentially fixed later.

Bug:
https://bugs.openjdk.java.net/browse/JDK-8241825

Webrev:
http://cr.openjdk.java.net/~eosterlund/8241825/webrev.00/

Testing:
hs-tier1-7

Thanks,
/Erik


More information about the hotspot-dev mailing list