RFR: 8304069: ClassFileParser has ad-hoc hashtables [v3]

Coleen Phillimore coleenp at openjdk.org
Thu Mar 23 18:53:05 UTC 2023


On Thu, 23 Mar 2023 16:49:04 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> The ClassFileParser has ad-hoc hash tables for checking for duplicate names for fields, methods and interfaces. ResourceHashtable will now be used instead. Verified with tier1-4 tests.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Interface uses normal ResourceHashtable

Every cleanup suggests more cleanups.

src/hotspot/share/classfile/classFileParser.cpp line 866:

> 864:     // Set containing interface names
> 865:     ResourceHashtable<Symbol*, int>* interface_names = new ResourceHashtable<Symbol*, int>();
> 866:     Symbol* interface_name;

Minor point - you can declare Symbol* interface_name at line 869.

src/hotspot/share/classfile/classFileParser.cpp line 1595:

> 1593:     // Set containing name-signature pairs
> 1594:     NameSigHashtable* names_and_sigs = new NameSigHashtable();
> 1595:     NameSigHash name_and_sig;

The same thing is true with this - you can remove the null constructor and just create the NameSigHash object in the for() scope, since it's not used outside the scope anymore.

src/hotspot/share/classfile/classFileParser.cpp line 2835:

> 2833:       // Set containing name-signature pairs
> 2834:       NameSigHashtable* names_and_sigs = new NameSigHashtable();
> 2835:       NameSigHash name_and_sig;

also can be moved inside for() scope.

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

Changes requested by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13141#pullrequestreview-1355347788
PR Review Comment: https://git.openjdk.org/jdk/pull/13141#discussion_r1146678589
PR Review Comment: https://git.openjdk.org/jdk/pull/13141#discussion_r1146679818
PR Review Comment: https://git.openjdk.org/jdk/pull/13141#discussion_r1146680176


More information about the hotspot-runtime-dev mailing list