RFR: 8343206: Final graph reshaping should not compress abstract or interface class pointers [v3]
Dean Long
dlong at openjdk.org
Fri Nov 1 08:26:27 UTC 2024
On Thu, 31 Oct 2024 10:01:17 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>> 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.
Do we actually generate an nmethod for the above example? It seems like it could never execute the getClass() because the line above setting `obj` would have to throw an exception if there can be no concrete instances.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21784#discussion_r1825573872
More information about the hotspot-compiler-dev
mailing list