< prev index next >
src/hotspot/share/opto/compile.cpp
Print this page
*** 1542,1586 ****
}
}
}
}
- // Value type pointers need flattening
- const TypeValueTypePtr* tv = tj->isa_valuetypeptr();
- if (tv != NULL && _AliasLevel >= 2) {
- assert(tv->speculative() == NULL, "should not have speculative type information");
- ciValueKlass* vk = tv->klass()->as_value_klass();
- if (ptr == TypePtr::Constant) {
- assert(!is_known_inst, "not scalarizable allocation");
- tj = tv = TypeValueTypePtr::make(TypePtr::BotPTR, tv->value_klass(), NULL, Type::Offset(offset));
- } else if (is_known_inst) {
- tj = tv; // Keep NotNull and klass_is_exact for instance type
- } else if (ptr == TypePtr::NotNull || tv->klass_is_exact()) {
- // During the 2nd round of IterGVN, NotNull castings are removed.
- // Make sure the Bottom and NotNull variants alias the same.
- // Also, make sure exact and non-exact variants alias the same.
- tj = tv = TypeValueTypePtr::make(TypePtr::BotPTR, tv->value_klass(), tv->const_oop(), Type::Offset(offset));
- }
- // Canonicalize the holder of this field
- if (offset >= 0 && offset < instanceOopDesc::base_offset_in_bytes()) {
- // First handle header references such as a LoadKlassNode, even if the
- // object's klass is unloaded at compile time (4965979).
- if (!is_known_inst) { // Do it only for non-instance types
- tj = to = TypeInstPtr::make(TypePtr::BotPTR, env()->Object_klass(), false, NULL, Type::Offset(offset));
- }
- } else if (offset < 0 || offset >= vk->size_helper() * wordSize) {
- // Static fields are in the space above the normal instance
- // fields in the java.lang.Class instance.
- tv = NULL;
- tj = TypeOopPtr::BOTTOM;
- offset = tj->offset();
- } else {
- ciInstanceKlass* canonical_holder = vk->get_canonical_holder(offset);
- assert(vk->equals(canonical_holder), "value types should not inherit fields");
- }
- }
-
// Klass pointers to object array klasses need some flattening
const TypeKlassPtr *tk = tj->isa_klassptr();
if( tk ) {
// If we are referencing a field within a Klass, we need
// to assume the worst case of an Object. Both exact and
--- 1542,1551 ----
*** 1840,1865 ****
// but the base pointer type is not distinctive enough to identify
// references into JavaThread.)
// Check for final fields.
const TypeInstPtr* tinst = flat->isa_instptr();
- const TypeValueTypePtr* vtptr = flat->isa_valuetypeptr();
if (tinst && tinst->offset() >= instanceOopDesc::base_offset_in_bytes()) {
if (tinst->const_oop() != NULL &&
tinst->klass() == ciEnv::current()->Class_klass() &&
tinst->offset() >= (tinst->klass()->as_instance_klass()->size_helper() * wordSize)) {
// static field
ciInstanceKlass* k = tinst->const_oop()->as_instance()->java_lang_Class_klass()->as_instance_klass();
field = k->get_field_by_offset(tinst->offset(), true);
} else {
! ciInstanceKlass *k = tinst->klass()->as_instance_klass();
field = k->get_field_by_offset(tinst->offset(), false);
}
- } else if (vtptr) {
- // Value type field
- ciValueKlass* vk = vtptr->klass()->as_value_klass();
- field = vk->get_field_by_offset(vtptr->offset(), false);
}
assert(field == NULL ||
original_field == NULL ||
(field->holder() == original_field->holder() &&
field->offset() == original_field->offset() &&
--- 1805,1829 ----
// but the base pointer type is not distinctive enough to identify
// references into JavaThread.)
// Check for final fields.
const TypeInstPtr* tinst = flat->isa_instptr();
if (tinst && tinst->offset() >= instanceOopDesc::base_offset_in_bytes()) {
if (tinst->const_oop() != NULL &&
tinst->klass() == ciEnv::current()->Class_klass() &&
tinst->offset() >= (tinst->klass()->as_instance_klass()->size_helper() * wordSize)) {
// static field
ciInstanceKlass* k = tinst->const_oop()->as_instance()->java_lang_Class_klass()->as_instance_klass();
field = k->get_field_by_offset(tinst->offset(), true);
+ } else if (tinst->klass()->is_valuetype()) {
+ // Value type field
+ ciValueKlass* vk = tinst->value_klass();
+ field = vk->get_field_by_offset(tinst->offset(), false);
} else {
! ciInstanceKlass* k = tinst->klass()->as_instance_klass();
field = k->get_field_by_offset(tinst->offset(), false);
}
}
assert(field == NULL ||
original_field == NULL ||
(field->holder() == original_field->holder() &&
field->offset() == original_field->offset() &&
< prev index next >