< prev index next >

src/hotspot/share/opto/compile.cpp

Print this page

1363       tj = ta = ta->
1364               remove_speculative()->
1365               cast_to_ptr_type(ptr)->
1366               with_offset(offset);
1367     }
1368   } else if (ta) {
1369     // For arrays indexed by constant indices, we flatten the alias
1370     // space to include all of the array body.  Only the header, klass
1371     // and array length can be accessed un-aliased.
1372     if( offset != Type::OffsetBot ) {
1373       if( ta->const_oop() ) { // MethodData* or Method*
1374         offset = Type::OffsetBot;   // Flatten constant access into array body
1375         tj = ta = ta->
1376                 remove_speculative()->
1377                 cast_to_ptr_type(ptr)->
1378                 cast_to_exactness(false)->
1379                 with_offset(offset);
1380       } else if( offset == arrayOopDesc::length_offset_in_bytes() ) {
1381         // range is OK as-is.
1382         tj = ta = TypeAryPtr::RANGE;
1383       } else if( offset == oopDesc::klass_offset_in_bytes() ) {
1384         tj = TypeInstPtr::KLASS; // all klass loads look alike
1385         ta = TypeAryPtr::RANGE; // generic ignored junk
1386         ptr = TypePtr::BotPTR;
1387       } else if( offset == oopDesc::mark_offset_in_bytes() ) {
1388         tj = TypeInstPtr::MARK;
1389         ta = TypeAryPtr::RANGE; // generic ignored junk
1390         ptr = TypePtr::BotPTR;
1391       } else {                  // Random constant offset into array body
1392         offset = Type::OffsetBot;   // Flatten constant access into array body
1393         tj = ta = ta->
1394                 remove_speculative()->
1395                 cast_to_ptr_type(ptr)->
1396                 cast_to_exactness(false)->
1397                 with_offset(offset);
1398       }
1399     }
1400     // Arrays of fixed size alias with arrays of unknown size.
1401     if (ta->size() != TypeInt::POS) {
1402       const TypeAry *tary = TypeAry::make(ta->elem(), TypeInt::POS);
1403       tj = ta = ta->

1536       offset = in_bytes(Klass::secondary_super_cache_offset());
1537       tj = tk = tk->with_offset(offset);
1538     }
1539   }
1540 
1541   // Flatten all Raw pointers together.
1542   if (tj->base() == Type::RawPtr)
1543     tj = TypeRawPtr::BOTTOM;
1544 
1545   if (tj->base() == Type::AnyPtr)
1546     tj = TypePtr::BOTTOM;      // An error, which the caller must check for.
1547 
1548   offset = tj->offset();
1549   assert( offset != Type::OffsetTop, "Offset has fallen from constant" );
1550 
1551   assert( (offset != Type::OffsetBot && tj->base() != Type::AryPtr) ||
1552           (offset == Type::OffsetBot && tj->base() == Type::AryPtr) ||
1553           (offset == Type::OffsetBot && tj == TypeOopPtr::BOTTOM) ||
1554           (offset == Type::OffsetBot && tj == TypePtr::BOTTOM) ||
1555           (offset == oopDesc::mark_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1556           (offset == oopDesc::klass_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1557           (offset == arrayOopDesc::length_offset_in_bytes() && tj->base() == Type::AryPtr),
1558           "For oops, klasses, raw offset must be constant; for arrays the offset is never known" );
1559   assert( tj->ptr() != TypePtr::TopPTR &&
1560           tj->ptr() != TypePtr::AnyNull &&
1561           tj->ptr() != TypePtr::Null, "No imprecise addresses" );
1562 //    assert( tj->ptr() != TypePtr::Constant ||
1563 //            tj->base() == Type::RawPtr ||
1564 //            tj->base() == Type::KlassPtr, "No constant oop addresses" );
1565 
1566   return tj;
1567 }
1568 
1569 void Compile::AliasType::Init(int i, const TypePtr* at) {
1570   assert(AliasIdxTop <= i && i < Compile::current()->_max_alias_types, "Invalid alias index");
1571   _index = i;
1572   _adr_type = at;
1573   _field = nullptr;
1574   _element = nullptr;
1575   _is_rewritable = true; // default
1576   const TypeOopPtr *atoop = (at != nullptr) ? at->isa_oopptr() : nullptr;

1363       tj = ta = ta->
1364               remove_speculative()->
1365               cast_to_ptr_type(ptr)->
1366               with_offset(offset);
1367     }
1368   } else if (ta) {
1369     // For arrays indexed by constant indices, we flatten the alias
1370     // space to include all of the array body.  Only the header, klass
1371     // and array length can be accessed un-aliased.
1372     if( offset != Type::OffsetBot ) {
1373       if( ta->const_oop() ) { // MethodData* or Method*
1374         offset = Type::OffsetBot;   // Flatten constant access into array body
1375         tj = ta = ta->
1376                 remove_speculative()->
1377                 cast_to_ptr_type(ptr)->
1378                 cast_to_exactness(false)->
1379                 with_offset(offset);
1380       } else if( offset == arrayOopDesc::length_offset_in_bytes() ) {
1381         // range is OK as-is.
1382         tj = ta = TypeAryPtr::RANGE;
1383       } else if( offset == Type::klass_offset() ) {
1384         tj = TypeInstPtr::KLASS; // all klass loads look alike
1385         ta = TypeAryPtr::RANGE; // generic ignored junk
1386         ptr = TypePtr::BotPTR;
1387       } else if( offset == oopDesc::mark_offset_in_bytes() ) {
1388         tj = TypeInstPtr::MARK;
1389         ta = TypeAryPtr::RANGE; // generic ignored junk
1390         ptr = TypePtr::BotPTR;
1391       } else {                  // Random constant offset into array body
1392         offset = Type::OffsetBot;   // Flatten constant access into array body
1393         tj = ta = ta->
1394                 remove_speculative()->
1395                 cast_to_ptr_type(ptr)->
1396                 cast_to_exactness(false)->
1397                 with_offset(offset);
1398       }
1399     }
1400     // Arrays of fixed size alias with arrays of unknown size.
1401     if (ta->size() != TypeInt::POS) {
1402       const TypeAry *tary = TypeAry::make(ta->elem(), TypeInt::POS);
1403       tj = ta = ta->

1536       offset = in_bytes(Klass::secondary_super_cache_offset());
1537       tj = tk = tk->with_offset(offset);
1538     }
1539   }
1540 
1541   // Flatten all Raw pointers together.
1542   if (tj->base() == Type::RawPtr)
1543     tj = TypeRawPtr::BOTTOM;
1544 
1545   if (tj->base() == Type::AnyPtr)
1546     tj = TypePtr::BOTTOM;      // An error, which the caller must check for.
1547 
1548   offset = tj->offset();
1549   assert( offset != Type::OffsetTop, "Offset has fallen from constant" );
1550 
1551   assert( (offset != Type::OffsetBot && tj->base() != Type::AryPtr) ||
1552           (offset == Type::OffsetBot && tj->base() == Type::AryPtr) ||
1553           (offset == Type::OffsetBot && tj == TypeOopPtr::BOTTOM) ||
1554           (offset == Type::OffsetBot && tj == TypePtr::BOTTOM) ||
1555           (offset == oopDesc::mark_offset_in_bytes() && tj->base() == Type::AryPtr) ||
1556           (offset == Type::klass_offset() && tj->base() == Type::AryPtr) ||
1557           (offset == arrayOopDesc::length_offset_in_bytes() && tj->base() == Type::AryPtr),
1558           "For oops, klasses, raw offset must be constant; for arrays the offset is never known" );
1559   assert( tj->ptr() != TypePtr::TopPTR &&
1560           tj->ptr() != TypePtr::AnyNull &&
1561           tj->ptr() != TypePtr::Null, "No imprecise addresses" );
1562 //    assert( tj->ptr() != TypePtr::Constant ||
1563 //            tj->base() == Type::RawPtr ||
1564 //            tj->base() == Type::KlassPtr, "No constant oop addresses" );
1565 
1566   return tj;
1567 }
1568 
1569 void Compile::AliasType::Init(int i, const TypePtr* at) {
1570   assert(AliasIdxTop <= i && i < Compile::current()->_max_alias_types, "Invalid alias index");
1571   _index = i;
1572   _adr_type = at;
1573   _field = nullptr;
1574   _element = nullptr;
1575   _is_rewritable = true; // default
1576   const TypeOopPtr *atoop = (at != nullptr) ? at->isa_oopptr() : nullptr;
< prev index next >