Mercurial > hg > truffle
comparison src/share/vm/opto/memnode.cpp @ 1609:4311f23817fd
6959430: Make sure raw loads have control edge
Summary: check that raw loads have control edge
Reviewed-by: never, twisti
author | kvn |
---|---|
date | Tue, 15 Jun 2010 18:07:27 -0700 |
parents | c18cbe5936b8 |
children | 02f0a9b6f654 |
comparison
equal
deleted
inserted
replaced
1608:2389669474a6 | 1609:4311f23817fd |
---|---|
813 st->print(" #"); _type->dump_on(st); | 813 st->print(" #"); _type->dump_on(st); |
814 } | 814 } |
815 } | 815 } |
816 #endif | 816 #endif |
817 | 817 |
818 #ifdef ASSERT | |
819 //----------------------------is_immutable_value------------------------------- | |
820 // Helper function to allow a raw load without control edge for some cases | |
821 bool LoadNode::is_immutable_value(Node* adr) { | |
822 return (adr->is_AddP() && adr->in(AddPNode::Base)->is_top() && | |
823 adr->in(AddPNode::Address)->Opcode() == Op_ThreadLocal && | |
824 (adr->in(AddPNode::Offset)->find_intptr_t_con(-1) == | |
825 in_bytes(JavaThread::osthread_offset()))); | |
826 } | |
827 #endif | |
818 | 828 |
819 //----------------------------LoadNode::make----------------------------------- | 829 //----------------------------LoadNode::make----------------------------------- |
820 // Polymorphic factory method: | 830 // Polymorphic factory method: |
821 Node *LoadNode::make( PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const TypePtr* adr_type, const Type *rt, BasicType bt ) { | 831 Node *LoadNode::make( PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const TypePtr* adr_type, const Type *rt, BasicType bt ) { |
822 Compile* C = gvn.C; | 832 Compile* C = gvn.C; |
826 adr_type->offset() == oopDesc::klass_offset_in_bytes()), | 836 adr_type->offset() == oopDesc::klass_offset_in_bytes()), |
827 "use LoadKlassNode instead"); | 837 "use LoadKlassNode instead"); |
828 assert(!(adr_type->isa_aryptr() && | 838 assert(!(adr_type->isa_aryptr() && |
829 adr_type->offset() == arrayOopDesc::length_offset_in_bytes()), | 839 adr_type->offset() == arrayOopDesc::length_offset_in_bytes()), |
830 "use LoadRangeNode instead"); | 840 "use LoadRangeNode instead"); |
841 // Check control edge of raw loads | |
842 assert( ctl != NULL || C->get_alias_index(adr_type) != Compile::AliasIdxRaw || | |
843 // oop will be recorded in oop map if load crosses safepoint | |
844 rt->isa_oopptr() || is_immutable_value(adr), | |
845 "raw memory operations should have control edge"); | |
831 switch (bt) { | 846 switch (bt) { |
832 case T_BOOLEAN: return new (C, 3) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int() ); | 847 case T_BOOLEAN: return new (C, 3) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int() ); |
833 case T_BYTE: return new (C, 3) LoadBNode (ctl, mem, adr, adr_type, rt->is_int() ); | 848 case T_BYTE: return new (C, 3) LoadBNode (ctl, mem, adr, adr_type, rt->is_int() ); |
834 case T_INT: return new (C, 3) LoadINode (ctl, mem, adr, adr_type, rt->is_int() ); | 849 case T_INT: return new (C, 3) LoadINode (ctl, mem, adr, adr_type, rt->is_int() ); |
835 case T_CHAR: return new (C, 3) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int() ); | 850 case T_CHAR: return new (C, 3) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int() ); |
2062 //============================================================================= | 2077 //============================================================================= |
2063 //---------------------------StoreNode::make----------------------------------- | 2078 //---------------------------StoreNode::make----------------------------------- |
2064 // Polymorphic factory method: | 2079 // Polymorphic factory method: |
2065 StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, BasicType bt ) { | 2080 StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, BasicType bt ) { |
2066 Compile* C = gvn.C; | 2081 Compile* C = gvn.C; |
2082 assert( C->get_alias_index(adr_type) != Compile::AliasIdxRaw || | |
2083 ctl != NULL, "raw memory operations should have control edge"); | |
2067 | 2084 |
2068 switch (bt) { | 2085 switch (bt) { |
2069 case T_BOOLEAN: | 2086 case T_BOOLEAN: |
2070 case T_BYTE: return new (C, 4) StoreBNode(ctl, mem, adr, adr_type, val); | 2087 case T_BYTE: return new (C, 4) StoreBNode(ctl, mem, adr, adr_type, val); |
2071 case T_INT: return new (C, 4) StoreINode(ctl, mem, adr, adr_type, val); | 2088 case T_INT: return new (C, 4) StoreINode(ctl, mem, adr, adr_type, val); |