3028 region->init_req(_null_path, null_ctl);
3029 phi ->init_req(_null_path, null()); // Set null path value
3030 if (null_ctl == top()) {
3031 // Do this eagerly, so that pattern matches like is_diamond_phi
3032 // will work even during parsing.
3033 assert(_null_path == PATH_LIMIT-1, "delete last");
3034 region->del_req(_null_path);
3035 phi ->del_req(_null_path);
3036 }
3037
3038 Node* cast_obj = NULL;
3039 if (tk->klass_is_exact()) {
3040 // The following optimization tries to statically cast the speculative type of the object
3041 // (for example obtained during profiling) to the type of the superklass and then do a
3042 // dynamic check that the type of the object is what we expect. To work correctly
3043 // for checkcast and aastore the type of superklass should be exact.
3044 const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr();
3045 // We may not have profiling here or it may not help us. If we have
3046 // a speculative type use it to perform an exact cast.
3047 ciKlass* spec_obj_type = obj_type->speculative_type();
3048 if (spec_obj_type != NULL ||
3049 (data != NULL &&
3050 // Counter has never been decremented (due to cast failure).
3051 // ...This is a reasonable thing to expect. It is true of
3052 // all casts inserted by javac to implement generic types.
3053 data->as_CounterData()->count() >= 0)) {
3054 cast_obj = maybe_cast_profiled_receiver(not_null_obj, tk->klass(), spec_obj_type, safe_for_replace);
3055 if (cast_obj != NULL) {
3056 if (failure_control != NULL) // failure is now impossible
3057 (*failure_control) = top();
3058 // adjust the type of the phi to the exact klass:
3059 phi->raise_bottom_type(_gvn.type(cast_obj)->meet_speculative(TypePtr::NULL_PTR));
3060 }
3061 }
3062 }
3063
3064 if (cast_obj == NULL) {
3065 // Load the object's klass
3066 Node* obj_klass = load_object_klass(not_null_obj);
3067
3068 // Generate the subtype check
3069 Node* not_subtype_ctrl = gen_subtype_check( obj_klass, superklass );
3070
3071 // Plug in success path into the merge
3072 cast_obj = _gvn.transform(new CheckCastPPNode(control(), not_null_obj, toop));
3073 // Failure path ends in uncommon trap (or may be dead - failure impossible)
|
3028 region->init_req(_null_path, null_ctl);
3029 phi ->init_req(_null_path, null()); // Set null path value
3030 if (null_ctl == top()) {
3031 // Do this eagerly, so that pattern matches like is_diamond_phi
3032 // will work even during parsing.
3033 assert(_null_path == PATH_LIMIT-1, "delete last");
3034 region->del_req(_null_path);
3035 phi ->del_req(_null_path);
3036 }
3037
3038 Node* cast_obj = NULL;
3039 if (tk->klass_is_exact()) {
3040 // The following optimization tries to statically cast the speculative type of the object
3041 // (for example obtained during profiling) to the type of the superklass and then do a
3042 // dynamic check that the type of the object is what we expect. To work correctly
3043 // for checkcast and aastore the type of superklass should be exact.
3044 const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr();
3045 // We may not have profiling here or it may not help us. If we have
3046 // a speculative type use it to perform an exact cast.
3047 ciKlass* spec_obj_type = obj_type->speculative_type();
3048 if (spec_obj_type != NULL || (data != NULL)) {
3049 cast_obj = maybe_cast_profiled_receiver(not_null_obj, tk->klass(), spec_obj_type, safe_for_replace);
3050 if (cast_obj != NULL) {
3051 if (failure_control != NULL) // failure is now impossible
3052 (*failure_control) = top();
3053 // adjust the type of the phi to the exact klass:
3054 phi->raise_bottom_type(_gvn.type(cast_obj)->meet_speculative(TypePtr::NULL_PTR));
3055 }
3056 }
3057 }
3058
3059 if (cast_obj == NULL) {
3060 // Load the object's klass
3061 Node* obj_klass = load_object_klass(not_null_obj);
3062
3063 // Generate the subtype check
3064 Node* not_subtype_ctrl = gen_subtype_check( obj_klass, superklass );
3065
3066 // Plug in success path into the merge
3067 cast_obj = _gvn.transform(new CheckCastPPNode(control(), not_null_obj, toop));
3068 // Failure path ends in uncommon trap (or may be dead - failure impossible)
|