RFR: 8364360: Defining hidden class with no room in constant pool crashes the VM [v2]

Rémi Forax forax at openjdk.org
Tue Oct 28 12:29:05 UTC 2025


On Tue, 28 Oct 2025 11:58:49 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> If we have such a sensitive dependency on the CP size, we might consider opening up the `symbolTable.getConstantPoolCount()` on the `ClassWriter` for better testing, or use the ClassFile API that has a similar fine-grained control over constant pool sizes.
>> 
>> I can help you update ASM or rewrite in ClassFile API if the Java code is too complex for you.
>
> @liach  I have no idea how to do this, can you help?

ClassWriter.newUTF8() returns the index in the constant pool so you can use that information


int maxCPIndex = cw.newUTF8(Integer.toString(-1));
int maxEntry = 65535 - maxCPIndex - 1;

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27964#discussion_r2469392915


More information about the hotspot-runtime-dev mailing list