Mercurial > hg > truffle
comparison src/share/vm/opto/memnode.cpp @ 6804:e626685e9f6c
7193318: C2: remove number of inputs requirement from Node's new operator
Summary: Deleted placement new operator of Node - node(size_t, Compile *, int).
Reviewed-by: kvn, twisti
Contributed-by: bharadwaj.yadavalli@oracle.com
author | kvn |
---|---|
date | Thu, 27 Sep 2012 09:38:42 -0700 |
parents | 7eca5de9e0b6 |
children | d8ce2825b193 8e47bac5643a |
comparison
equal
deleted
inserted
replaced
6803:06f52c4d0e18 | 6804:e626685e9f6c |
---|---|
881 assert( ctl != NULL || C->get_alias_index(adr_type) != Compile::AliasIdxRaw || | 881 assert( ctl != NULL || C->get_alias_index(adr_type) != Compile::AliasIdxRaw || |
882 // oop will be recorded in oop map if load crosses safepoint | 882 // oop will be recorded in oop map if load crosses safepoint |
883 rt->isa_oopptr() || is_immutable_value(adr), | 883 rt->isa_oopptr() || is_immutable_value(adr), |
884 "raw memory operations should have control edge"); | 884 "raw memory operations should have control edge"); |
885 switch (bt) { | 885 switch (bt) { |
886 case T_BOOLEAN: return new (C, 3) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int() ); | 886 case T_BOOLEAN: return new (C) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int() ); |
887 case T_BYTE: return new (C, 3) LoadBNode (ctl, mem, adr, adr_type, rt->is_int() ); | 887 case T_BYTE: return new (C) LoadBNode (ctl, mem, adr, adr_type, rt->is_int() ); |
888 case T_INT: return new (C, 3) LoadINode (ctl, mem, adr, adr_type, rt->is_int() ); | 888 case T_INT: return new (C) LoadINode (ctl, mem, adr, adr_type, rt->is_int() ); |
889 case T_CHAR: return new (C, 3) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int() ); | 889 case T_CHAR: return new (C) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int() ); |
890 case T_SHORT: return new (C, 3) LoadSNode (ctl, mem, adr, adr_type, rt->is_int() ); | 890 case T_SHORT: return new (C) LoadSNode (ctl, mem, adr, adr_type, rt->is_int() ); |
891 case T_LONG: return new (C, 3) LoadLNode (ctl, mem, adr, adr_type, rt->is_long() ); | 891 case T_LONG: return new (C) LoadLNode (ctl, mem, adr, adr_type, rt->is_long() ); |
892 case T_FLOAT: return new (C, 3) LoadFNode (ctl, mem, adr, adr_type, rt ); | 892 case T_FLOAT: return new (C) LoadFNode (ctl, mem, adr, adr_type, rt ); |
893 case T_DOUBLE: return new (C, 3) LoadDNode (ctl, mem, adr, adr_type, rt ); | 893 case T_DOUBLE: return new (C) LoadDNode (ctl, mem, adr, adr_type, rt ); |
894 case T_ADDRESS: return new (C, 3) LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr() ); | 894 case T_ADDRESS: return new (C) LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr() ); |
895 case T_OBJECT: | 895 case T_OBJECT: |
896 #ifdef _LP64 | 896 #ifdef _LP64 |
897 if (adr->bottom_type()->is_ptr_to_narrowoop()) { | 897 if (adr->bottom_type()->is_ptr_to_narrowoop()) { |
898 Node* load = gvn.transform(new (C, 3) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop())); | 898 Node* load = gvn.transform(new (C) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop())); |
899 return new (C, 2) DecodeNNode(load, load->bottom_type()->make_ptr()); | 899 return new (C) DecodeNNode(load, load->bottom_type()->make_ptr()); |
900 } else | 900 } else |
901 #endif | 901 #endif |
902 { | 902 { |
903 assert(!adr->bottom_type()->is_ptr_to_narrowoop(), "should have got back a narrow oop"); | 903 assert(!adr->bottom_type()->is_ptr_to_narrowoop(), "should have got back a narrow oop"); |
904 return new (C, 3) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr()); | 904 return new (C) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr()); |
905 } | 905 } |
906 } | 906 } |
907 ShouldNotReachHere(); | 907 ShouldNotReachHere(); |
908 return (LoadNode*)NULL; | 908 return (LoadNode*)NULL; |
909 } | 909 } |
910 | 910 |
911 LoadLNode* LoadLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt) { | 911 LoadLNode* LoadLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt) { |
912 bool require_atomic = true; | 912 bool require_atomic = true; |
913 return new (C, 3) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), require_atomic); | 913 return new (C) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), require_atomic); |
914 } | 914 } |
915 | 915 |
916 | 916 |
917 | 917 |
918 | 918 |
1242 if (count > 0 && fetch_autobox_base(atp, cache_low)) { | 1242 if (count > 0 && fetch_autobox_base(atp, cache_low)) { |
1243 int offset = arrayOopDesc::base_offset_in_bytes(memory_type()) - (cache_low << shift); | 1243 int offset = arrayOopDesc::base_offset_in_bytes(memory_type()) - (cache_low << shift); |
1244 // Add up all the offsets making of the address of the load | 1244 // Add up all the offsets making of the address of the load |
1245 Node* result = elements[0]; | 1245 Node* result = elements[0]; |
1246 for (int i = 1; i < count; i++) { | 1246 for (int i = 1; i < count; i++) { |
1247 result = phase->transform(new (phase->C, 3) AddXNode(result, elements[i])); | 1247 result = phase->transform(new (phase->C) AddXNode(result, elements[i])); |
1248 } | 1248 } |
1249 // Remove the constant offset from the address and then | 1249 // Remove the constant offset from the address and then |
1250 // remove the scaling of the offset to recover the original index. | 1250 // remove the scaling of the offset to recover the original index. |
1251 result = phase->transform(new (phase->C, 3) AddXNode(result, phase->MakeConX(-offset))); | 1251 result = phase->transform(new (phase->C) AddXNode(result, phase->MakeConX(-offset))); |
1252 if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) { | 1252 if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) { |
1253 // Peel the shift off directly but wrap it in a dummy node | 1253 // Peel the shift off directly but wrap it in a dummy node |
1254 // since Ideal can't return existing nodes | 1254 // since Ideal can't return existing nodes |
1255 result = new (phase->C, 3) RShiftXNode(result->in(1), phase->intcon(0)); | 1255 result = new (phase->C) RShiftXNode(result->in(1), phase->intcon(0)); |
1256 } else { | 1256 } else { |
1257 result = new (phase->C, 3) RShiftXNode(result, phase->intcon(shift)); | 1257 result = new (phase->C) RShiftXNode(result, phase->intcon(shift)); |
1258 } | 1258 } |
1259 #ifdef _LP64 | 1259 #ifdef _LP64 |
1260 result = new (phase->C, 2) ConvL2INode(phase->transform(result)); | 1260 result = new (phase->C) ConvL2INode(phase->transform(result)); |
1261 #endif | 1261 #endif |
1262 return result; | 1262 return result; |
1263 } | 1263 } |
1264 } | 1264 } |
1265 } | 1265 } |
1318 const Type* this_type = this->bottom_type(); | 1318 const Type* this_type = this->bottom_type(); |
1319 int this_index = phase->C->get_alias_index(addr_t); | 1319 int this_index = phase->C->get_alias_index(addr_t); |
1320 int this_offset = addr_t->offset(); | 1320 int this_offset = addr_t->offset(); |
1321 int this_iid = addr_t->is_oopptr()->instance_id(); | 1321 int this_iid = addr_t->is_oopptr()->instance_id(); |
1322 PhaseIterGVN *igvn = phase->is_IterGVN(); | 1322 PhaseIterGVN *igvn = phase->is_IterGVN(); |
1323 Node *phi = new (igvn->C, region->req()) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset); | 1323 Node *phi = new (igvn->C) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset); |
1324 for (uint i = 1; i < region->req(); i++) { | 1324 for (uint i = 1; i < region->req(); i++) { |
1325 Node *x; | 1325 Node *x; |
1326 Node* the_clone = NULL; | 1326 Node* the_clone = NULL; |
1327 if (region->in(i) == phase->C->top()) { | 1327 if (region->in(i) == phase->C->top()) { |
1328 x = phase->C->top(); // Dead path? Use a dead data op | 1328 x = phase->C->top(); // Dead path? Use a dead data op |
1769 // | 1769 // |
1770 Node *LoadBNode::Ideal(PhaseGVN *phase, bool can_reshape) { | 1770 Node *LoadBNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
1771 Node* mem = in(MemNode::Memory); | 1771 Node* mem = in(MemNode::Memory); |
1772 Node* value = can_see_stored_value(mem,phase); | 1772 Node* value = can_see_stored_value(mem,phase); |
1773 if( value && !phase->type(value)->higher_equal( _type ) ) { | 1773 if( value && !phase->type(value)->higher_equal( _type ) ) { |
1774 Node *result = phase->transform( new (phase->C, 3) LShiftINode(value, phase->intcon(24)) ); | 1774 Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(24)) ); |
1775 return new (phase->C, 3) RShiftINode(result, phase->intcon(24)); | 1775 return new (phase->C) RShiftINode(result, phase->intcon(24)); |
1776 } | 1776 } |
1777 // Identity call will handle the case where truncation is not needed. | 1777 // Identity call will handle the case where truncation is not needed. |
1778 return LoadNode::Ideal(phase, can_reshape); | 1778 return LoadNode::Ideal(phase, can_reshape); |
1779 } | 1779 } |
1780 | 1780 |
1801 // | 1801 // |
1802 Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) { | 1802 Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) { |
1803 Node* mem = in(MemNode::Memory); | 1803 Node* mem = in(MemNode::Memory); |
1804 Node* value = can_see_stored_value(mem, phase); | 1804 Node* value = can_see_stored_value(mem, phase); |
1805 if (value && !phase->type(value)->higher_equal(_type)) | 1805 if (value && !phase->type(value)->higher_equal(_type)) |
1806 return new (phase->C, 3) AndINode(value, phase->intcon(0xFF)); | 1806 return new (phase->C) AndINode(value, phase->intcon(0xFF)); |
1807 // Identity call will handle the case where truncation is not needed. | 1807 // Identity call will handle the case where truncation is not needed. |
1808 return LoadNode::Ideal(phase, can_reshape); | 1808 return LoadNode::Ideal(phase, can_reshape); |
1809 } | 1809 } |
1810 | 1810 |
1811 const Type* LoadUBNode::Value(PhaseTransform *phase) const { | 1811 const Type* LoadUBNode::Value(PhaseTransform *phase) const { |
1831 // | 1831 // |
1832 Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) { | 1832 Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
1833 Node* mem = in(MemNode::Memory); | 1833 Node* mem = in(MemNode::Memory); |
1834 Node* value = can_see_stored_value(mem,phase); | 1834 Node* value = can_see_stored_value(mem,phase); |
1835 if( value && !phase->type(value)->higher_equal( _type ) ) | 1835 if( value && !phase->type(value)->higher_equal( _type ) ) |
1836 return new (phase->C, 3) AndINode(value,phase->intcon(0xFFFF)); | 1836 return new (phase->C) AndINode(value,phase->intcon(0xFFFF)); |
1837 // Identity call will handle the case where truncation is not needed. | 1837 // Identity call will handle the case where truncation is not needed. |
1838 return LoadNode::Ideal(phase, can_reshape); | 1838 return LoadNode::Ideal(phase, can_reshape); |
1839 } | 1839 } |
1840 | 1840 |
1841 const Type* LoadUSNode::Value(PhaseTransform *phase) const { | 1841 const Type* LoadUSNode::Value(PhaseTransform *phase) const { |
1861 // | 1861 // |
1862 Node *LoadSNode::Ideal(PhaseGVN *phase, bool can_reshape) { | 1862 Node *LoadSNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
1863 Node* mem = in(MemNode::Memory); | 1863 Node* mem = in(MemNode::Memory); |
1864 Node* value = can_see_stored_value(mem,phase); | 1864 Node* value = can_see_stored_value(mem,phase); |
1865 if( value && !phase->type(value)->higher_equal( _type ) ) { | 1865 if( value && !phase->type(value)->higher_equal( _type ) ) { |
1866 Node *result = phase->transform( new (phase->C, 3) LShiftINode(value, phase->intcon(16)) ); | 1866 Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(16)) ); |
1867 return new (phase->C, 3) RShiftINode(result, phase->intcon(16)); | 1867 return new (phase->C) RShiftINode(result, phase->intcon(16)); |
1868 } | 1868 } |
1869 // Identity call will handle the case where truncation is not needed. | 1869 // Identity call will handle the case where truncation is not needed. |
1870 return LoadNode::Ideal(phase, can_reshape); | 1870 return LoadNode::Ideal(phase, can_reshape); |
1871 } | 1871 } |
1872 | 1872 |
1894 const TypePtr *adr_type = adr->bottom_type()->isa_ptr(); | 1894 const TypePtr *adr_type = adr->bottom_type()->isa_ptr(); |
1895 assert(adr_type != NULL, "expecting TypeKlassPtr"); | 1895 assert(adr_type != NULL, "expecting TypeKlassPtr"); |
1896 #ifdef _LP64 | 1896 #ifdef _LP64 |
1897 if (adr_type->is_ptr_to_narrowoop()) { | 1897 if (adr_type->is_ptr_to_narrowoop()) { |
1898 assert(UseCompressedKlassPointers, "no compressed klasses"); | 1898 assert(UseCompressedKlassPointers, "no compressed klasses"); |
1899 Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop())); | 1899 Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop())); |
1900 return new (C, 2) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr()); | 1900 return new (C) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr()); |
1901 } | 1901 } |
1902 #endif | 1902 #endif |
1903 assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop"); | 1903 assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop"); |
1904 return new (C, 3) LoadKlassNode(ctl, mem, adr, at, tk); | 1904 return new (C) LoadKlassNode(ctl, mem, adr, at, tk); |
1905 } | 1905 } |
1906 | 1906 |
1907 //------------------------------Value------------------------------------------ | 1907 //------------------------------Value------------------------------------------ |
1908 const Type *LoadKlassNode::Value( PhaseTransform *phase ) const { | 1908 const Type *LoadKlassNode::Value( PhaseTransform *phase ) const { |
1909 return klass_value_common(phase); | 1909 return klass_value_common(phase); |
2121 | 2121 |
2122 const Type *t = phase->type( x ); | 2122 const Type *t = phase->type( x ); |
2123 if( t == Type::TOP ) return x; | 2123 if( t == Type::TOP ) return x; |
2124 if( t->isa_narrowoop()) return x; | 2124 if( t->isa_narrowoop()) return x; |
2125 | 2125 |
2126 return phase->transform(new (phase->C, 2) EncodePNode(x, t->make_narrowoop())); | 2126 return phase->transform(new (phase->C) EncodePNode(x, t->make_narrowoop())); |
2127 } | 2127 } |
2128 | 2128 |
2129 //------------------------------Value----------------------------------------- | 2129 //------------------------------Value----------------------------------------- |
2130 const Type *LoadRangeNode::Value( PhaseTransform *phase ) const { | 2130 const Type *LoadRangeNode::Value( PhaseTransform *phase ) const { |
2131 // Either input is TOP ==> the result is TOP | 2131 // Either input is TOP ==> the result is TOP |
2215 assert( C->get_alias_index(adr_type) != Compile::AliasIdxRaw || | 2215 assert( C->get_alias_index(adr_type) != Compile::AliasIdxRaw || |
2216 ctl != NULL, "raw memory operations should have control edge"); | 2216 ctl != NULL, "raw memory operations should have control edge"); |
2217 | 2217 |
2218 switch (bt) { | 2218 switch (bt) { |
2219 case T_BOOLEAN: | 2219 case T_BOOLEAN: |
2220 case T_BYTE: return new (C, 4) StoreBNode(ctl, mem, adr, adr_type, val); | 2220 case T_BYTE: return new (C) StoreBNode(ctl, mem, adr, adr_type, val); |
2221 case T_INT: return new (C, 4) StoreINode(ctl, mem, adr, adr_type, val); | 2221 case T_INT: return new (C) StoreINode(ctl, mem, adr, adr_type, val); |
2222 case T_CHAR: | 2222 case T_CHAR: |
2223 case T_SHORT: return new (C, 4) StoreCNode(ctl, mem, adr, adr_type, val); | 2223 case T_SHORT: return new (C) StoreCNode(ctl, mem, adr, adr_type, val); |
2224 case T_LONG: return new (C, 4) StoreLNode(ctl, mem, adr, adr_type, val); | 2224 case T_LONG: return new (C) StoreLNode(ctl, mem, adr, adr_type, val); |
2225 case T_FLOAT: return new (C, 4) StoreFNode(ctl, mem, adr, adr_type, val); | 2225 case T_FLOAT: return new (C) StoreFNode(ctl, mem, adr, adr_type, val); |
2226 case T_DOUBLE: return new (C, 4) StoreDNode(ctl, mem, adr, adr_type, val); | 2226 case T_DOUBLE: return new (C) StoreDNode(ctl, mem, adr, adr_type, val); |
2227 case T_METADATA: | 2227 case T_METADATA: |
2228 case T_ADDRESS: | 2228 case T_ADDRESS: |
2229 case T_OBJECT: | 2229 case T_OBJECT: |
2230 #ifdef _LP64 | 2230 #ifdef _LP64 |
2231 if (adr->bottom_type()->is_ptr_to_narrowoop() || | 2231 if (adr->bottom_type()->is_ptr_to_narrowoop() || |
2232 (UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() && | 2232 (UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() && |
2233 adr->bottom_type()->isa_rawptr())) { | 2233 adr->bottom_type()->isa_rawptr())) { |
2234 val = gvn.transform(new (C, 2) EncodePNode(val, val->bottom_type()->make_narrowoop())); | 2234 val = gvn.transform(new (C) EncodePNode(val, val->bottom_type()->make_narrowoop())); |
2235 return new (C, 4) StoreNNode(ctl, mem, adr, adr_type, val); | 2235 return new (C) StoreNNode(ctl, mem, adr, adr_type, val); |
2236 } else | 2236 } else |
2237 #endif | 2237 #endif |
2238 { | 2238 { |
2239 return new (C, 4) StorePNode(ctl, mem, adr, adr_type, val); | 2239 return new (C) StorePNode(ctl, mem, adr, adr_type, val); |
2240 } | 2240 } |
2241 } | 2241 } |
2242 ShouldNotReachHere(); | 2242 ShouldNotReachHere(); |
2243 return (StoreNode*)NULL; | 2243 return (StoreNode*)NULL; |
2244 } | 2244 } |
2245 | 2245 |
2246 StoreLNode* StoreLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val) { | 2246 StoreLNode* StoreLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val) { |
2247 bool require_atomic = true; | 2247 bool require_atomic = true; |
2248 return new (C, 4) StoreLNode(ctl, mem, adr, adr_type, val, require_atomic); | 2248 return new (C) StoreLNode(ctl, mem, adr, adr_type, val, require_atomic); |
2249 } | 2249 } |
2250 | 2250 |
2251 | 2251 |
2252 //--------------------------bottom_type---------------------------------------- | 2252 //--------------------------bottom_type---------------------------------------- |
2253 const Type *StoreNode::bottom_type() const { | 2253 const Type *StoreNode::bottom_type() const { |
2636 if( adr->Opcode() != Op_AddP ) Unimplemented(); | 2636 if( adr->Opcode() != Op_AddP ) Unimplemented(); |
2637 Node *base = adr->in(1); | 2637 Node *base = adr->in(1); |
2638 | 2638 |
2639 Node *zero = phase->makecon(TypeLong::ZERO); | 2639 Node *zero = phase->makecon(TypeLong::ZERO); |
2640 Node *off = phase->MakeConX(BytesPerLong); | 2640 Node *off = phase->MakeConX(BytesPerLong); |
2641 mem = new (phase->C, 4) StoreLNode(in(0),mem,adr,atp,zero); | 2641 mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero); |
2642 count--; | 2642 count--; |
2643 while( count-- ) { | 2643 while( count-- ) { |
2644 mem = phase->transform(mem); | 2644 mem = phase->transform(mem); |
2645 adr = phase->transform(new (phase->C, 4) AddPNode(base,adr,off)); | 2645 adr = phase->transform(new (phase->C) AddPNode(base,adr,off)); |
2646 mem = new (phase->C, 4) StoreLNode(in(0),mem,adr,atp,zero); | 2646 mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero); |
2647 } | 2647 } |
2648 return mem; | 2648 return mem; |
2649 } | 2649 } |
2650 | 2650 |
2651 //----------------------------step_through---------------------------------- | 2651 //----------------------------step_through---------------------------------- |
2682 Compile* C = phase->C; | 2682 Compile* C = phase->C; |
2683 intptr_t offset = start_offset; | 2683 intptr_t offset = start_offset; |
2684 | 2684 |
2685 int unit = BytesPerLong; | 2685 int unit = BytesPerLong; |
2686 if ((offset % unit) != 0) { | 2686 if ((offset % unit) != 0) { |
2687 Node* adr = new (C, 4) AddPNode(dest, dest, phase->MakeConX(offset)); | 2687 Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(offset)); |
2688 adr = phase->transform(adr); | 2688 adr = phase->transform(adr); |
2689 const TypePtr* atp = TypeRawPtr::BOTTOM; | 2689 const TypePtr* atp = TypeRawPtr::BOTTOM; |
2690 mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT); | 2690 mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT); |
2691 mem = phase->transform(mem); | 2691 mem = phase->transform(mem); |
2692 offset += BytesPerInt; | 2692 offset += BytesPerInt; |
2712 Node* zend = end_offset; | 2712 Node* zend = end_offset; |
2713 | 2713 |
2714 // Scale to the unit required by the CPU: | 2714 // Scale to the unit required by the CPU: |
2715 if (!Matcher::init_array_count_is_in_bytes) { | 2715 if (!Matcher::init_array_count_is_in_bytes) { |
2716 Node* shift = phase->intcon(exact_log2(unit)); | 2716 Node* shift = phase->intcon(exact_log2(unit)); |
2717 zbase = phase->transform( new(C,3) URShiftXNode(zbase, shift) ); | 2717 zbase = phase->transform( new(C) URShiftXNode(zbase, shift) ); |
2718 zend = phase->transform( new(C,3) URShiftXNode(zend, shift) ); | 2718 zend = phase->transform( new(C) URShiftXNode(zend, shift) ); |
2719 } | 2719 } |
2720 | 2720 |
2721 Node* zsize = phase->transform( new(C,3) SubXNode(zend, zbase) ); | 2721 Node* zsize = phase->transform( new(C) SubXNode(zend, zbase) ); |
2722 Node* zinit = phase->zerocon((unit == BytesPerLong) ? T_LONG : T_INT); | 2722 Node* zinit = phase->zerocon((unit == BytesPerLong) ? T_LONG : T_INT); |
2723 | 2723 |
2724 // Bulk clear double-words | 2724 // Bulk clear double-words |
2725 Node* adr = phase->transform( new(C,4) AddPNode(dest, dest, start_offset) ); | 2725 Node* adr = phase->transform( new(C) AddPNode(dest, dest, start_offset) ); |
2726 mem = new (C, 4) ClearArrayNode(ctl, mem, zsize, adr); | 2726 mem = new (C) ClearArrayNode(ctl, mem, zsize, adr); |
2727 return phase->transform(mem); | 2727 return phase->transform(mem); |
2728 } | 2728 } |
2729 | 2729 |
2730 Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, | 2730 Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, |
2731 intptr_t start_offset, | 2731 intptr_t start_offset, |
2745 if (done_offset > start_offset) { | 2745 if (done_offset > start_offset) { |
2746 mem = clear_memory(ctl, mem, dest, | 2746 mem = clear_memory(ctl, mem, dest, |
2747 start_offset, phase->MakeConX(done_offset), phase); | 2747 start_offset, phase->MakeConX(done_offset), phase); |
2748 } | 2748 } |
2749 if (done_offset < end_offset) { // emit the final 32-bit store | 2749 if (done_offset < end_offset) { // emit the final 32-bit store |
2750 Node* adr = new (C, 4) AddPNode(dest, dest, phase->MakeConX(done_offset)); | 2750 Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(done_offset)); |
2751 adr = phase->transform(adr); | 2751 adr = phase->transform(adr); |
2752 const TypePtr* atp = TypeRawPtr::BOTTOM; | 2752 const TypePtr* atp = TypeRawPtr::BOTTOM; |
2753 mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT); | 2753 mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT); |
2754 mem = phase->transform(mem); | 2754 mem = phase->transform(mem); |
2755 done_offset += BytesPerInt; | 2755 done_offset += BytesPerInt; |
2811 return (&n == this); // Always fail except on self | 2811 return (&n == this); // Always fail except on self |
2812 } | 2812 } |
2813 | 2813 |
2814 //------------------------------make------------------------------------------- | 2814 //------------------------------make------------------------------------------- |
2815 MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) { | 2815 MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) { |
2816 int len = Precedent + (pn == NULL? 0: 1); | |
2817 switch (opcode) { | 2816 switch (opcode) { |
2818 case Op_MemBarAcquire: return new(C, len) MemBarAcquireNode(C, atp, pn); | 2817 case Op_MemBarAcquire: return new(C) MemBarAcquireNode(C, atp, pn); |
2819 case Op_MemBarRelease: return new(C, len) MemBarReleaseNode(C, atp, pn); | 2818 case Op_MemBarRelease: return new(C) MemBarReleaseNode(C, atp, pn); |
2820 case Op_MemBarAcquireLock: return new(C, len) MemBarAcquireLockNode(C, atp, pn); | 2819 case Op_MemBarAcquireLock: return new(C) MemBarAcquireLockNode(C, atp, pn); |
2821 case Op_MemBarReleaseLock: return new(C, len) MemBarReleaseLockNode(C, atp, pn); | 2820 case Op_MemBarReleaseLock: return new(C) MemBarReleaseLockNode(C, atp, pn); |
2822 case Op_MemBarVolatile: return new(C, len) MemBarVolatileNode(C, atp, pn); | 2821 case Op_MemBarVolatile: return new(C) MemBarVolatileNode(C, atp, pn); |
2823 case Op_MemBarCPUOrder: return new(C, len) MemBarCPUOrderNode(C, atp, pn); | 2822 case Op_MemBarCPUOrder: return new(C) MemBarCPUOrderNode(C, atp, pn); |
2824 case Op_Initialize: return new(C, len) InitializeNode(C, atp, pn); | 2823 case Op_Initialize: return new(C) InitializeNode(C, atp, pn); |
2825 case Op_MemBarStoreStore: return new(C, len) MemBarStoreStoreNode(C, atp, pn); | 2824 case Op_MemBarStoreStore: return new(C) MemBarStoreStoreNode(C, atp, pn); |
2826 default: ShouldNotReachHere(); return NULL; | 2825 default: ShouldNotReachHere(); return NULL; |
2827 } | 2826 } |
2828 } | 2827 } |
2829 | 2828 |
2830 //------------------------------Ideal------------------------------------------ | 2829 //------------------------------Ideal------------------------------------------ |
2850 PhaseIterGVN* igvn = phase->is_IterGVN(); | 2849 PhaseIterGVN* igvn = phase->is_IterGVN(); |
2851 igvn->replace_node(proj_out(TypeFunc::Memory), in(TypeFunc::Memory)); | 2850 igvn->replace_node(proj_out(TypeFunc::Memory), in(TypeFunc::Memory)); |
2852 igvn->replace_node(proj_out(TypeFunc::Control), in(TypeFunc::Control)); | 2851 igvn->replace_node(proj_out(TypeFunc::Control), in(TypeFunc::Control)); |
2853 // Must return either the original node (now dead) or a new node | 2852 // Must return either the original node (now dead) or a new node |
2854 // (Do not return a top here, since that would break the uniqueness of top.) | 2853 // (Do not return a top here, since that would break the uniqueness of top.) |
2855 return new (phase->C, 1) ConINode(TypeInt::ZERO); | 2854 return new (phase->C) ConINode(TypeInt::ZERO); |
2856 } | 2855 } |
2857 } | 2856 } |
2858 } | 2857 } |
2859 return NULL; | 2858 return NULL; |
2860 } | 2859 } |
2871 // Construct projections for memory. | 2870 // Construct projections for memory. |
2872 Node *MemBarNode::match( const ProjNode *proj, const Matcher *m ) { | 2871 Node *MemBarNode::match( const ProjNode *proj, const Matcher *m ) { |
2873 switch (proj->_con) { | 2872 switch (proj->_con) { |
2874 case TypeFunc::Control: | 2873 case TypeFunc::Control: |
2875 case TypeFunc::Memory: | 2874 case TypeFunc::Memory: |
2876 return new (m->C, 1) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); | 2875 return new (m->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); |
2877 } | 2876 } |
2878 ShouldNotReachHere(); | 2877 ShouldNotReachHere(); |
2879 return NULL; | 2878 return NULL; |
2880 } | 2879 } |
2881 | 2880 |
3215 Node* InitializeNode::make_raw_address(intptr_t offset, | 3214 Node* InitializeNode::make_raw_address(intptr_t offset, |
3216 PhaseTransform* phase) { | 3215 PhaseTransform* phase) { |
3217 Node* addr = in(RawAddress); | 3216 Node* addr = in(RawAddress); |
3218 if (offset != 0) { | 3217 if (offset != 0) { |
3219 Compile* C = phase->C; | 3218 Compile* C = phase->C; |
3220 addr = phase->transform( new (C, 4) AddPNode(C->top(), addr, | 3219 addr = phase->transform( new (C) AddPNode(C->top(), addr, |
3221 phase->MakeConX(offset)) ); | 3220 phase->MakeConX(offset)) ); |
3222 } | 3221 } |
3223 return addr; | 3222 return addr; |
3224 } | 3223 } |
3225 | 3224 |
3904 } | 3903 } |
3905 | 3904 |
3906 // Make a new, untransformed MergeMem with the same base as 'mem'. | 3905 // Make a new, untransformed MergeMem with the same base as 'mem'. |
3907 // If mem is itself a MergeMem, populate the result with the same edges. | 3906 // If mem is itself a MergeMem, populate the result with the same edges. |
3908 MergeMemNode* MergeMemNode::make(Compile* C, Node* mem) { | 3907 MergeMemNode* MergeMemNode::make(Compile* C, Node* mem) { |
3909 return new(C, 1+Compile::AliasIdxRaw) MergeMemNode(mem); | 3908 return new(C) MergeMemNode(mem); |
3910 } | 3909 } |
3911 | 3910 |
3912 //------------------------------cmp-------------------------------------------- | 3911 //------------------------------cmp-------------------------------------------- |
3913 uint MergeMemNode::hash() const { return NO_HASH; } | 3912 uint MergeMemNode::hash() const { return NO_HASH; } |
3914 uint MergeMemNode::cmp( const Node &n ) const { | 3913 uint MergeMemNode::cmp( const Node &n ) const { |