< prev index next >

src/hotspot/share/opto/compile.cpp

Print this page

1356 
1357   // Array pointers need some flattening
1358   const TypeAryPtr* ta = tj->isa_aryptr();
1359   if (ta && ta->is_stable()) {
1360     // Erase stability property for alias analysis.
1361     tj = ta = ta->cast_to_stable(false);
1362   }
1363   if( ta && is_known_inst ) {
1364     if ( offset != Type::OffsetBot &&
1365          offset > arrayOopDesc::length_offset_in_bytes() ) {
1366       offset = Type::OffsetBot; // Flatten constant access into array body only
1367       tj = ta = ta->
1368               remove_speculative()->
1369               cast_to_ptr_type(ptr)->
1370               with_offset(offset);
1371     }
1372   } else if (ta != nullptr) {
1373     // Common slices
1374     if (offset == arrayOopDesc::length_offset_in_bytes()) {
1375       return TypeAryPtr::RANGE;
1376     } else if (offset == oopDesc::klass_offset_in_bytes()) {
1377       return TypeInstPtr::KLASS;
1378     } else if (offset == oopDesc::mark_offset_in_bytes()) {
1379       return TypeInstPtr::MARK;
1380     }
1381 
1382     // Remove size and stability
1383     const TypeAry* normalized_ary = TypeAry::make(ta->elem(), TypeInt::POS, false);
1384     // Remove ptr, const_oop, and offset
1385     if (ta->elem() == Type::BOTTOM) {
1386       // Bottom array (meet of int[] and byte[] for example), accesses to it will be done with
1387       // Unsafe. This should alias with all arrays. For now just leave it as it is (this is
1388       // incorrect, see JDK-8331133).
1389       tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, normalized_ary, nullptr, false, Type::OffsetBot);
1390     } else if (ta->elem()->make_oopptr() != nullptr) {
1391       // Object arrays, all of them share the same slice
1392       const TypeAry* tary = TypeAry::make(TypeInstPtr::BOTTOM, TypeInt::POS, false);
1393       tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, tary, nullptr, false, Type::OffsetBot);
1394     } else {
1395       // Primitive arrays
1396       tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, normalized_ary, ta->exact_klass(), true, Type::OffsetBot);

