RFR: 8370914: C2: Reimplement Type::join [v3]
Andrew Dinn
adinn at openjdk.org
Thu Nov 20 10:59:38 UTC 2025
On Thu, 20 Nov 2025 05:48:07 GMT, Dean Long <dlong at openjdk.org> wrote:
> It's worth noting that Graal implements meet and join separately in its Stamp type system, with no "dual" tricks, and apparently no worries about being "symmetrical" or even mentioning the words "lattice" or "centerline". ...
It's also worth noting that the theory on which most of the C2 optimization is based stresses heavily the need for the type hierarchy to be a 'well-formed' lattice and relies on that to ensure that the join or meet for any two types is both correct and as strong as possible. The use of dual types to derive the join/meet is not critical and is not computationally optimal but it does enable a uniform computation model which provides the strength guarantee.
That strength guarantee depends on the lattice obeying certain well-formedness constraints which are not always met in the C2 type system. I recall the issue was that for some pairings there is not always a unique strongest type for the meet (or join?) of two OopPtr types (although there will always be a weaker Ptr type that is the parent of all such strongest valid types). This means that in some cases C2 misses opportunities to perform some optimizations. Years ago Cliff Click wrote a series of articles describing how the lattice worked which explained how this possibility arose but it disappeared from the interwebs quite a while back.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28051#issuecomment-3557317590
More information about the hotspot-compiler-dev
mailing list