Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/compile.cpp @ 12190:edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
Reviewed-by: rbackman, twisti, kvn
Contributed-by: john.r.rose@oracle.com, vladimir.x.ivanov@oracle.com
author | vlivanov |
---|---|
date | Tue, 10 Sep 2013 14:51:48 -0700 |
parents | 650868c062a9 |
children | 884ed7a10f09 |
comparison
equal
deleted
inserted
replaced
12188:cd16d587b0fa | 12190:edb5ab0f3fe5 |
---|---|
1295 offset = tj->offset(); | 1295 offset = tj->offset(); |
1296 } | 1296 } |
1297 | 1297 |
1298 // Array pointers need some flattening | 1298 // Array pointers need some flattening |
1299 const TypeAryPtr *ta = tj->isa_aryptr(); | 1299 const TypeAryPtr *ta = tj->isa_aryptr(); |
1300 if (ta && ta->is_stable()) { | |
1301 // Erase stability property for alias analysis. | |
1302 tj = ta = ta->cast_to_stable(false); | |
1303 } | |
1300 if( ta && is_known_inst ) { | 1304 if( ta && is_known_inst ) { |
1301 if ( offset != Type::OffsetBot && | 1305 if ( offset != Type::OffsetBot && |
1302 offset > arrayOopDesc::length_offset_in_bytes() ) { | 1306 offset > arrayOopDesc::length_offset_in_bytes() ) { |
1303 offset = Type::OffsetBot; // Flatten constant access into array body only | 1307 offset = Type::OffsetBot; // Flatten constant access into array body only |
1304 tj = ta = TypeAryPtr::make(ptr, ta->ary(), ta->klass(), true, offset, ta->instance_id()); | 1308 tj = ta = TypeAryPtr::make(ptr, ta->ary(), ta->klass(), true, offset, ta->instance_id()); |
1495 | 1499 |
1496 void Compile::AliasType::Init(int i, const TypePtr* at) { | 1500 void Compile::AliasType::Init(int i, const TypePtr* at) { |
1497 _index = i; | 1501 _index = i; |
1498 _adr_type = at; | 1502 _adr_type = at; |
1499 _field = NULL; | 1503 _field = NULL; |
1504 _element = NULL; | |
1500 _is_rewritable = true; // default | 1505 _is_rewritable = true; // default |
1501 const TypeOopPtr *atoop = (at != NULL) ? at->isa_oopptr() : NULL; | 1506 const TypeOopPtr *atoop = (at != NULL) ? at->isa_oopptr() : NULL; |
1502 if (atoop != NULL && atoop->is_known_instance()) { | 1507 if (atoop != NULL && atoop->is_known_instance()) { |
1503 const TypeOopPtr *gt = atoop->cast_to_instance_id(TypeOopPtr::InstanceBot); | 1508 const TypeOopPtr *gt = atoop->cast_to_instance_id(TypeOopPtr::InstanceBot); |
1504 _general_index = Compile::current()->get_alias_index(gt); | 1509 _general_index = Compile::current()->get_alias_index(gt); |
1613 if (flat->isa_instptr()) { | 1618 if (flat->isa_instptr()) { |
1614 if (flat->offset() == java_lang_Class::klass_offset_in_bytes() | 1619 if (flat->offset() == java_lang_Class::klass_offset_in_bytes() |
1615 && flat->is_instptr()->klass() == env()->Class_klass()) | 1620 && flat->is_instptr()->klass() == env()->Class_klass()) |
1616 alias_type(idx)->set_rewritable(false); | 1621 alias_type(idx)->set_rewritable(false); |
1617 } | 1622 } |
1623 if (flat->isa_aryptr()) { | |
1624 #ifdef ASSERT | |
1625 const int header_size_min = arrayOopDesc::base_offset_in_bytes(T_BYTE); | |
1626 // (T_BYTE has the weakest alignment and size restrictions...) | |
1627 assert(flat->offset() < header_size_min, "array body reference must be OffsetBot"); | |
1628 #endif | |
1629 if (flat->offset() == TypePtr::OffsetBot) { | |
1630 alias_type(idx)->set_element(flat->is_aryptr()->elem()); | |
1631 } | |
1632 } | |
1618 if (flat->isa_klassptr()) { | 1633 if (flat->isa_klassptr()) { |
1619 if (flat->offset() == in_bytes(Klass::super_check_offset_offset())) | 1634 if (flat->offset() == in_bytes(Klass::super_check_offset_offset())) |
1620 alias_type(idx)->set_rewritable(false); | 1635 alias_type(idx)->set_rewritable(false); |
1621 if (flat->offset() == in_bytes(Klass::modifier_flags_offset())) | 1636 if (flat->offset() == in_bytes(Klass::modifier_flags_offset())) |
1622 alias_type(idx)->set_rewritable(false); | 1637 alias_type(idx)->set_rewritable(false); |
1675 if (field->is_static()) | 1690 if (field->is_static()) |
1676 t = TypeInstPtr::make(field->holder()->java_mirror()); | 1691 t = TypeInstPtr::make(field->holder()->java_mirror()); |
1677 else | 1692 else |
1678 t = TypeOopPtr::make_from_klass_raw(field->holder()); | 1693 t = TypeOopPtr::make_from_klass_raw(field->holder()); |
1679 AliasType* atp = alias_type(t->add_offset(field->offset_in_bytes()), field); | 1694 AliasType* atp = alias_type(t->add_offset(field->offset_in_bytes()), field); |
1680 assert(field->is_final() == !atp->is_rewritable(), "must get the rewritable bits correct"); | 1695 assert((field->is_final() || field->is_stable()) == !atp->is_rewritable(), "must get the rewritable bits correct"); |
1681 return atp; | 1696 return atp; |
1682 } | 1697 } |
1683 | 1698 |
1684 | 1699 |
1685 //------------------------------have_alias_type-------------------------------- | 1700 //------------------------------have_alias_type-------------------------------- |