RFR: 8289943: Simplify some object allocation merges [v6]
Cesar Soares
duke at openjdk.org
Fri Sep 2 00:36:54 UTC 2022
On Thu, 1 Sep 2022 00:01:59 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Cesar Soares has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fix 32 bit execution.
>
> Allocations in `testPollutedPolymorphic()` are removed because both classes have the same `Shape` class which have all fields. Would be interesting if `l` field is declared only in both subclasses.
@vnkozlov - Thank you for clarifying that. I've been playing with lifting the restriction and I actually found a corner case:
public static Class test(boolean c1, boolean c2, boolean c3, int x, int y, int w, int z) {
Animal s = new Dog(x, y, z);
if (c1) {
s = new Cat("Fisker");
}
Unloaded u = new Unloaded(); // assumes this is converted to a uncommon_trap(unloaded, reinterpret)
return s.getClass();
}
It seems that when merging allocations of different subtypes I'll need to add a special `Phi` node merging the `Klass` of the input allocations. If I don't do that, the method above will return Animal.class instead of `Dog.class` or `Cat.class`. I'm wondering if I'll actually have to do the same for the Header/Mark word of the input allocations.
-------------
PR: https://git.openjdk.org/jdk/pull/9073
More information about the hotspot-compiler-dev
mailing list