Mercurial > hg > truffle
comparison src/share/vm/opto/graphKit.cpp @ 17708:f176b09780b0
8025644: java/util/stream/test/org/openjdk/tests/java/util/stream/ToArrayOpTest.java fails with TestData$OfRef): failure java.lang.AssertionError: expected [true] but found [false]
Summary: In GraphKit::gen_checkcast() provide only exact superklass to GraphKit::maybe_cast_profiled_receiver()
Reviewed-by: kvn, roland
author | iveresov |
---|---|
date | Mon, 10 Mar 2014 11:09:02 -0700 |
parents | de95063c0e34 |
children | b8413a9cbb84 |
comparison
equal
deleted
inserted
replaced
17707:7d28f4e15b61 | 17708:f176b09780b0 |
---|---|
2992 region->del_req(_null_path); | 2992 region->del_req(_null_path); |
2993 phi ->del_req(_null_path); | 2993 phi ->del_req(_null_path); |
2994 } | 2994 } |
2995 | 2995 |
2996 Node* cast_obj = NULL; | 2996 Node* cast_obj = NULL; |
2997 const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr(); | 2997 if (tk->klass_is_exact()) { |
2998 // We may not have profiling here or it may not help us. If we have | 2998 // The following optimization tries to statically cast the speculative type of the object |
2999 // a speculative type use it to perform an exact cast. | 2999 // (for example obtained during profiling) to the type of the superklass and then do a |
3000 ciKlass* spec_obj_type = obj_type->speculative_type(); | 3000 // dynamic check that the type of the object is what we expect. To work correctly |
3001 if (spec_obj_type != NULL || | 3001 // for checkcast and aastore the type of superklass should be exact. |
3002 (data != NULL && | 3002 const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr(); |
3003 // Counter has never been decremented (due to cast failure). | 3003 // We may not have profiling here or it may not help us. If we have |
3004 // ...This is a reasonable thing to expect. It is true of | 3004 // a speculative type use it to perform an exact cast. |
3005 // all casts inserted by javac to implement generic types. | 3005 ciKlass* spec_obj_type = obj_type->speculative_type(); |
3006 data->as_CounterData()->count() >= 0)) { | 3006 if (spec_obj_type != NULL || |
3007 cast_obj = maybe_cast_profiled_receiver(not_null_obj, tk->klass(), spec_obj_type, safe_for_replace); | 3007 (data != NULL && |
3008 if (cast_obj != NULL) { | 3008 // Counter has never been decremented (due to cast failure). |
3009 if (failure_control != NULL) // failure is now impossible | 3009 // ...This is a reasonable thing to expect. It is true of |
3010 (*failure_control) = top(); | 3010 // all casts inserted by javac to implement generic types. |
3011 // adjust the type of the phi to the exact klass: | 3011 data->as_CounterData()->count() >= 0)) { |
3012 phi->raise_bottom_type(_gvn.type(cast_obj)->meet_speculative(TypePtr::NULL_PTR)); | 3012 cast_obj = maybe_cast_profiled_receiver(not_null_obj, tk->klass(), spec_obj_type, safe_for_replace); |
3013 if (cast_obj != NULL) { | |
3014 if (failure_control != NULL) // failure is now impossible | |
3015 (*failure_control) = top(); | |
3016 // adjust the type of the phi to the exact klass: | |
3017 phi->raise_bottom_type(_gvn.type(cast_obj)->meet_speculative(TypePtr::NULL_PTR)); | |
3018 } | |
3013 } | 3019 } |
3014 } | 3020 } |
3015 | 3021 |
3016 if (cast_obj == NULL) { | 3022 if (cast_obj == NULL) { |
3017 // Load the object's klass | 3023 // Load the object's klass |