RFR: 8343206: Final graph reshaping should not compress abstract or interface class pointers [v3]
Tobias Hartmann
thartmann at openjdk.org
Thu Oct 31 10:03:29 UTC 2024
On Wed, 30 Oct 2024 12:17:39 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Typo2
>
> src/hotspot/share/opto/compile.cpp line 3498:
>
>> 3496: assert(false, "Interface or abstract class pointers should not be compressed");
>> 3497: } else {
>> 3498: new_in2 = ConNode::make(t->make_narrowklass());
>
> When I was looking through this code, I was hoping there'd be some sort of assert in the make_narrowklass function so any caller would assert but maybe you don't have that info?
Right, I was hoping for that too and tried to move the assert into `TypeNarrowKlass::make`. We do have all the information there but we hit false positives in rare cases like this when `MyAbstract` does not have any subtypes at compile time (mostly with `-Xcomp`):
MyAbstract obj = ...;
obj.getClass();
C2 will add a dependency that will invalidate the code once a subclass is loaded and then optimizes the narrow class load from `obj` to be of constant narrow class type `MyAbstract`. The assert will trigger but we will never emit a compressed class pointer because the narrow class load + decode is folded to a non-narrow constant.
We could move the assert to a later stage though. I'll give that a try.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21784#discussion_r1824187919
More information about the hotspot-compiler-dev
mailing list