RFR(L): 8031755: Type speculation should be used to optimize explicit null checks

Roland Westrelin roland.westrelin at oracle.com
Thu Mar 20 11:52:36 UTC 2014


>> I made the following change:
>> 
>> *** 3561,3571 ****
>> 
>> 
>>       // Since klasses are different, we require a LCA in the Java
>>       // class hierarchy - which means we have to fall to at least NotNull.
>>       if( ptr == TopPTR || ptr == AnyNull || ptr == Constant )
>>         ptr = NotNull;
>> 
>> -     instance_id = InstanceBot;
>> 
>> 
>>       // Now we find the LCA of Java classes
>>       ciKlass* k = this_klass->least_common_ancestor(tinst_klass);
>>       return make(ptr, k, false, NULL, off, instance_id, speculative, depth);
>>     } // End of case InstPtr
>> 
>> --- 3706,3715 ——
>> 
>> because I hit a type not symmetric failure that I think it causes:
>> 
>> === Meet Not Symmetric ===
>> t   =                   javax/management/openmbean/OpenType:AnyNull * (inline_depth=-2)
>> this=                   javax/management/openmbean/ArrayType:TopPTR *,iid=top (inline_depth=InlineDepthTop)
>> mt=(t meet this)=       javax/management/openmbean/ArrayType:AnyNull * (inline_depth=-2)
>> t_dual=                 javax/management/openmbean/OpenType:NotNull *,iid=top (inline_depth=2)
>> this_dual=              javax/management/openmbean/ArrayType *
>> mt_dual=                javax/management/openmbean/ArrayType:NotNull *,iid=top (inline_depth=2)
>> mt_dual meet t_dual=    javax/management/openmbean/OpenType:NotNull * (inline_depth=2)
>> mt_dual meet this_dual= javax/management/openmbean/ArrayType *
> 
> The question is why OpenType:AnyNull does not have iid=top. It is in upper type lattice.

http://cr.openjdk.java.net/~roland/8031755/TestMeetInstanceId.java

triggers this. But while working on reproducing it, I noticed a bug in the previous webrev:

if (!speculative_maybe_null) {

in TypePtr::would_improve_ptr() should have been:

if (!speculative_maybe_null()) {

with that fixed, the bug doesn’t reproduce. I also think we should drop the speculative type, if it is above the center line. So here is a new webrev with:
instance_id = InstanceBot;
back where it was.

http://cr.openjdk.java.net/~roland/8031755/webrev.01/

Roland.


More information about the hotspot-compiler-dev mailing list