1505       offset = in_bytes(Klass::secondary_super_cache_offset());
1506       tj = tk = tk->with_offset(offset);
1507     }
1508   }
1509 
1510   // Flatten all Raw pointers together.
1511   if (tj->base() == Type::RawPtr)
1512     tj = TypeRawPtr::BOTTOM;
1513 
1514   if (tj->base() == Type::AnyPtr)
1515     tj = TypePtr::BOTTOM;      // An error, which the caller must check for.
1516 
1517   offset = tj->offset();
1518   assert( offset != Type::OffsetTop, "Offset has fallen from constant" );
1519 
1520   assert( (offset != Type::OffsetBot && tj->base() != Type::AryPtr) ||
1521           (offset == Type::OffsetBot && tj->base() == Type::AryPtr) ||
1522           (offset == Type::OffsetBot && tj == TypeOopPtr::BOTTOM) ||
1523           (offset == Type::OffsetBot && tj == TypePtr::BOTTOM) ||
1524           (offset == oopDesc::mark_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1525           (offset == oopDesc::klass_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1526           (offset == arrayOopDesc::length_offset_in_bytes() && tj->base() == Type::AryPtr),
1527           "For oops, klasses, raw offset must be constant; for arrays the offset is never known" );
1528   assert( tj->ptr() != TypePtr::TopPTR &&
1529           tj->ptr() != TypePtr::AnyNull &&
1530           tj->ptr() != TypePtr::Null, "No imprecise addresses" );
1531 //    assert( tj->ptr() != TypePtr::Constant ||
1532 //            tj->base() == Type::RawPtr ||
1533 //            tj->base() == Type::KlassPtr, "No constant oop addresses" );
1534 
1535   return tj;
1536 }
1537 
1538 void Compile::AliasType::Init(int i, const TypePtr* at) {
1539   assert(AliasIdxTop <= i && i < Compile::current()->_max_alias_types, "Invalid alias index");
1540   _index = i;
1541   _adr_type = at;
1542   _field = nullptr;
1543   _element = nullptr;
1544   _is_rewritable = true; // default
1545   const TypeOopPtr *atoop = (at != nullptr) ? at->isa_oopptr() : nullptr;

1356 
1357   // Array pointers need some flattening
1358   const TypeAryPtr* ta = tj->isa_aryptr();
1359   if (ta && ta->is_stable()) {
1360     // Erase stability property for alias analysis.
1361     tj = ta = ta->cast_to_stable(false);
1362   }
1363   if( ta && is_known_inst ) {
1364     if ( offset != Type::OffsetBot &&
1365          offset > arrayOopDesc::length_offset_in_bytes() ) {
1366       offset = Type::OffsetBot; // Flatten constant access into array body only
1367       tj = ta = ta->
1368               remove_speculative()->
1369               cast_to_ptr_type(ptr)->
1370               with_offset(offset);
1371     }
1372   } else if (ta != nullptr) {
1373     // Common slices
1374     if (offset == arrayOopDesc::length_offset_in_bytes()) {
1375       return TypeAryPtr::RANGE;
1376     } else if (offset == Type::klass_offset()) {
1377       return TypeInstPtr::KLASS;
1378     } else if (offset == oopDesc::mark_offset_in_bytes()) {
1379       return TypeInstPtr::MARK;
1380     }
1381 
1382     // Remove size and stability
1383     const TypeAry* normalized_ary = TypeAry::make(ta->elem(), TypeInt::POS, false);
1384     // Remove ptr, const_oop, and offset
1385     if (ta->elem() == Type::BOTTOM) {
1386       // Bottom array (meet of int[] and byte[] for example), accesses to it will be done with
1387       // Unsafe. This should alias with all arrays. For now just leave it as it is (this is
1388       // incorrect, see JDK-8331133).
1389       tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, normalized_ary, nullptr, false, Type::OffsetBot);
1390     } else if (ta->elem()->make_oopptr() != nullptr) {
1391       // Object arrays, all of them share the same slice
1392       const TypeAry* tary = TypeAry::make(TypeInstPtr::BOTTOM, TypeInt::POS, false);
1393       tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, tary, nullptr, false, Type::OffsetBot);
1394     } else {
1395       // Primitive arrays
1396       tj = ta = TypeAryPtr::make(TypePtr::BotPTR, nullptr, normalized_ary, ta->exact_klass(), true, Type::OffsetBot);

1505       offset = in_bytes(Klass::secondary_super_cache_offset());
1506       tj = tk = tk->with_offset(offset);
1507     }
1508   }
1509 
1510   // Flatten all Raw pointers together.
1511   if (tj->base() == Type::RawPtr)
1512     tj = TypeRawPtr::BOTTOM;
1513 
1514   if (tj->base() == Type::AnyPtr)
1515     tj = TypePtr::BOTTOM;      // An error, which the caller must check for.
1516 
1517   offset = tj->offset();
1518   assert( offset != Type::OffsetTop, "Offset has fallen from constant" );
1519 
1520   assert( (offset != Type::OffsetBot && tj->base() != Type::AryPtr) ||
1521           (offset == Type::OffsetBot && tj->base() == Type::AryPtr) ||
1522           (offset == Type::OffsetBot && tj == TypeOopPtr::BOTTOM) ||
1523           (offset == Type::OffsetBot && tj == TypePtr::BOTTOM) ||
1524           (offset == oopDesc::mark_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1525           (offset == Type::klass_offset() && tj->base() == Type::AryPtr) ||
1526           (offset == arrayOopDesc::length_offset_in_bytes() && tj->base() == Type::AryPtr),
1527           "For oops, klasses, raw offset must be constant; for arrays the offset is never known" );
1528   assert( tj->ptr() != TypePtr::TopPTR &&
1529           tj->ptr() != TypePtr::AnyNull &&
1530           tj->ptr() != TypePtr::Null, "No imprecise addresses" );
1531 //    assert( tj->ptr() != TypePtr::Constant ||
1532 //            tj->base() == Type::RawPtr ||
1533 //            tj->base() == Type::KlassPtr, "No constant oop addresses" );
1534 
1535   return tj;
1536 }
1537 
1538 void Compile::AliasType::Init(int i, const TypePtr* at) {
1539   assert(AliasIdxTop <= i && i < Compile::current()->_max_alias_types, "Invalid alias index");
1540   _index = i;
1541   _adr_type = at;
1542   _field = nullptr;
1543   _element = nullptr;
1544   _is_rewritable = true; // default
1545   const TypeOopPtr *atoop = (at != nullptr) ? at->isa_oopptr() : nullptr;
< prev index next >