1378
1379 // Array pointers need some flattening
1380 const TypeAryPtr* ta = tj->isa_aryptr();
1381 if (ta && ta->is_stable()) {
1382 // Erase stability property for alias analysis.
1383 tj = ta = ta->cast_to_stable(false);
1384 }
1385 if( ta && is_known_inst ) {
1386 if ( offset != Type::OffsetBot &&
1387 offset > arrayOopDesc::length_offset_in_bytes() ) {
1388 offset = Type::OffsetBot; // Flatten constant access into array body only
1389 tj = ta = ta->
1390 remove_speculative()->
1391 cast_to_ptr_type(ptr)->
1392 with_offset(offset);
1393 }
1394 } else if (ta != nullptr) {
1395 // Common slices
1396 if (offset == arrayOopDesc::length_offset_in_bytes()) {
1397 return TypeAryPtr::RANGE;
1398 } else if (offset == oopDesc::klass_offset_in_bytes()) {
1399 return TypeInstPtr::KLASS;
1400 } else if (offset == oopDesc::mark_offset_in_bytes()) {
1401 return TypeInstPtr::MARK;
1402 }
1403
1404 // Remove size and stability
1405 const TypeAry* normalized_ary = TypeAry::make(ta->elem(), TypeInt::POS, false);
1406 // Remove ptr, const_oop, and offset
1407 if (ta->elem() == Type::BOTTOM) {
1408 // Bottom array (meet of int[] and byte[] for example), accesses to it will be done with
1409 // Unsafe. This should alias with all arrays. For now just leave it as it is (this is
1410 // incorrect, see JDK-8331133).
1411 tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, normalized_ary, nullptr, false, Type::OffsetBot);
1412 } else if (ta->elem()->make_oopptr() != nullptr) {
1413 // Object arrays, all of them share the same slice
1414 const TypeAry* tary = TypeAry::make(TypeInstPtr::BOTTOM, TypeInt::POS, false);
1415 tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, tary, nullptr, false, Type::OffsetBot);
1416 } else {
1417 // Primitive arrays
1418 tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, normalized_ary, ta->exact_klass(), true, Type::OffsetBot);
1527 offset = in_bytes(Klass::secondary_super_cache_offset());
1528 tj = tk = tk->with_offset(offset);
1529 }
1530 }
1531
1532 // Flatten all Raw pointers together.
1533 if (tj->base() == Type::RawPtr)
1534 tj = TypeRawPtr::BOTTOM;
1535
1536 if (tj->base() == Type::AnyPtr)
1537 tj = TypePtr::BOTTOM; // An error, which the caller must check for.
1538
1539 offset = tj->offset();
1540 assert( offset != Type::OffsetTop, "Offset has fallen from constant" );
1541
1542 assert( (offset != Type::OffsetBot && tj->base() != Type::AryPtr) ||
1543 (offset == Type::OffsetBot && tj->base() == Type::AryPtr) ||
1544 (offset == Type::OffsetBot && tj == TypeOopPtr::BOTTOM) ||
1545 (offset == Type::OffsetBot && tj == TypePtr::BOTTOM) ||
1546 (offset == oopDesc::mark_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1547 (offset == oopDesc::klass_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1548 (offset == arrayOopDesc::length_offset_in_bytes() && tj->base() == Type::AryPtr),
1549 "For oops, klasses, raw offset must be constant; for arrays the offset is never known" );
1550 assert( tj->ptr() != TypePtr::TopPTR &&
1551 tj->ptr() != TypePtr::AnyNull &&
1552 tj->ptr() != TypePtr::Null, "No imprecise addresses" );
1553 // assert( tj->ptr() != TypePtr::Constant ||
1554 // tj->base() == Type::RawPtr ||
1555 // tj->base() == Type::KlassPtr, "No constant oop addresses" );
1556
1557 return tj;
1558 }
1559
1560 void Compile::AliasType::Init(int i, const TypePtr* at) {
1561 assert(AliasIdxTop <= i && i < Compile::current()->_max_alias_types, "Invalid alias index");
1562 _index = i;
1563 _adr_type = at;
1564 _field = nullptr;
1565 _element = nullptr;
1566 _is_rewritable = true; // default
1567 const TypeOopPtr *atoop = (at != nullptr) ? at->isa_oopptr() : nullptr;
|
1378
1379 // Array pointers need some flattening
1380 const TypeAryPtr* ta = tj->isa_aryptr();
1381 if (ta && ta->is_stable()) {
1382 // Erase stability property for alias analysis.
1383 tj = ta = ta->cast_to_stable(false);
1384 }
1385 if( ta && is_known_inst ) {
1386 if ( offset != Type::OffsetBot &&
1387 offset > arrayOopDesc::length_offset_in_bytes() ) {
1388 offset = Type::OffsetBot; // Flatten constant access into array body only
1389 tj = ta = ta->
1390 remove_speculative()->
1391 cast_to_ptr_type(ptr)->
1392 with_offset(offset);
1393 }
1394 } else if (ta != nullptr) {
1395 // Common slices
1396 if (offset == arrayOopDesc::length_offset_in_bytes()) {
1397 return TypeAryPtr::RANGE;
1398 } else if (offset == Type::klass_offset()) {
1399 return TypeInstPtr::KLASS;
1400 } else if (offset == oopDesc::mark_offset_in_bytes()) {
1401 return TypeInstPtr::MARK;
1402 }
1403
1404 // Remove size and stability
1405 const TypeAry* normalized_ary = TypeAry::make(ta->elem(), TypeInt::POS, false);
1406 // Remove ptr, const_oop, and offset
1407 if (ta->elem() == Type::BOTTOM) {
1408 // Bottom array (meet of int[] and byte[] for example), accesses to it will be done with
1409 // Unsafe. This should alias with all arrays. For now just leave it as it is (this is
1410 // incorrect, see JDK-8331133).
1411 tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, normalized_ary, nullptr, false, Type::OffsetBot);
1412 } else if (ta->elem()->make_oopptr() != nullptr) {
1413 // Object arrays, all of them share the same slice
1414 const TypeAry* tary = TypeAry::make(TypeInstPtr::BOTTOM, TypeInt::POS, false);
1415 tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, tary, nullptr, false, Type::OffsetBot);
1416 } else {
1417 // Primitive arrays
1418 tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, normalized_ary, ta->exact_klass(), true, Type::OffsetBot);
1527 offset = in_bytes(Klass::secondary_super_cache_offset());
1528 tj = tk = tk->with_offset(offset);
1529 }
1530 }
1531
1532 // Flatten all Raw pointers together.
1533 if (tj->base() == Type::RawPtr)
1534 tj = TypeRawPtr::BOTTOM;
1535
1536 if (tj->base() == Type::AnyPtr)
1537 tj = TypePtr::BOTTOM; // An error, which the caller must check for.
1538
1539 offset = tj->offset();
1540 assert( offset != Type::OffsetTop, "Offset has fallen from constant" );
1541
1542 assert( (offset != Type::OffsetBot && tj->base() != Type::AryPtr) ||
1543 (offset == Type::OffsetBot && tj->base() == Type::AryPtr) ||
1544 (offset == Type::OffsetBot && tj == TypeOopPtr::BOTTOM) ||
1545 (offset == Type::OffsetBot && tj == TypePtr::BOTTOM) ||
1546 (offset == oopDesc::mark_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1547 (offset == Type::klass_offset() && tj->base() == Type::AryPtr) ||
1548 (offset == arrayOopDesc::length_offset_in_bytes() && tj->base() == Type::AryPtr),
1549 "For oops, klasses, raw offset must be constant; for arrays the offset is never known" );
1550 assert( tj->ptr() != TypePtr::TopPTR &&
1551 tj->ptr() != TypePtr::AnyNull &&
1552 tj->ptr() != TypePtr::Null, "No imprecise addresses" );
1553 // assert( tj->ptr() != TypePtr::Constant ||
1554 // tj->base() == Type::RawPtr ||
1555 // tj->base() == Type::KlassPtr, "No constant oop addresses" );
1556
1557 return tj;
1558 }
1559
1560 void Compile::AliasType::Init(int i, const TypePtr* at) {
1561 assert(AliasIdxTop <= i && i < Compile::current()->_max_alias_types, "Invalid alias index");
1562 _index = i;
1563 _adr_type = at;
1564 _field = nullptr;
1565 _element = nullptr;
1566 _is_rewritable = true; // default
1567 const TypeOopPtr *atoop = (at != nullptr) ? at->isa_oopptr() : nullptr;
|