3151 // for example, in some objArray manipulations, such as a[i]=a[j].)
3152 if (tk->singleton()) {
3153 ciKlass* klass = NULL;
3154 if (is_value) {
3155 klass = _gvn.type(obj)->is_valuetype()->value_klass();
3156 } else {
3157 const TypeOopPtr* objtp = _gvn.type(obj)->isa_oopptr();
3158 if (objtp != NULL) {
3159 klass = objtp->klass();
3160 }
3161 }
3162 if (klass != NULL) {
3163 switch (C->static_subtype_check(tk->klass(), klass)) {
3164 case Compile::SSC_always_true:
3165 // If we know the type check always succeed then we don't use
3166 // the profiling data at this bytecode. Don't lose it, feed it
3167 // to the type system as a speculative type.
3168 if (!is_value) {
3169 obj = record_profiled_receiver_for_speculation(obj);
3170 if (toop->is_valuetypeptr()) {
3171 obj = ValueTypeNode::make_from_oop(this, obj, toop->value_klass(), /* buffer_check */ false, /* null2default */ false);
3172 }
3173 }
3174 return obj;
3175 case Compile::SSC_always_false:
3176 // It needs a null check because a null will *pass* the cast check.
3177 // A non-null value will always produce an exception.
3178 if (is_value) {
3179 builtin_throw(Deoptimization::Reason_class_check, makecon(TypeKlassPtr::make(klass)));
3180 return top();
3181 } else {
3182 return null_assert(obj);
3183 }
3184 }
3185 }
3186 }
3187
3188 ciProfileData* data = NULL;
3189 bool safe_for_replace = false;
3190 if (failure_control == NULL) { // use MDO in regular case only
3191 assert(java_bc() == Bytecodes::_aastore ||
3289 // A merge of NULL or Casted-NotNull obj
3290 Node* res = _gvn.transform(phi);
3291
3292 // Note I do NOT always 'replace_in_map(obj,result)' here.
3293 // if( tk->klass()->can_be_primary_super() )
3294 // This means that if I successfully store an Object into an array-of-String
3295 // I 'forget' that the Object is really now known to be a String. I have to
3296 // do this because we don't have true union types for interfaces - if I store
3297 // a Baz into an array-of-Interface and then tell the optimizer it's an
3298 // Interface, I forget that it's also a Baz and cannot do Baz-like field
3299 // references to it. FIX THIS WHEN UNION TYPES APPEAR!
3300 // replace_in_map( obj, res );
3301
3302 // Return final merged results
3303 set_control( _gvn.transform(region) );
3304 record_for_igvn(region);
3305
3306 if (!is_value) {
3307 res = record_profiled_receiver_for_speculation(res);
3308 if (toop->is_valuetypeptr()) {
3309 res = ValueTypeNode::make_from_oop(this, res, toop->value_klass(), /* buffer_check */ false, /* null2default */ false);
3310 }
3311 }
3312 return res;
3313 }
3314
3315 Node* GraphKit::is_always_locked(Node* obj) {
3316 Node* mark_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
3317 Node* mark = make_load(NULL, mark_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
3318 Node* value_mask = _gvn.MakeConX(markOopDesc::always_locked_pattern);
3319 return _gvn.transform(new AndXNode(mark, value_mask));
3320 }
3321
3322 Node* GraphKit::gen_value_type_test(Node* kls) {
3323 Node* flags_addr = basic_plus_adr(kls, in_bytes(Klass::access_flags_offset()));
3324 Node* flags = make_load(NULL, flags_addr, TypeInt::INT, T_INT, MemNode::unordered);
3325 Node* is_value = _gvn.transform(new AndINode(flags, intcon(JVM_ACC_VALUE)));
3326 Node* cmp = _gvn.transform(new CmpINode(is_value, intcon(0)));
3327 return cmp;
3328 }
3329
|
3151 // for example, in some objArray manipulations, such as a[i]=a[j].)
3152 if (tk->singleton()) {
3153 ciKlass* klass = NULL;
3154 if (is_value) {
3155 klass = _gvn.type(obj)->is_valuetype()->value_klass();
3156 } else {
3157 const TypeOopPtr* objtp = _gvn.type(obj)->isa_oopptr();
3158 if (objtp != NULL) {
3159 klass = objtp->klass();
3160 }
3161 }
3162 if (klass != NULL) {
3163 switch (C->static_subtype_check(tk->klass(), klass)) {
3164 case Compile::SSC_always_true:
3165 // If we know the type check always succeed then we don't use
3166 // the profiling data at this bytecode. Don't lose it, feed it
3167 // to the type system as a speculative type.
3168 if (!is_value) {
3169 obj = record_profiled_receiver_for_speculation(obj);
3170 if (toop->is_valuetypeptr()) {
3171 obj = ValueTypeNode::make_from_oop(this, obj, toop->value_klass(), /* null2default */ false);
3172 }
3173 }
3174 return obj;
3175 case Compile::SSC_always_false:
3176 // It needs a null check because a null will *pass* the cast check.
3177 // A non-null value will always produce an exception.
3178 if (is_value) {
3179 builtin_throw(Deoptimization::Reason_class_check, makecon(TypeKlassPtr::make(klass)));
3180 return top();
3181 } else {
3182 return null_assert(obj);
3183 }
3184 }
3185 }
3186 }
3187
3188 ciProfileData* data = NULL;
3189 bool safe_for_replace = false;
3190 if (failure_control == NULL) { // use MDO in regular case only
3191 assert(java_bc() == Bytecodes::_aastore ||
3289 // A merge of NULL or Casted-NotNull obj
3290 Node* res = _gvn.transform(phi);
3291
3292 // Note I do NOT always 'replace_in_map(obj,result)' here.
3293 // if( tk->klass()->can_be_primary_super() )
3294 // This means that if I successfully store an Object into an array-of-String
3295 // I 'forget' that the Object is really now known to be a String. I have to
3296 // do this because we don't have true union types for interfaces - if I store
3297 // a Baz into an array-of-Interface and then tell the optimizer it's an
3298 // Interface, I forget that it's also a Baz and cannot do Baz-like field
3299 // references to it. FIX THIS WHEN UNION TYPES APPEAR!
3300 // replace_in_map( obj, res );
3301
3302 // Return final merged results
3303 set_control( _gvn.transform(region) );
3304 record_for_igvn(region);
3305
3306 if (!is_value) {
3307 res = record_profiled_receiver_for_speculation(res);
3308 if (toop->is_valuetypeptr()) {
3309 res = ValueTypeNode::make_from_oop(this, res, toop->value_klass(), /* null2default */ false);
3310 }
3311 }
3312 return res;
3313 }
3314
3315 Node* GraphKit::is_always_locked(Node* obj) {
3316 Node* mark_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes());
3317 Node* mark = make_load(NULL, mark_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
3318 Node* value_mask = _gvn.MakeConX(markOopDesc::always_locked_pattern);
3319 return _gvn.transform(new AndXNode(mark, value_mask));
3320 }
3321
3322 Node* GraphKit::gen_value_type_test(Node* kls) {
3323 Node* flags_addr = basic_plus_adr(kls, in_bytes(Klass::access_flags_offset()));
3324 Node* flags = make_load(NULL, flags_addr, TypeInt::INT, T_INT, MemNode::unordered);
3325 Node* is_value = _gvn.transform(new AndINode(flags, intcon(JVM_ACC_VALUE)));
3326 Node* cmp = _gvn.transform(new CmpINode(is_value, intcon(0)));
3327 return cmp;
3328 }
3329
|