< prev index next >
src/share/vm/opto/memnode.cpp
Print this page
*** 1067,1077 ****
return false;
}
//------------------------------Identity---------------------------------------
// Loads are identity if previous store is to same address
! Node *LoadNode::Identity( PhaseTransform *phase ) {
// If the previous store-maker is the right kind of Store, and the store is
// to the same address, then we are equal to the value stored.
Node* mem = in(Memory);
Node* value = can_see_stored_value(mem, phase);
if( value ) {
--- 1067,1077 ----
return false;
}
//------------------------------Identity---------------------------------------
// Loads are identity if previous store is to same address
! Node* LoadNode::Identity(PhaseGVN* phase) {
// If the previous store-maker is the right kind of Store, and the store is
// to the same address, then we are equal to the value stored.
Node* mem = in(Memory);
Node* value = can_see_stored_value(mem, phase);
if( value ) {
*** 1613,1623 ****
}
return NULL;
}
//------------------------------Value-----------------------------------------
! const Type *LoadNode::Value( PhaseTransform *phase ) const {
// Either input is TOP ==> the result is TOP
Node* mem = in(MemNode::Memory);
const Type *t1 = phase->type(mem);
if (t1 == Type::TOP) return Type::TOP;
Node* adr = in(MemNode::Address);
--- 1613,1623 ----
}
return NULL;
}
//------------------------------Value-----------------------------------------
! const Type* LoadNode::Value(PhaseGVN* phase) const {
// Either input is TOP ==> the result is TOP
Node* mem = in(MemNode::Memory);
const Type *t1 = phase->type(mem);
if (t1 == Type::TOP) return Type::TOP;
Node* adr = in(MemNode::Address);
*** 1899,1909 ****
}
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
! const Type* LoadBNode::Value(PhaseTransform *phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con() &&
!value->bottom_type()->higher_equal(_type)) {
// If the input to the store does not fit with the load's result type,
--- 1899,1909 ----
}
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
! const Type* LoadBNode::Value(PhaseGVN* phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con() &&
!value->bottom_type()->higher_equal(_type)) {
// If the input to the store does not fit with the load's result type,
*** 1929,1939 ****
return new AndINode(value, phase->intcon(0xFF));
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
! const Type* LoadUBNode::Value(PhaseTransform *phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con() &&
!value->bottom_type()->higher_equal(_type)) {
// If the input to the store does not fit with the load's result type,
--- 1929,1939 ----
return new AndINode(value, phase->intcon(0xFF));
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
! const Type* LoadUBNode::Value(PhaseGVN* phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con() &&
!value->bottom_type()->higher_equal(_type)) {
// If the input to the store does not fit with the load's result type,
*** 1959,1969 ****
return new AndINode(value,phase->intcon(0xFFFF));
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
! const Type* LoadUSNode::Value(PhaseTransform *phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con() &&
!value->bottom_type()->higher_equal(_type)) {
// If the input to the store does not fit with the load's result type,
--- 1959,1969 ----
return new AndINode(value,phase->intcon(0xFFFF));
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
! const Type* LoadUSNode::Value(PhaseGVN* phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con() &&
!value->bottom_type()->higher_equal(_type)) {
// If the input to the store does not fit with the load's result type,
*** 1991,2001 ****
}
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
! const Type* LoadSNode::Value(PhaseTransform *phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con() &&
!value->bottom_type()->higher_equal(_type)) {
// If the input to the store does not fit with the load's result type,
--- 1991,2001 ----
}
// Identity call will handle the case where truncation is not needed.
return LoadNode::Ideal(phase, can_reshape);
}
! const Type* LoadSNode::Value(PhaseGVN* phase) const {
Node* mem = in(MemNode::Memory);
Node* value = can_see_stored_value(mem,phase);
if (value != NULL && value->is_Con() &&
!value->bottom_type()->higher_equal(_type)) {
// If the input to the store does not fit with the load's result type,
*** 2024,2044 ****
assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
return new LoadKlassNode(ctl, mem, adr, at, tk, MemNode::unordered);
}
//------------------------------Value------------------------------------------
! const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
return klass_value_common(phase);
}
// In most cases, LoadKlassNode does not have the control input set. If the control
// input is set, it must not be removed (by LoadNode::Ideal()).
bool LoadKlassNode::can_remove_control() const {
return false;
}
! const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const {
// Either input is TOP ==> the result is TOP
const Type *t1 = phase->type( in(MemNode::Memory) );
if (t1 == Type::TOP) return Type::TOP;
Node *adr = in(MemNode::Address);
const Type *t2 = phase->type( adr );
--- 2024,2044 ----
assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
return new LoadKlassNode(ctl, mem, adr, at, tk, MemNode::unordered);
}
//------------------------------Value------------------------------------------
! const Type* LoadKlassNode::Value(PhaseGVN* phase) const {
return klass_value_common(phase);
}
// In most cases, LoadKlassNode does not have the control input set. If the control
// input is set, it must not be removed (by LoadNode::Ideal()).
bool LoadKlassNode::can_remove_control() const {
return false;
}
! const Type* LoadNode::klass_value_common(PhaseGVN* phase) const {
// Either input is TOP ==> the result is TOP
const Type *t1 = phase->type( in(MemNode::Memory) );
if (t1 == Type::TOP) return Type::TOP;
Node *adr = in(MemNode::Address);
const Type *t2 = phase->type( adr );
*** 2170,2184 ****
}
//------------------------------Identity---------------------------------------
// To clean up reflective code, simplify k.java_mirror.as_klass to plain k.
// Also feed through the klass in Allocate(...klass...)._klass.
! Node* LoadKlassNode::Identity( PhaseTransform *phase ) {
return klass_identity_common(phase);
}
! Node* LoadNode::klass_identity_common(PhaseTransform *phase ) {
Node* x = LoadNode::Identity(phase);
if (x != this) return x;
// Take apart the address into an oop and and offset.
// Return 'this' if we cannot.
--- 2170,2184 ----
}
//------------------------------Identity---------------------------------------
// To clean up reflective code, simplify k.java_mirror.as_klass to plain k.
// Also feed through the klass in Allocate(...klass...)._klass.
! Node* LoadKlassNode::Identity(PhaseGVN* phase) {
return klass_identity_common(phase);
}
! Node* LoadNode::klass_identity_common(PhaseGVN* phase) {
Node* x = LoadNode::Identity(phase);
if (x != this) return x;
// Take apart the address into an oop and and offset.
// Return 'this' if we cannot.
*** 2229,2250 ****
return this;
}
//------------------------------Value------------------------------------------
! const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
const Type *t = klass_value_common(phase);
if (t == Type::TOP)
return t;
return t->make_narrowklass();
}
//------------------------------Identity---------------------------------------
// To clean up reflective code, simplify k.java_mirror.as_klass to narrow k.
// Also feed through the klass in Allocate(...klass...)._klass.
! Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
Node *x = klass_identity_common(phase);
const Type *t = phase->type( x );
if( t == Type::TOP ) return x;
if( t->isa_narrowklass()) return x;
--- 2229,2250 ----
return this;
}
//------------------------------Value------------------------------------------
! const Type* LoadNKlassNode::Value(PhaseGVN* phase) const {
const Type *t = klass_value_common(phase);
if (t == Type::TOP)
return t;
return t->make_narrowklass();
}
//------------------------------Identity---------------------------------------
// To clean up reflective code, simplify k.java_mirror.as_klass to narrow k.
// Also feed through the klass in Allocate(...klass...)._klass.
! Node* LoadNKlassNode::Identity(PhaseGVN* phase) {
Node *x = klass_identity_common(phase);
const Type *t = phase->type( x );
if( t == Type::TOP ) return x;
if( t->isa_narrowklass()) return x;
*** 2252,2262 ****
return phase->transform(new EncodePKlassNode(x, t->make_narrowklass()));
}
//------------------------------Value-----------------------------------------
! const Type *LoadRangeNode::Value( PhaseTransform *phase ) const {
// Either input is TOP ==> the result is TOP
const Type *t1 = phase->type( in(MemNode::Memory) );
if( t1 == Type::TOP ) return Type::TOP;
Node *adr = in(MemNode::Address);
const Type *t2 = phase->type( adr );
--- 2252,2262 ----
return phase->transform(new EncodePKlassNode(x, t->make_narrowklass()));
}
//------------------------------Value-----------------------------------------
! const Type* LoadRangeNode::Value(PhaseGVN* phase) const {
// Either input is TOP ==> the result is TOP
const Type *t1 = phase->type( in(MemNode::Memory) );
if( t1 == Type::TOP ) return Type::TOP;
Node *adr = in(MemNode::Address);
const Type *t2 = phase->type( adr );
*** 2300,2310 ****
return NULL;
}
//------------------------------Identity---------------------------------------
// Feed through the length in AllocateArray(...length...)._length.
! Node* LoadRangeNode::Identity( PhaseTransform *phase ) {
Node* x = LoadINode::Identity(phase);
if (x != this) return x;
// Take apart the address into an oop and and offset.
// Return 'this' if we cannot.
--- 2300,2310 ----
return NULL;
}
//------------------------------Identity---------------------------------------
// Feed through the length in AllocateArray(...length...)._length.
! Node* LoadRangeNode::Identity(PhaseGVN* phase) {
Node* x = LoadINode::Identity(phase);
if (x != this) return x;
// Take apart the address into an oop and and offset.
// Return 'this' if we cannot.
*** 2471,2481 ****
return NULL; // No further progress
}
//------------------------------Value-----------------------------------------
! const Type *StoreNode::Value( PhaseTransform *phase ) const {
// Either input is TOP ==> the result is TOP
const Type *t1 = phase->type( in(MemNode::Memory) );
if( t1 == Type::TOP ) return Type::TOP;
const Type *t2 = phase->type( in(MemNode::Address) );
if( t2 == Type::TOP ) return Type::TOP;
--- 2471,2481 ----
return NULL; // No further progress
}
//------------------------------Value-----------------------------------------
! const Type* StoreNode::Value(PhaseGVN* phase) const {
// Either input is TOP ==> the result is TOP
const Type *t1 = phase->type( in(MemNode::Memory) );
if( t1 == Type::TOP ) return Type::TOP;
const Type *t2 = phase->type( in(MemNode::Address) );
if( t2 == Type::TOP ) return Type::TOP;
*** 2486,2496 ****
//------------------------------Identity---------------------------------------
// Remove redundant stores:
// Store(m, p, Load(m, p)) changes to m.
// Store(, p, x) -> Store(m, p, x) changes to Store(m, p, x).
! Node *StoreNode::Identity( PhaseTransform *phase ) {
Node* mem = in(MemNode::Memory);
Node* adr = in(MemNode::Address);
Node* val = in(MemNode::ValueIn);
// Load then Store? Then the Store is useless
--- 2486,2496 ----
//------------------------------Identity---------------------------------------
// Remove redundant stores:
// Store(m, p, Load(m, p)) changes to m.
// Store(, p, x) -> Store(m, p, x) changes to Store(m, p, x).
! Node* StoreNode::Identity(PhaseGVN* phase) {
Node* mem = in(MemNode::Memory);
Node* adr = in(MemNode::Address);
Node* val = in(MemNode::ValueIn);
// Load then Store? Then the Store is useless
*** 2640,2650 ****
return StoreNode::Ideal(phase, can_reshape);
}
//=============================================================================
//------------------------------Identity---------------------------------------
! Node *StoreCMNode::Identity( PhaseTransform *phase ) {
// No need to card mark when storing a null ptr
Node* my_store = in(MemNode::OopStore);
if (my_store->is_Store()) {
const Type *t1 = phase->type( my_store->in(MemNode::ValueIn) );
if( t1 == TypePtr::NULL_PTR ) {
--- 2640,2650 ----
return StoreNode::Ideal(phase, can_reshape);
}
//=============================================================================
//------------------------------Identity---------------------------------------
! Node* StoreCMNode::Identity(PhaseGVN* phase) {
// No need to card mark when storing a null ptr
Node* my_store = in(MemNode::OopStore);
if (my_store->is_Store()) {
const Type *t1 = phase->type( my_store->in(MemNode::ValueIn) );
if( t1 == TypePtr::NULL_PTR ) {
*** 2669,2679 ****
return NULL;
}
//------------------------------Value-----------------------------------------
! const Type *StoreCMNode::Value( PhaseTransform *phase ) const {
// Either input is TOP ==> the result is TOP
const Type *t = phase->type( in(MemNode::Memory) );
if( t == Type::TOP ) return Type::TOP;
t = phase->type( in(MemNode::Address) );
if( t == Type::TOP ) return Type::TOP;
--- 2669,2679 ----
return NULL;
}
//------------------------------Value-----------------------------------------
! const Type* StoreCMNode::Value(PhaseGVN* phase) const {
// Either input is TOP ==> the result is TOP
const Type *t = phase->type( in(MemNode::Memory) );
if( t == Type::TOP ) return Type::TOP;
t = phase->type( in(MemNode::Address) );
if( t == Type::TOP ) return Type::TOP;
*** 2687,2697 ****
}
//=============================================================================
//----------------------------------SCMemProjNode------------------------------
! const Type * SCMemProjNode::Value( PhaseTransform *phase ) const
{
return bottom_type();
}
//=============================================================================
--- 2687,2697 ----
}
//=============================================================================
//----------------------------------SCMemProjNode------------------------------
! const Type* SCMemProjNode::Value(PhaseGVN* phase) const
{
return bottom_type();
}
//=============================================================================
*** 2743,2753 ****
return idx > 1;
}
//------------------------------Identity---------------------------------------
// Clearing a zero length array does nothing
! Node *ClearArrayNode::Identity( PhaseTransform *phase ) {
return phase->type(in(2))->higher_equal(TypeX::ZERO) ? in(1) : this;
}
//------------------------------Idealize---------------------------------------
// Clearing a short array is faster with stores
--- 2743,2753 ----
return idx > 1;
}
//------------------------------Identity---------------------------------------
// Clearing a zero length array does nothing
! Node* ClearArrayNode::Identity(PhaseGVN* phase) {
return phase->type(in(2))->higher_equal(TypeX::ZERO) ? in(1) : this;
}
//------------------------------Idealize---------------------------------------
// Clearing a short array is faster with stores
*** 2999,3009 ****
}
return progress ? this : NULL;
}
//------------------------------Value------------------------------------------
! const Type *MemBarNode::Value( PhaseTransform *phase ) const {
if( !in(0) ) return Type::TOP;
if( phase->type(in(0)) == Type::TOP )
return Type::TOP;
return TypeTuple::MEMBAR;
}
--- 2999,3009 ----
}
return progress ? this : NULL;
}
//------------------------------Value------------------------------------------
! const Type* MemBarNode::Value(PhaseGVN* phase) const {
if( !in(0) ) return Type::TOP;
if( phase->type(in(0)) == Type::TOP )
return Type::TOP;
return TypeTuple::MEMBAR;
}
*** 4141,4151 ****
uint MergeMemNode::cmp( const Node &n ) const {
return (&n == this); // Always fail except on self
}
//------------------------------Identity---------------------------------------
! Node* MergeMemNode::Identity(PhaseTransform *phase) {
// Identity if this merge point does not record any interesting memory
// disambiguations.
Node* base_mem = base_memory();
Node* empty_mem = empty_memory();
if (base_mem != empty_mem) { // Memory path is not dead?
--- 4141,4151 ----
uint MergeMemNode::cmp( const Node &n ) const {
return (&n == this); // Always fail except on self
}
//------------------------------Identity---------------------------------------
! Node* MergeMemNode::Identity(PhaseGVN* phase) {
// Identity if this merge point does not record any interesting memory
// disambiguations.
Node* base_mem = base_memory();
Node* empty_mem = empty_memory();
if (base_mem != empty_mem) { // Memory path is not dead?
< prev index next >