1740 if (flat->offset() == TypePtr::OffsetBot) { 1741 alias_type(idx)->set_element(flat->is_aryptr()->elem()); 1742 } 1743 } 1744 if (flat->isa_klassptr()) { 1745 if (flat->offset() == in_bytes(Klass::super_check_offset_offset())) 1746 alias_type(idx)->set_rewritable(false); 1747 if (flat->offset() == in_bytes(Klass::modifier_flags_offset())) 1748 alias_type(idx)->set_rewritable(false); 1749 if (flat->offset() == in_bytes(Klass::access_flags_offset())) 1750 alias_type(idx)->set_rewritable(false); 1751 if (flat->offset() == in_bytes(Klass::java_mirror_offset())) 1752 alias_type(idx)->set_rewritable(false); 1753 } 1754 // %%% (We would like to finalize JavaThread::threadObj_offset(), 1755 // but the base pointer type is not distinctive enough to identify 1756 // references into JavaThread.) 1757 1758 // Check for final fields. 1759 const TypeInstPtr* tinst = flat->isa_instptr(); 1760 if (tinst && tinst->offset() >= instanceOopDesc::base_offset_in_bytes()) { 1761 ciField* field; 1762 if (tinst->const_oop() != NULL && 1763 tinst->klass() == ciEnv::current()->Class_klass() && 1764 tinst->offset() >= (tinst->klass()->as_instance_klass()->size_helper() * wordSize)) { 1765 // static field 1766 ciInstanceKlass* k = tinst->const_oop()->as_instance()->java_lang_Class_klass()->as_instance_klass(); 1767 field = k->get_field_by_offset(tinst->offset(), true); 1768 } else { 1769 ciInstanceKlass *k = tinst->klass()->as_instance_klass(); 1770 field = k->get_field_by_offset(tinst->offset(), false); 1771 } 1772 assert(field == NULL || 1773 original_field == NULL || 1774 (field->holder() == original_field->holder() && 1775 field->offset() == original_field->offset() && 1776 field->is_static() == original_field->is_static()), "wrong field?"); 1777 // Set field() and is_rewritable() attributes. 1778 if (field != NULL) alias_type(idx)->set_field(field); 1779 } 1780 } 1781 1782 // Fill the cache for next time. 1783 ace->_adr_type = adr_type; 1784 ace->_index = idx; 1785 assert(alias_type(adr_type) == alias_type(idx), "type must be installed"); 1786 1787 // Might as well try to fill the cache for the flattened version, too. 1788 AliasCacheEntry* face = probe_alias_cache(flat); 1789 if (face->_adr_type == NULL) { 1790 face->_adr_type = flat; 1791 face->_index = idx; 1792 assert(alias_type(flat) == alias_type(idx), "flat type must work too"); 1793 } 1794 1795 return alias_type(idx); 1796 } 1797 1798 1799 Compile::AliasType* Compile::alias_type(ciField* field) { | 1740 if (flat->offset() == TypePtr::OffsetBot) { 1741 alias_type(idx)->set_element(flat->is_aryptr()->elem()); 1742 } 1743 } 1744 if (flat->isa_klassptr()) { 1745 if (flat->offset() == in_bytes(Klass::super_check_offset_offset())) 1746 alias_type(idx)->set_rewritable(false); 1747 if (flat->offset() == in_bytes(Klass::modifier_flags_offset())) 1748 alias_type(idx)->set_rewritable(false); 1749 if (flat->offset() == in_bytes(Klass::access_flags_offset())) 1750 alias_type(idx)->set_rewritable(false); 1751 if (flat->offset() == in_bytes(Klass::java_mirror_offset())) 1752 alias_type(idx)->set_rewritable(false); 1753 } 1754 // %%% (We would like to finalize JavaThread::threadObj_offset(), 1755 // but the base pointer type is not distinctive enough to identify 1756 // references into JavaThread.) 1757 1758 // Check for final fields. 1759 const TypeInstPtr* tinst = flat->isa_instptr(); 1760 const TypeValueTypePtr* vtptr = flat->isa_valuetypeptr(); 1761 ciField* field = NULL; 1762 if (tinst && tinst->offset() >= instanceOopDesc::base_offset_in_bytes()) { 1763 if (tinst->const_oop() != NULL && 1764 tinst->klass() == ciEnv::current()->Class_klass() && 1765 tinst->offset() >= (tinst->klass()->as_instance_klass()->size_helper() * wordSize)) { 1766 // static field 1767 ciInstanceKlass* k = tinst->const_oop()->as_instance()->java_lang_Class_klass()->as_instance_klass(); 1768 field = k->get_field_by_offset(tinst->offset(), true); 1769 } else { 1770 ciInstanceKlass *k = tinst->klass()->as_instance_klass(); 1771 field = k->get_field_by_offset(tinst->offset(), false); 1772 } 1773 } else if (vtptr) { 1774 // Value type field 1775 ciValueKlass* vk = vtptr->klass()->as_value_klass(); 1776 field = vk->get_field_by_offset(vtptr->offset(), false); 1777 } 1778 assert(field == NULL || 1779 original_field == NULL || 1780 (field->holder() == original_field->holder() && 1781 field->offset() == original_field->offset() && 1782 field->is_static() == original_field->is_static()), "wrong field?"); 1783 // Set field() and is_rewritable() attributes. 1784 if (field != NULL) alias_type(idx)->set_field(field); 1785 } 1786 1787 // Fill the cache for next time. 1788 ace->_adr_type = adr_type; 1789 ace->_index = idx; 1790 assert(alias_type(adr_type) == alias_type(idx), "type must be installed"); 1791 1792 // Might as well try to fill the cache for the flattened version, too. 1793 AliasCacheEntry* face = probe_alias_cache(flat); 1794 if (face->_adr_type == NULL) { 1795 face->_adr_type = flat; 1796 face->_index = idx; 1797 assert(alias_type(flat) == alias_type(idx), "flat type must work too"); 1798 } 1799 1800 return alias_type(idx); 1801 } 1802 1803 1804 Compile::AliasType* Compile::alias_type(ciField* field) { |