RFR: 8266642: improve ResolvedMethodTable hash function [v2]

David Holmes dholmes at openjdk.java.net
Tue May 11 00:31:35 UTC 2021


On Mon, 10 May 2021 17:40:51 GMT, Denghui Dong <ddong at openjdk.org> wrote:

>> test/hotspot/jtreg/runtime/MemberName/ResolvedMethodTableHash.java line 57:
>> 
>>> 55:         byte[] buf = new byte[100];
>>> 56:         int size = writeClass(buf, "MH$$");
>>> 57:         Class<?> cls = Unsafe.getUnsafe().defineAnonymousClass(ResolvedMethodTableHash.class, Arrays.copyOf(buf, size), null);
>> 
>> Why do we need to use Unsafe for this rather the public Lookup.defineHiddenClass API?
>
> Because here needs different class loader data to load the different classes with the same name, I think Unsafe API is a simple way to achieve this purpose.

But as you note, the name mangling for hidden classes would mean that the names are not actually the same. And I don't see how this introduces a different classloader-data. ??

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

PR: https://git.openjdk.java.net/jdk/pull/3901


More information about the hotspot-runtime-dev mailing list