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