RFR: 8340012: [C2] assert(KlassEncodingMetaspaceMax > pd) failed: change encoding max if new encoding after 8338526

Thomas Stuefe stuefe at openjdk.org
Fri Sep 13 16:07:05 UTC 2024


On Fri, 13 Sep 2024 15:44:35 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> > > All you need is an interface class to go through this code. I wonder why it only failed on AIX?
> > 
> > 
> > It fails on AIX because it allocates at different addresses and we get a class at 0x0a00010091130af8. I guess that the classes seen by this C2 code are still within the encodable range on all other platforms (including linux on PPC64). Note that x86 is not affected because it doesn't use the transformation.
> 
> Which CPUs are affected? Only PPC64?
> 
> > > Good. Can you add regression test?
> > 
> > 
> > My current regression test is: Run applications/ctw/modules/java_xml.java on AIX. :-)
> > Is there a way to force the metaspace part for such classes outside of the encoding range? Then, we may be able to write a dedicated regression test.
> 
> You can this:
> 
> * use `CompressedClassSpaceBaseAddress` to enforce a low base address, e.g. 1GB. This also switches off CDS. It may not work, in which case you throw a SkippedException. But I use this in many tests.
> * use a small class space, e.g. 128MB.
> * class space will be `[1g .. 1g+128m)`
> * under most architectures (all apart aarch64), the resulting encoding scheme will use base=0 shift=0. Now you have limited the encoding range to `[0 .. 4gb)` . On aarch64, you will get, I believe, base=1g shift=0, `[1g...5g)`, still okay.
> * Normal metaspace lives in freely allocated mmaps, which usually float around somewhere distant. The chance that they are outside the range is very high.
> 
> this works on Linux, but depends on `vm.mmap_min_addr` sysctl. You may have to lower that value. It should usually be very low though (64k or so)

Another way to test this is to stress-test the JVM with -Xshare:off and a small class space size. Since 8312018 we do our best to allocate the class space in low address regions and run unscaled. And it usually works.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20971#issuecomment-2349295344


More information about the hotspot-dev mailing list