< prev index next >

src/hotspot/share/opto/compile.cpp

Print this page

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

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

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

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