Request for reviews (M): 7170463: C2 should recognize "obj.getClass() == A.class" code pattern

Krystal Mok rednaxelafx at gmail.com
Thu May 24 15:15:07 PDT 2012


Hi John,

Thanks a lot! I added the join() in my patch but I wasn't sure it was nessecary; I debugged through it for a couple of cases and the resulting type seemed to be what I wanted, so I added it. Now I'm getting it :-)

Thanks,
Kris

On 2012-5-25, at 3:23, John Rose <john.r.rose at oracle.com> wrote:

> 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/20120525/45f67e51/attachment.html 


More information about the hotspot-compiler-dev mailing list