< prev index next >

src/hotspot/share/opto/compile.cpp

Print this page

1338       tj = ta = ta->
1339               remove_speculative()->
1340               cast_to_ptr_type(ptr)->
1341               with_offset(offset);
1342     }
1343   } else if (ta) {
1344     // For arrays indexed by constant indices, we flatten the alias
1345     // space to include all of the array body.  Only the header, klass
1346     // and array length can be accessed un-aliased.
1347     if( offset != Type::OffsetBot ) {
1348       if( ta->const_oop() ) { // MethodData* or Method*
1349         offset = Type::OffsetBot;   // Flatten constant access into array body
1350         tj = ta = ta->
1351                 remove_speculative()->
1352                 cast_to_ptr_type(ptr)->
1353                 cast_to_exactness(false)->
1354                 with_offset(offset);
1355       } else if( offset == arrayOopDesc::length_offset_in_bytes() ) {
1356         // range is OK as-is.
1357         tj = ta = TypeAryPtr::RANGE;
1358       } else if( offset == oopDesc::klass_offset_in_bytes() ) {
1359         tj = TypeInstPtr::KLASS; // all klass loads look alike
1360         ta = TypeAryPtr::RANGE; // generic ignored junk
1361         ptr = TypePtr::BotPTR;
1362       } else if( offset == oopDesc::mark_offset_in_bytes() ) {
1363         tj = TypeInstPtr::MARK;
1364         ta = TypeAryPtr::RANGE; // generic ignored junk
1365         ptr = TypePtr::BotPTR;
1366       } else {                  // Random constant offset into array body
1367         offset = Type::OffsetBot;   // Flatten constant access into array body
1368         tj = ta = ta->
1369                 remove_speculative()->
1370                 cast_to_ptr_type(ptr)->
1371                 cast_to_exactness(false)->
1372                 with_offset(offset);
1373       }
1374     }
1375     // Arrays of fixed size alias with arrays of unknown size.
1376     if (ta->size() != TypeInt::POS) {
1377       const TypeAry *tary = TypeAry::make(ta->elem(), TypeInt::POS);
1378       tj = ta = ta->

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

1338       tj = ta = ta->
1339               remove_speculative()->
1340               cast_to_ptr_type(ptr)->
1341               with_offset(offset);
1342     }
1343   } else if (ta) {
1344     // For arrays indexed by constant indices, we flatten the alias
1345     // space to include all of the array body.  Only the header, klass
1346     // and array length can be accessed un-aliased.
1347     if( offset != Type::OffsetBot ) {
1348       if( ta->const_oop() ) { // MethodData* or Method*
1349         offset = Type::OffsetBot;   // Flatten constant access into array body
1350         tj = ta = ta->
1351                 remove_speculative()->
1352                 cast_to_ptr_type(ptr)->
1353                 cast_to_exactness(false)->
1354                 with_offset(offset);
1355       } else if( offset == arrayOopDesc::length_offset_in_bytes() ) {
1356         // range is OK as-is.
1357         tj = ta = TypeAryPtr::RANGE;
1358       } else if( offset == Type::klass_offset() ) {
1359         tj = TypeInstPtr::KLASS; // all klass loads look alike
1360         ta = TypeAryPtr::RANGE; // generic ignored junk
1361         ptr = TypePtr::BotPTR;
1362       } else if( offset == oopDesc::mark_offset_in_bytes() ) {
1363         tj = TypeInstPtr::MARK;
1364         ta = TypeAryPtr::RANGE; // generic ignored junk
1365         ptr = TypePtr::BotPTR;
1366       } else {                  // Random constant offset into array body
1367         offset = Type::OffsetBot;   // Flatten constant access into array body
1368         tj = ta = ta->
1369                 remove_speculative()->
1370                 cast_to_ptr_type(ptr)->
1371                 cast_to_exactness(false)->
1372                 with_offset(offset);
1373       }
1374     }
1375     // Arrays of fixed size alias with arrays of unknown size.
1376     if (ta->size() != TypeInt::POS) {
1377       const TypeAry *tary = TypeAry::make(ta->elem(), TypeInt::POS);
1378       tj = ta = ta->

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