Request for reviews (M): 7170463: C2 should recognize "obj.getClass() == A.class" code pattern
John Rose
john.r.rose at oracle.com
Thu May 24 12:23:58 PDT 2012
On May 24, 2012, at 1:28 AM, Krystal Mok wrote:
> Maybe we should just do without the join?
Kris, the join is important locally to "climb the hill" to a better GVN type assignment; you don't want to lose type information you already have.
The join does a set union (normalized by upper bound in lattice) of assertions about the type. There may be assertions unique to either source of information, and we want the output to cover all known assertions.
(In the literature the you will often read "meet" where we say "join". But we stand on our heads here in C2. When type domains are narrowed against each other, that is traditionally called a meet. But conversely we can regard the assertion sets over type domains, and those are widened exactly when the value sets are narrowed, hence the name join.)
Globally, if you drop assertions on the floor, you may keep climbing to two distinct hilltops, lose confluence, and fail to terminate in the optimizer. Here's a good summary of the global confluence property we rely on: http://en.wikipedia.org/wiki/Abstract_rewriting_system
In this particular case, the join ('tboth') may contain every assertion made by obj_type, but we don't want to trust this, because it requires exhaustive knowledge of the C2 type system. In fact, there are cases where obj_type makes a unique contribution, e.g., via instance_id.
HTH
— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20120524/7f82441b/attachment.html
More information about the hotspot-compiler-dev
mailing list