Using descriptor than internal name hashes for CP ClassEntry
Brian Goetz
brian.goetz at oracle.com
Fri Jan 5 16:02:36 UTC 2024
The approach seems promising.
Note that the EntryMap type is fussy about hash values -- you can't pass
zero as a hash value. The `hashString(String)` method ensured that the
hash value was never zero.
On 12/24/2023 11:11 AM, - wrote:
> Hi,
> Since we are using ClassDesc quite often to represent Class constants
> in Class-File API, yet it's costly to hash them (as they are
> internal names in CP but descriptors in ClassDesc), that Adam has
> created shortcuts to speed up fetching of Object CE from CD_Object, I
> have thought of a new tactic to hash ClassEntry by full descriptor
> than by internal name alone.
>
> I have made a prototype at
> https://github.com/liachmodded/jdk/commit/2932a560b0029352f1309883b3c5eecfb3d2c771
>
> The idea is that hashing CE as descriptors is easier than creating
> substrings for hashing; substring hashing is hard to compute, but
> appending and prepending and hash is much easier.
>
> Does this look like a good idea? I only included a test to confirm its
> correctness, but haven't got time to bench it against, say, the port
> of java.lang,invoke or ProxyGenerator.
>
> Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20240105/a9262ad4/attachment.htm>
More information about the classfile-api-dev
mailing list