< prev index next >

src/hotspot/share/opto/compile.cpp

Print this page

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

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

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

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