On Thu, 6 Jul 2023 05:18:01 GMT, Jean-Philippe Bempel <[email protected]>
wrote:
> Fix a small leak in constant pool merging during retransformation of a class.
> If this class has a catch block with `Throwable`, the class `Throwable` is
> pre-resolved in the constant pool, while all the other classes are in a
> unresolved state. So the constant pool merging process was considering the
> entry with pre-resolved class as different compared to the destination and
> create a new entry. We now try to consider it as equal specially for
> Methodref/Fieldref.
I wonder if compare_entry_to can just handle this case directly and not have
this function.
src/hotspot/share/oops/constantPool.cpp line 1302:
> 1300: if (strcmp(s1, s2) != 0) {
> 1301: return false; // strings don't match; not our special case
> 1302: }
klass_name_at() returns a Symbol* that's in the SymbolTable so this never
needed to do a strcmp. It can test for equality.
-------------
Changes requested by coleenp (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14780#pullrequestreview-1516550061
PR Review Comment: https://git.openjdk.org/jdk/pull/14780#discussion_r1254440703