RFR: 8266642: improve ResolvedMethodTable hash function [v2]

Denghui Dong ddong at openjdk.java.net
Tue May 11 02:37:51 UTC 2021


On Tue, 11 May 2021 00:27:47 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> 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. ??

Unsafe.getUnsafe().defineAnonymousClass will create an unsafe anonymous class rather than a hidden class, and for unsafe anonymous class, JVM will create a new CLD, see the comment in SystemDictionary::resolve_hidden_class_from_stream:

  // - for unsafe anonymous class: create a new CLD whith a class holder that uses
  //                               the same class loader as the unsafe_anonymous_host.
  // - for hidden classes that are not strong: create a new CLD that has a class holder and
  //                                           whose loader is the Lookup class's loader.
  // - for hidden class: add the class to the Lookup class's loader's CLD.

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

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


More information about the hotspot-runtime-dev mailing list