RFR: 8354329: Rewrite runtime/ClassFile/JsrRewriting.java and OomWhileParsingRepeatedJsr.java tests [v3]

Anton Artemov duke at openjdk.org
Wed Apr 30 08:54:47 UTC 2025


On Tue, 29 Apr 2025 19:05:43 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Anton Artemov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8354329: Got rid of obsolete Applet inheritance, not inheriting from Object.
>
> test/hotspot/jtreg/runtime/ClassFile/OomWhileParsingRepeatedJsr.java line 41:
> 
>> 39:  * @modules java.base/jdk.internal.misc
>> 40:  *          java.desktop
>> 41:  *          java.management
> 
> I don't see how this test and the other compile the OOMCrashClass1960_2.java file or include it.  I think this needs a @compile OOMCrashClass1960_2java above the @run driver line.
> Your testing might have picked up an older version of the .class file for OOMCrashClass1960_2?

There is not "Compilation" phase, instead, there is a dump() method, which gives us an array of bytes with the class file data. Then we can write to a file, give it an extension .class and that is it. 

Then, to load the generated class from a class file, one uses the following code:
`ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
            "-cp", ".",       // this is how you point to the scratch directory
            "-XX:+UnlockDiagnosticVMOptions",
            "-XX:NativeMemoryTracking=summary",
            "-XX:MallocLimit=768m:oom",
            className);` // this is how you point to a particular file in the directory

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24662#discussion_r2068196555


More information about the hotspot-runtime-dev mailing list