提交 704d4ce3 编写于 作者: M minqi

Merge

...@@ -2994,22 +2994,28 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass, ...@@ -2994,22 +2994,28 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass,
} }
Node* cast_obj = NULL; Node* cast_obj = NULL;
const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr(); if (tk->klass_is_exact()) {
// We may not have profiling here or it may not help us. If we have // The following optimization tries to statically cast the speculative type of the object
// a speculative type use it to perform an exact cast. // (for example obtained during profiling) to the type of the superklass and then do a
ciKlass* spec_obj_type = obj_type->speculative_type(); // dynamic check that the type of the object is what we expect. To work correctly
if (spec_obj_type != NULL || // for checkcast and aastore the type of superklass should be exact.
(data != NULL && const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr();
// Counter has never been decremented (due to cast failure). // We may not have profiling here or it may not help us. If we have
// ...This is a reasonable thing to expect. It is true of // a speculative type use it to perform an exact cast.
// all casts inserted by javac to implement generic types. ciKlass* spec_obj_type = obj_type->speculative_type();
data->as_CounterData()->count() >= 0)) { if (spec_obj_type != NULL ||
cast_obj = maybe_cast_profiled_receiver(not_null_obj, tk->klass(), spec_obj_type, safe_for_replace); (data != NULL &&
if (cast_obj != NULL) { // Counter has never been decremented (due to cast failure).
if (failure_control != NULL) // failure is now impossible // ...This is a reasonable thing to expect. It is true of
(*failure_control) = top(); // all casts inserted by javac to implement generic types.
// adjust the type of the phi to the exact klass: data->as_CounterData()->count() >= 0)) {
phi->raise_bottom_type(_gvn.type(cast_obj)->meet_speculative(TypePtr::NULL_PTR)); cast_obj = maybe_cast_profiled_receiver(not_null_obj, tk->klass(), spec_obj_type, safe_for_replace);
if (cast_obj != NULL) {
if (failure_control != NULL) // failure is now impossible
(*failure_control) = top();
// adjust the type of the phi to the exact klass:
phi->raise_bottom_type(_gvn.type(cast_obj)->meet_speculative(TypePtr::NULL_PTR));
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册