RFR: 8343206: Final graph reshaping should not compress abstract or interface class pointers [v3]
Dean Long
dlong at openjdk.org
Mon Nov 4 22:36:34 UTC 2024
On Mon, 4 Nov 2024 06:26:04 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
>> 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.
>
> Right, this was an oversimplified example. I used this code:
>
> Class test(MyAbstract obj, boolean b) {
> if (b) {
> return obj.getClass();
> }
> return null;
> }
>
>
> We pass `null` for `obj` and `false` for `b`. Usually, the branch is then only compiled with Xcomp.
I think there is still hope for moving the assert into `TypeNarrowKlass::make` in a future RFE. In the example above, if we are generating code for obj.getClass() based on the assumption that the type is a leaf, we could also notice that the type is abstract and deduce that obj must be null.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21784#discussion_r1828483501
More information about the hotspot-compiler-dev
mailing list