RFR: 8343427: Class file load hook crashes on archived classes from multi-release JARs [v2]

Calvin Cheung ccheung at openjdk.org
Thu Nov 21 23:21:15 UTC 2024


On Thu, 21 Nov 2024 06:20:32 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   updated testcase
>
> src/hotspot/share/cds/filemap.cpp line 2705:
> 
>> 2703: 
>> 2704:   // InputStream ClassLoader.getResourceAsStream(String name)
>> 2705:   JavaCalls::call_virtual(&result,
> 
> Do we really have to make two Java upcalls to do this? What is the performance hit? Can we declare a helper method in ClassLoader that does it in one? Is there any risk of getting into a recursive loop here?

I've added the following method in ClassLoader so we only make one Java upcalls:
`private byte[] getResourceAsByteArray(String name)`
This is a special case of using CDS and CFLH. So I think it can take a bit of performance hit. Better than experiencing a VM crash.
Since the new function doesn't have any global state, it should be able to handle recursive call.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22262#discussion_r1853072397


More information about the hotspot-dev mailing list