RFR: 8370914: C2: Reimplement Type::join [v4]
Dean Long
dlong at openjdk.org
Tue Nov 25 00:56:46 UTC 2025
On Sat, 22 Nov 2025 11:15:39 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Also, I think it would make sense to target this for jdk 27 after the fork.
>
> @dean-long I think you are misunderstanding, the answer is incorrect because the result it gives, `java/nio/file/spi/FileSystemProvider:AnyNull *,iid=top`, is empty, while the correct answer is the set which contains the single value `null`, and is not empty. The reason for this inaccuracy is that there are 2 LCAs for the inputs on the lattice, and they do not subtype each other, we choose the wrong one out of those LCAs.
Thanks @merykitty. I do hope I am not misunderstanding. I would argue that in theory, empty is correct here and null is wrong, but in practice I don't think it matters except for dead code. Can you come up with an example where the difference matters?
C2 only remembers one Klass, so it makes sense to use LCA(Klass1,Klass2) for meet(Klass1,Klass) in the summarized result, even though it loses information. But I would argue that join(Klass1,Klass2) should not be using LCA at all, and that using null, NotNull, or AnyNull to join two classes that do not subtype seems wrong to me, and I think it is notable that Graal does not do that. But again I think it may be a moot point if it makes no difference in practice.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28051#issuecomment-3573324465
More information about the hotspot-compiler-dev
mailing list