1606 // tj->base() == Type::KlassPtr, "No constant oop addresses" ); 1607 1608 return tj; 1609 } 1610 1611 void Compile::AliasType::Init(int i, const TypePtr* at) { 1612 _index = i; 1613 _adr_type = at; 1614 _field = NULL; 1615 _element = NULL; 1616 _is_rewritable = true; // default 1617 const TypeOopPtr *atoop = (at != NULL) ? at->isa_oopptr() : NULL; 1618 if (atoop != NULL && atoop->is_known_instance()) { 1619 const TypeOopPtr *gt = atoop->cast_to_instance_id(TypeOopPtr::InstanceBot); 1620 _general_index = Compile::current()->get_alias_index(gt); 1621 } else { 1622 _general_index = 0; 1623 } 1624 } 1625 1626 //---------------------------------print_on------------------------------------ 1627 #ifndef PRODUCT 1628 void Compile::AliasType::print_on(outputStream* st) { 1629 if (index() < 10) 1630 st->print("@ <%d> ", index()); 1631 else st->print("@ <%d>", index()); 1632 st->print(is_rewritable() ? " " : " RO"); 1633 int offset = adr_type()->offset(); 1634 if (offset == Type::OffsetBot) 1635 st->print(" +any"); 1636 else st->print(" +%-3d", offset); 1637 st->print(" in "); 1638 adr_type()->dump_on(st); 1639 const TypeOopPtr* tjp = adr_type()->isa_oopptr(); 1640 if (field() != NULL && tjp) { 1641 if (tjp->klass() != field()->holder() || 1642 tjp->offset() != field()->offset_in_bytes()) { 1643 st->print(" != "); 1644 field()->print(); 1645 st->print(" ***"); | 1606 // tj->base() == Type::KlassPtr, "No constant oop addresses" ); 1607 1608 return tj; 1609 } 1610 1611 void Compile::AliasType::Init(int i, const TypePtr* at) { 1612 _index = i; 1613 _adr_type = at; 1614 _field = NULL; 1615 _element = NULL; 1616 _is_rewritable = true; // default 1617 const TypeOopPtr *atoop = (at != NULL) ? at->isa_oopptr() : NULL; 1618 if (atoop != NULL && atoop->is_known_instance()) { 1619 const TypeOopPtr *gt = atoop->cast_to_instance_id(TypeOopPtr::InstanceBot); 1620 _general_index = Compile::current()->get_alias_index(gt); 1621 } else { 1622 _general_index = 0; 1623 } 1624 } 1625 1626 BasicType Compile::AliasType::basic_type() const { 1627 if (element() != NULL) { 1628 // Use address type to get the element type. Alias type doesn't provide 1629 // enough information (e.g., doesn't differentiate between byte[] and boolean[]). 1630 const Type* element = adr_type()->is_aryptr()->elem(); 1631 return element->isa_narrowoop() ? T_OBJECT : element->array_element_basic_type(); 1632 } if (field() != NULL) { 1633 return field()->layout_type(); 1634 } else { 1635 return T_ILLEGAL; // unknown 1636 } 1637 } 1638 1639 //---------------------------------print_on------------------------------------ 1640 #ifndef PRODUCT 1641 void Compile::AliasType::print_on(outputStream* st) { 1642 if (index() < 10) 1643 st->print("@ <%d> ", index()); 1644 else st->print("@ <%d>", index()); 1645 st->print(is_rewritable() ? " " : " RO"); 1646 int offset = adr_type()->offset(); 1647 if (offset == Type::OffsetBot) 1648 st->print(" +any"); 1649 else st->print(" +%-3d", offset); 1650 st->print(" in "); 1651 adr_type()->dump_on(st); 1652 const TypeOopPtr* tjp = adr_type()->isa_oopptr(); 1653 if (field() != NULL && tjp) { 1654 if (tjp->klass() != field()->holder() || 1655 tjp->offset() != field()->offset_in_bytes()) { 1656 st->print(" != "); 1657 field()->print(); 1658 st->print(" ***"); |