2347 // This logic looks at the element type of an array, and returns true
2348 // if the element type is either a primitive or a final instance class.
2349 // In such cases, an array built on this ary must have no subclasses.
2350 if (_elem == BOTTOM) return false; // general array not exact
2351 if (_elem == TOP ) return false; // inverted general array not exact
2352 const TypeOopPtr* toop = NULL;
2353 if (UseCompressedOops && _elem->isa_narrowoop()) {
2354 toop = _elem->make_ptr()->isa_oopptr();
2355 } else {
2356 toop = _elem->isa_oopptr();
2357 }
2358 if (!toop) return true; // a primitive type, like int
2359 ciKlass* tklass = toop->klass();
2360 if (tklass == NULL) return false; // unloaded class
2361 if (!tklass->is_loaded()) return false; // unloaded class
2362 const TypeInstPtr* tinst;
2363 if (_elem->isa_narrowoop())
2364 tinst = _elem->make_ptr()->isa_instptr();
2365 else
2366 tinst = _elem->isa_instptr();
2367 if (tinst)
2368 return tklass->as_instance_klass()->is_final();
2369 const TypeAryPtr* tap;
2370 if (_elem->isa_narrowoop())
2371 tap = _elem->make_ptr()->isa_aryptr();
2372 else
2373 tap = _elem->isa_aryptr();
2374 if (tap)
2375 return tap->ary()->ary_must_be_exact();
2376 return false;
2377 }
2378
2379 //==============================TypeValueType=======================================
2380
2381 //------------------------------make-------------------------------------------
2382 const TypeValueType* TypeValueType::make(ciValueKlass* vk, bool larval) {
2383 return (TypeValueType*)(new TypeValueType(vk, larval))->hashcons();
2384 }
2385
2386 //------------------------------meet-------------------------------------------
2387 // Compute the MEET of two types. It returns a new Type object.
2388 const Type* TypeValueType::xmeet(const Type* t) const {
3432 klass_is_exact = sub->is_final();
3433 }
3434 }
3435 if (!klass_is_exact && try_for_exact
3436 && deps != NULL && UseExactTypes) {
3437 if (!ik->is_interface() && !ik->has_subklass()) {
3438 // Add a dependence; if concrete subclass added we need to recompile
3439 deps->assert_leaf_type(ik);
3440 klass_is_exact = true;
3441 }
3442 }
3443 }
3444 return TypeInstPtr::make(TypePtr::BotPTR, klass, klass_is_exact, NULL, Offset(0));
3445 } else if (klass->is_obj_array_klass()) {
3446 // Element is an object or value array. Recursively call ourself.
3447 const TypeOopPtr* etype = TypeOopPtr::make_from_klass_common(klass->as_array_klass()->element_klass(), false, try_for_exact);
3448 bool null_free = klass->is_loaded() && klass->as_array_klass()->storage_properties().is_null_free();
3449 if (null_free && etype->is_valuetypeptr()) {
3450 etype = etype->join_speculative(TypePtr::NOTNULL)->is_oopptr();
3451 }
3452 bool xk = etype->klass_is_exact();
3453 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
3454 // We used to pass NotNull in here, asserting that the sub-arrays
3455 // are all not-null. This is not true in generally, as code can
3456 // slam NULLs down in the subarrays.
3457 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, xk, Offset(0));
3458 return arr;
3459 } else if (klass->is_type_array_klass()) {
3460 // Element is an typeArray
3461 const Type* etype = get_const_basic_type(klass->as_type_array_klass()->element_type());
3462 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
3463 // We used to pass NotNull in here, asserting that the array pointer
3464 // is not-null. That was not true in general.
3465 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, true, Offset(0));
3466 return arr;
3467 } else if (klass->is_value_array_klass()) {
3468 ciValueKlass* vk = klass->as_array_klass()->element_klass()->as_value_klass();
3469 const TypeAry* arr0 = TypeAry::make(TypeValueType::make(vk), TypeInt::POS);
3470 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, true, Offset(0));
3471 return arr;
3472 } else {
|
2347 // This logic looks at the element type of an array, and returns true
2348 // if the element type is either a primitive or a final instance class.
2349 // In such cases, an array built on this ary must have no subclasses.
2350 if (_elem == BOTTOM) return false; // general array not exact
2351 if (_elem == TOP ) return false; // inverted general array not exact
2352 const TypeOopPtr* toop = NULL;
2353 if (UseCompressedOops && _elem->isa_narrowoop()) {
2354 toop = _elem->make_ptr()->isa_oopptr();
2355 } else {
2356 toop = _elem->isa_oopptr();
2357 }
2358 if (!toop) return true; // a primitive type, like int
2359 ciKlass* tklass = toop->klass();
2360 if (tklass == NULL) return false; // unloaded class
2361 if (!tklass->is_loaded()) return false; // unloaded class
2362 const TypeInstPtr* tinst;
2363 if (_elem->isa_narrowoop())
2364 tinst = _elem->make_ptr()->isa_instptr();
2365 else
2366 tinst = _elem->isa_instptr();
2367 if (tinst) {
2368 if (tklass->as_instance_klass()->is_final()) {
2369 if (tinst->is_valuetypeptr() && (tinst->ptr() == TypePtr::BotPTR || tinst->ptr() == TypePtr::TopPTR)) {
2370 return false;
2371 }
2372 return true;
2373 }
2374 return false;
2375 }
2376 const TypeAryPtr* tap;
2377 if (_elem->isa_narrowoop())
2378 tap = _elem->make_ptr()->isa_aryptr();
2379 else
2380 tap = _elem->isa_aryptr();
2381 if (tap)
2382 return tap->ary()->ary_must_be_exact();
2383 return false;
2384 }
2385
2386 //==============================TypeValueType=======================================
2387
2388 //------------------------------make-------------------------------------------
2389 const TypeValueType* TypeValueType::make(ciValueKlass* vk, bool larval) {
2390 return (TypeValueType*)(new TypeValueType(vk, larval))->hashcons();
2391 }
2392
2393 //------------------------------meet-------------------------------------------
2394 // Compute the MEET of two types. It returns a new Type object.
2395 const Type* TypeValueType::xmeet(const Type* t) const {
3439 klass_is_exact = sub->is_final();
3440 }
3441 }
3442 if (!klass_is_exact && try_for_exact
3443 && deps != NULL && UseExactTypes) {
3444 if (!ik->is_interface() && !ik->has_subklass()) {
3445 // Add a dependence; if concrete subclass added we need to recompile
3446 deps->assert_leaf_type(ik);
3447 klass_is_exact = true;
3448 }
3449 }
3450 }
3451 return TypeInstPtr::make(TypePtr::BotPTR, klass, klass_is_exact, NULL, Offset(0));
3452 } else if (klass->is_obj_array_klass()) {
3453 // Element is an object or value array. Recursively call ourself.
3454 const TypeOopPtr* etype = TypeOopPtr::make_from_klass_common(klass->as_array_klass()->element_klass(), false, try_for_exact);
3455 bool null_free = klass->is_loaded() && klass->as_array_klass()->storage_properties().is_null_free();
3456 if (null_free && etype->is_valuetypeptr()) {
3457 etype = etype->join_speculative(TypePtr::NOTNULL)->is_oopptr();
3458 }
3459 bool xk = etype->klass_is_exact() && (!etype->is_valuetypeptr() || null_free);
3460 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
3461 // We used to pass NotNull in here, asserting that the sub-arrays
3462 // are all not-null. This is not true in generally, as code can
3463 // slam NULLs down in the subarrays.
3464 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, xk, Offset(0));
3465 return arr;
3466 } else if (klass->is_type_array_klass()) {
3467 // Element is an typeArray
3468 const Type* etype = get_const_basic_type(klass->as_type_array_klass()->element_type());
3469 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
3470 // We used to pass NotNull in here, asserting that the array pointer
3471 // is not-null. That was not true in general.
3472 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, true, Offset(0));
3473 return arr;
3474 } else if (klass->is_value_array_klass()) {
3475 ciValueKlass* vk = klass->as_array_klass()->element_klass()->as_value_klass();
3476 const TypeAry* arr0 = TypeAry::make(TypeValueType::make(vk), TypeInt::POS);
3477 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, true, Offset(0));
3478 return arr;
3479 } else {
|