7193318: C2: remove number of inputs requirement from Node's new operator

Deleted placement new operator of Node - node(size_t, Compile *, int).

Reviewed-by: kvn, twisti
This commit is contained in:
Bharadwaj Yadavalli 2012-09-27 09:38:42 -07:00 committed by Vladimir Kozlov
parent 973fdc81a1
commit d5d2e78faa
44 changed files with 1456 additions and 1473 deletions

View file

@ -883,25 +883,25 @@ Node *LoadNode::make( PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const Type
rt->isa_oopptr() || is_immutable_value(adr),
"raw memory operations should have control edge");
switch (bt) {
case T_BOOLEAN: return new (C, 3) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int() );
case T_BYTE: return new (C, 3) LoadBNode (ctl, mem, adr, adr_type, rt->is_int() );
case T_INT: return new (C, 3) LoadINode (ctl, mem, adr, adr_type, rt->is_int() );
case T_CHAR: return new (C, 3) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int() );
case T_SHORT: return new (C, 3) LoadSNode (ctl, mem, adr, adr_type, rt->is_int() );
case T_LONG: return new (C, 3) LoadLNode (ctl, mem, adr, adr_type, rt->is_long() );
case T_FLOAT: return new (C, 3) LoadFNode (ctl, mem, adr, adr_type, rt );
case T_DOUBLE: return new (C, 3) LoadDNode (ctl, mem, adr, adr_type, rt );
case T_ADDRESS: return new (C, 3) LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr() );
case T_BOOLEAN: return new (C) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int() );
case T_BYTE: return new (C) LoadBNode (ctl, mem, adr, adr_type, rt->is_int() );
case T_INT: return new (C) LoadINode (ctl, mem, adr, adr_type, rt->is_int() );
case T_CHAR: return new (C) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int() );
case T_SHORT: return new (C) LoadSNode (ctl, mem, adr, adr_type, rt->is_int() );
case T_LONG: return new (C) LoadLNode (ctl, mem, adr, adr_type, rt->is_long() );
case T_FLOAT: return new (C) LoadFNode (ctl, mem, adr, adr_type, rt );
case T_DOUBLE: return new (C) LoadDNode (ctl, mem, adr, adr_type, rt );
case T_ADDRESS: return new (C) LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr() );
case T_OBJECT:
#ifdef _LP64
if (adr->bottom_type()->is_ptr_to_narrowoop()) {
Node* load = gvn.transform(new (C, 3) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop()));
return new (C, 2) DecodeNNode(load, load->bottom_type()->make_ptr());
Node* load = gvn.transform(new (C) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop()));
return new (C) DecodeNNode(load, load->bottom_type()->make_ptr());
} else
#endif
{
assert(!adr->bottom_type()->is_ptr_to_narrowoop(), "should have got back a narrow oop");
return new (C, 3) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr());
return new (C) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr());
}
}
ShouldNotReachHere();
@ -910,7 +910,7 @@ Node *LoadNode::make( PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const Type
LoadLNode* LoadLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt) {
bool require_atomic = true;
return new (C, 3) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), require_atomic);
return new (C) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), require_atomic);
}
@ -1244,20 +1244,20 @@ Node* LoadNode::eliminate_autobox(PhaseGVN* phase) {
// Add up all the offsets making of the address of the load
Node* result = elements[0];
for (int i = 1; i < count; i++) {
result = phase->transform(new (phase->C, 3) AddXNode(result, elements[i]));
result = phase->transform(new (phase->C) AddXNode(result, elements[i]));
}
// Remove the constant offset from the address and then
// remove the scaling of the offset to recover the original index.
result = phase->transform(new (phase->C, 3) AddXNode(result, phase->MakeConX(-offset)));
result = phase->transform(new (phase->C) AddXNode(result, phase->MakeConX(-offset)));
if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) {
// Peel the shift off directly but wrap it in a dummy node
// since Ideal can't return existing nodes
result = new (phase->C, 3) RShiftXNode(result->in(1), phase->intcon(0));
result = new (phase->C) RShiftXNode(result->in(1), phase->intcon(0));
} else {
result = new (phase->C, 3) RShiftXNode(result, phase->intcon(shift));
result = new (phase->C) RShiftXNode(result, phase->intcon(shift));
}
#ifdef _LP64
result = new (phase->C, 2) ConvL2INode(phase->transform(result));
result = new (phase->C) ConvL2INode(phase->transform(result));
#endif
return result;
}
@ -1320,7 +1320,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
int this_offset = addr_t->offset();
int this_iid = addr_t->is_oopptr()->instance_id();
PhaseIterGVN *igvn = phase->is_IterGVN();
Node *phi = new (igvn->C, region->req()) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset);
Node *phi = new (igvn->C) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset);
for (uint i = 1; i < region->req(); i++) {
Node *x;
Node* the_clone = NULL;
@ -1771,8 +1771,8 @@ Node *LoadBNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if( value && !phase->type(value)->higher_equal( _type ) ) {
Node *result = phase->transform( new (phase->C, 3) LShiftINode(value, phase->intcon(24)) );
return new (phase->C, 3) RShiftINode(result, phase->intcon(24));
Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(24)) );
return new (phase->C) RShiftINode(result, phase->intcon(24));
}
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
@ -1803,7 +1803,7 @@ Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem, phase);
if (value && !phase->type(value)->higher_equal(_type))
return new (phase->C, 3) AndINode(value, phase->intcon(0xFF));
return new (phase->C) AndINode(value, phase->intcon(0xFF));
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
@ -1833,7 +1833,7 @@ Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if( value && !phase->type(value)->higher_equal( _type ) )
return new (phase->C, 3) AndINode(value,phase->intcon(0xFFFF));
return new (phase->C) AndINode(value,phase->intcon(0xFFFF));
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
@ -1863,8 +1863,8 @@ Node *LoadSNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if( value && !phase->type(value)->higher_equal( _type ) ) {
Node *result = phase->transform( new (phase->C, 3) LShiftINode(value, phase->intcon(16)) );
return new (phase->C, 3) RShiftINode(result, phase->intcon(16));
Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(16)) );
return new (phase->C) RShiftINode(result, phase->intcon(16));
}
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
@ -1896,12 +1896,12 @@ Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* a
#ifdef _LP64
if (adr_type->is_ptr_to_narrowoop()) {
assert(UseCompressedKlassPointers, "no compressed klasses");
Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop()));
return new (C, 2) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr());
Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop()));
return new (C) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr());
}
#endif
assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
return new (C, 3) LoadKlassNode(ctl, mem, adr, at, tk);
return new (C) LoadKlassNode(ctl, mem, adr, at, tk);
}
//------------------------------Value------------------------------------------
@ -2123,7 +2123,7 @@ Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
if( t == Type::TOP ) return x;
if( t->isa_narrowoop()) return x;
return phase->transform(new (phase->C, 2) EncodePNode(x, t->make_narrowoop()));
return phase->transform(new (phase->C) EncodePNode(x, t->make_narrowoop()));
}
//------------------------------Value-----------------------------------------
@ -2217,13 +2217,13 @@ StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, cons
switch (bt) {
case T_BOOLEAN:
case T_BYTE: return new (C, 4) StoreBNode(ctl, mem, adr, adr_type, val);
case T_INT: return new (C, 4) StoreINode(ctl, mem, adr, adr_type, val);
case T_BYTE: return new (C) StoreBNode(ctl, mem, adr, adr_type, val);
case T_INT: return new (C) StoreINode(ctl, mem, adr, adr_type, val);
case T_CHAR:
case T_SHORT: return new (C, 4) StoreCNode(ctl, mem, adr, adr_type, val);
case T_LONG: return new (C, 4) StoreLNode(ctl, mem, adr, adr_type, val);
case T_FLOAT: return new (C, 4) StoreFNode(ctl, mem, adr, adr_type, val);
case T_DOUBLE: return new (C, 4) StoreDNode(ctl, mem, adr, adr_type, val);
case T_SHORT: return new (C) StoreCNode(ctl, mem, adr, adr_type, val);
case T_LONG: return new (C) StoreLNode(ctl, mem, adr, adr_type, val);
case T_FLOAT: return new (C) StoreFNode(ctl, mem, adr, adr_type, val);
case T_DOUBLE: return new (C) StoreDNode(ctl, mem, adr, adr_type, val);
case T_METADATA:
case T_ADDRESS:
case T_OBJECT:
@ -2231,12 +2231,12 @@ StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, cons
if (adr->bottom_type()->is_ptr_to_narrowoop() ||
(UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() &&
adr->bottom_type()->isa_rawptr())) {
val = gvn.transform(new (C, 2) EncodePNode(val, val->bottom_type()->make_narrowoop()));
return new (C, 4) StoreNNode(ctl, mem, adr, adr_type, val);
val = gvn.transform(new (C) EncodePNode(val, val->bottom_type()->make_narrowoop()));
return new (C) StoreNNode(ctl, mem, adr, adr_type, val);
} else
#endif
{
return new (C, 4) StorePNode(ctl, mem, adr, adr_type, val);
return new (C) StorePNode(ctl, mem, adr, adr_type, val);
}
}
ShouldNotReachHere();
@ -2245,7 +2245,7 @@ StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, cons
StoreLNode* StoreLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val) {
bool require_atomic = true;
return new (C, 4) StoreLNode(ctl, mem, adr, adr_type, val, require_atomic);
return new (C) StoreLNode(ctl, mem, adr, adr_type, val, require_atomic);
}
@ -2638,12 +2638,12 @@ Node *ClearArrayNode::Ideal(PhaseGVN *phase, bool can_reshape){
Node *zero = phase->makecon(TypeLong::ZERO);
Node *off = phase->MakeConX(BytesPerLong);
mem = new (phase->C, 4) StoreLNode(in(0),mem,adr,atp,zero);
mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero);
count--;
while( count-- ) {
mem = phase->transform(mem);
adr = phase->transform(new (phase->C, 4) AddPNode(base,adr,off));
mem = new (phase->C, 4) StoreLNode(in(0),mem,adr,atp,zero);
adr = phase->transform(new (phase->C) AddPNode(base,adr,off));
mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero);
}
return mem;
}
@ -2684,7 +2684,7 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest,
int unit = BytesPerLong;
if ((offset % unit) != 0) {
Node* adr = new (C, 4) AddPNode(dest, dest, phase->MakeConX(offset));
Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(offset));
adr = phase->transform(adr);
const TypePtr* atp = TypeRawPtr::BOTTOM;
mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT);
@ -2714,16 +2714,16 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest,
// Scale to the unit required by the CPU:
if (!Matcher::init_array_count_is_in_bytes) {
Node* shift = phase->intcon(exact_log2(unit));
zbase = phase->transform( new(C,3) URShiftXNode(zbase, shift) );
zend = phase->transform( new(C,3) URShiftXNode(zend, shift) );
zbase = phase->transform( new(C) URShiftXNode(zbase, shift) );
zend = phase->transform( new(C) URShiftXNode(zend, shift) );
}
Node* zsize = phase->transform( new(C,3) SubXNode(zend, zbase) );
Node* zsize = phase->transform( new(C) SubXNode(zend, zbase) );
Node* zinit = phase->zerocon((unit == BytesPerLong) ? T_LONG : T_INT);
// Bulk clear double-words
Node* adr = phase->transform( new(C,4) AddPNode(dest, dest, start_offset) );
mem = new (C, 4) ClearArrayNode(ctl, mem, zsize, adr);
Node* adr = phase->transform( new(C) AddPNode(dest, dest, start_offset) );
mem = new (C) ClearArrayNode(ctl, mem, zsize, adr);
return phase->transform(mem);
}
@ -2747,7 +2747,7 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest,
start_offset, phase->MakeConX(done_offset), phase);
}
if (done_offset < end_offset) { // emit the final 32-bit store
Node* adr = new (C, 4) AddPNode(dest, dest, phase->MakeConX(done_offset));
Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(done_offset));
adr = phase->transform(adr);
const TypePtr* atp = TypeRawPtr::BOTTOM;
mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT);
@ -2813,16 +2813,15 @@ uint MemBarNode::cmp( const Node &n ) const {
//------------------------------make-------------------------------------------
MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) {
int len = Precedent + (pn == NULL? 0: 1);
switch (opcode) {
case Op_MemBarAcquire: return new(C, len) MemBarAcquireNode(C, atp, pn);
case Op_MemBarRelease: return new(C, len) MemBarReleaseNode(C, atp, pn);
case Op_MemBarAcquireLock: return new(C, len) MemBarAcquireLockNode(C, atp, pn);
case Op_MemBarReleaseLock: return new(C, len) MemBarReleaseLockNode(C, atp, pn);
case Op_MemBarVolatile: return new(C, len) MemBarVolatileNode(C, atp, pn);
case Op_MemBarCPUOrder: return new(C, len) MemBarCPUOrderNode(C, atp, pn);
case Op_Initialize: return new(C, len) InitializeNode(C, atp, pn);
case Op_MemBarStoreStore: return new(C, len) MemBarStoreStoreNode(C, atp, pn);
case Op_MemBarAcquire: return new(C) MemBarAcquireNode(C, atp, pn);
case Op_MemBarRelease: return new(C) MemBarReleaseNode(C, atp, pn);
case Op_MemBarAcquireLock: return new(C) MemBarAcquireLockNode(C, atp, pn);
case Op_MemBarReleaseLock: return new(C) MemBarReleaseLockNode(C, atp, pn);
case Op_MemBarVolatile: return new(C) MemBarVolatileNode(C, atp, pn);
case Op_MemBarCPUOrder: return new(C) MemBarCPUOrderNode(C, atp, pn);
case Op_Initialize: return new(C) InitializeNode(C, atp, pn);
case Op_MemBarStoreStore: return new(C) MemBarStoreStoreNode(C, atp, pn);
default: ShouldNotReachHere(); return NULL;
}
}
@ -2852,7 +2851,7 @@ Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) {
igvn->replace_node(proj_out(TypeFunc::Control), in(TypeFunc::Control));
// Must return either the original node (now dead) or a new node
// (Do not return a top here, since that would break the uniqueness of top.)
return new (phase->C, 1) ConINode(TypeInt::ZERO);
return new (phase->C) ConINode(TypeInt::ZERO);
}
}
}
@ -2873,7 +2872,7 @@ Node *MemBarNode::match( const ProjNode *proj, const Matcher *m ) {
switch (proj->_con) {
case TypeFunc::Control:
case TypeFunc::Memory:
return new (m->C, 1) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
return new (m->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
}
ShouldNotReachHere();
return NULL;
@ -3217,7 +3216,7 @@ Node* InitializeNode::make_raw_address(intptr_t offset,
Node* addr = in(RawAddress);
if (offset != 0) {
Compile* C = phase->C;
addr = phase->transform( new (C, 4) AddPNode(C->top(), addr,
addr = phase->transform( new (C) AddPNode(C->top(), addr,
phase->MakeConX(offset)) );
}
return addr;
@ -3906,7 +3905,7 @@ MergeMemNode::MergeMemNode(Node *new_base) : Node(1+Compile::AliasIdxRaw) {
// Make a new, untransformed MergeMem with the same base as 'mem'.
// If mem is itself a MergeMem, populate the result with the same edges.
MergeMemNode* MergeMemNode::make(Compile* C, Node* mem) {
return new(C, 1+Compile::AliasIdxRaw) MergeMemNode(mem);
return new(C) MergeMemNode(mem);
}
//------------------------------cmp--------------------------------------------