1095 (t_oop->is_ptr_to_boxed_value() ||
1096 t_oop->is_known_instance_field()) &&
1097 t_oop->offset() != Type::OffsetBot &&
1098 t_oop->offset() != Type::OffsetTop) {
1099 return true;
1100 }
1101 }
1102 return false;
1103 }
1104
1105 //------------------------------Identity---------------------------------------
1106 // Loads are identity if previous store is to same address
1107 Node* LoadNode::Identity(PhaseGVN* phase) {
1108 // Loading from a ValueTypePtr? The ValueTypePtr has the values of
1109 // all fields as input. Look for the field with matching offset.
1110 Node* addr = in(Address);
1111 intptr_t offset;
1112 Node* base = AddPNode::Ideal_base_and_offset(addr, phase, offset);
1113 if (base != NULL && base->is_ValueTypePtr()) {
1114 Node* value = base->as_ValueTypePtr()->field_value_by_offset((int)offset, true);
1115 if (bottom_type()->isa_narrowoop()) {
1116 assert(!phase->type(value)->isa_narrowoop(), "should already be decoded");
1117 value = phase->transform(new EncodePNode(value, bottom_type()));
1118 }
1119 return value;
1120 }
1121
1122 // If the previous store-maker is the right kind of Store, and the store is
1123 // to the same address, then we are equal to the value stored.
1124 Node* mem = in(Memory);
1125 Node* value = can_see_stored_value(mem, phase);
1126 if( value ) {
1127 // byte, short & char stores truncate naturally.
1128 // A load has to load the truncated value which requires
1129 // some sort of masking operation and that requires an
1130 // Ideal call instead of an Identity call.
1131 if (memory_size() < BytesPerInt) {
1132 // If the input to the store does not fit with the load's result type,
1133 // it must be truncated via an Ideal call.
1134 if (!phase->type(value)->higher_equal(phase->type(this)))
1135 return this;
1136 }
1137 // (This works even when value is a Con, but LoadNode::Value
1138 // usually runs first, producing the singleton type of the Con.)
1139 return value;
|
1095 (t_oop->is_ptr_to_boxed_value() ||
1096 t_oop->is_known_instance_field()) &&
1097 t_oop->offset() != Type::OffsetBot &&
1098 t_oop->offset() != Type::OffsetTop) {
1099 return true;
1100 }
1101 }
1102 return false;
1103 }
1104
1105 //------------------------------Identity---------------------------------------
1106 // Loads are identity if previous store is to same address
1107 Node* LoadNode::Identity(PhaseGVN* phase) {
1108 // Loading from a ValueTypePtr? The ValueTypePtr has the values of
1109 // all fields as input. Look for the field with matching offset.
1110 Node* addr = in(Address);
1111 intptr_t offset;
1112 Node* base = AddPNode::Ideal_base_and_offset(addr, phase, offset);
1113 if (base != NULL && base->is_ValueTypePtr()) {
1114 Node* value = base->as_ValueTypePtr()->field_value_by_offset((int)offset, true);
1115 if (value->is_ValueType()) {
1116 // Non-flattened value type field
1117 ValueTypeNode* vt = value->as_ValueType();
1118 if (vt->is_allocated(phase)) {
1119 value = vt->get_oop();
1120 } else {
1121 // Not yet allocated, bail out
1122 value = NULL;
1123 }
1124 }
1125 if (value != NULL) {
1126 if (Opcode() == Op_LoadN) {
1127 // Encode oop value if we are loading a narrow oop
1128 assert(!phase->type(value)->isa_narrowoop(), "should already be decoded");
1129 value = phase->transform(new EncodePNode(value, bottom_type()));
1130 }
1131 return value;
1132 }
1133 }
1134
1135 // If the previous store-maker is the right kind of Store, and the store is
1136 // to the same address, then we are equal to the value stored.
1137 Node* mem = in(Memory);
1138 Node* value = can_see_stored_value(mem, phase);
1139 if( value ) {
1140 // byte, short & char stores truncate naturally.
1141 // A load has to load the truncated value which requires
1142 // some sort of masking operation and that requires an
1143 // Ideal call instead of an Identity call.
1144 if (memory_size() < BytesPerInt) {
1145 // If the input to the store does not fit with the load's result type,
1146 // it must be truncated via an Ideal call.
1147 if (!phase->type(value)->higher_equal(phase->type(this)))
1148 return this;
1149 }
1150 // (This works even when value is a Con, but LoadNode::Value
1151 // usually runs first, producing the singleton type of the Con.)
1152 return value;
|