1515 } else if (offset < 0 || offset >= k->size_helper() * wordSize) { 1516 // Static fields are in the space above the normal instance 1517 // fields in the java.lang.Class instance. 1518 if (to->klass() != ciEnv::current()->Class_klass()) { 1519 to = NULL; 1520 tj = TypeOopPtr::BOTTOM; 1521 offset = tj->offset(); 1522 } 1523 } else { 1524 ciInstanceKlass *canonical_holder = k->get_canonical_holder(offset); 1525 if (!k->equals(canonical_holder) || tj->offset() != offset) { 1526 if( is_known_inst ) { 1527 tj = to = TypeInstPtr::make(to->ptr(), canonical_holder, true, NULL, Type::Offset(offset), to->instance_id()); 1528 } else { 1529 tj = to = TypeInstPtr::make(to->ptr(), canonical_holder, false, NULL, Type::Offset(offset)); 1530 } 1531 } 1532 } 1533 } 1534 1535 // Klass pointers to object array klasses need some flattening 1536 const TypeKlassPtr *tk = tj->isa_klassptr(); 1537 if( tk ) { 1538 // If we are referencing a field within a Klass, we need 1539 // to assume the worst case of an Object. Both exact and 1540 // inexact types must flatten to the same alias class so 1541 // use NotNull as the PTR. 1542 if ( offset == Type::OffsetBot || (offset >= 0 && (size_t)offset < sizeof(Klass)) ) { 1543 1544 tj = tk = TypeKlassPtr::make(TypePtr::NotNull, 1545 TypeKlassPtr::OBJECT->klass(), 1546 Type::Offset(offset)); 1547 } 1548 1549 ciKlass* klass = tk->klass(); 1550 if (klass != NULL && klass->is_obj_array_klass()) { 1551 ciKlass* k = TypeAryPtr::OOPS->klass(); 1552 if( !k || !k->is_loaded() ) // Only fails for some -Xcomp runs 1553 k = TypeInstPtr::BOTTOM->klass(); 1554 tj = tk = TypeKlassPtr::make(TypePtr::NotNull, k, Type::Offset(offset)); | 1515 } else if (offset < 0 || offset >= k->size_helper() * wordSize) { 1516 // Static fields are in the space above the normal instance 1517 // fields in the java.lang.Class instance. 1518 if (to->klass() != ciEnv::current()->Class_klass()) { 1519 to = NULL; 1520 tj = TypeOopPtr::BOTTOM; 1521 offset = tj->offset(); 1522 } 1523 } else { 1524 ciInstanceKlass *canonical_holder = k->get_canonical_holder(offset); 1525 if (!k->equals(canonical_holder) || tj->offset() != offset) { 1526 if( is_known_inst ) { 1527 tj = to = TypeInstPtr::make(to->ptr(), canonical_holder, true, NULL, Type::Offset(offset), to->instance_id()); 1528 } else { 1529 tj = to = TypeInstPtr::make(to->ptr(), canonical_holder, false, NULL, Type::Offset(offset)); 1530 } 1531 } 1532 } 1533 } 1534 1535 // Value type pointers need flattening 1536 const TypeValueTypePtr* tv = tj->isa_valuetypeptr(); 1537 if (tv != NULL && _AliasLevel >= 2) { 1538 assert(tv->speculative() == NULL, "should not have speculative type information"); 1539 ciValueKlass* vk = tv->klass()->as_value_klass(); 1540 if (ptr == TypePtr::Constant) { 1541 assert(!is_known_inst, "not scalarizable allocation"); 1542 tj = tv = TypeValueTypePtr::make(TypePtr::BotPTR, tv->value_klass(), NULL, Type::Offset(offset)); 1543 } else if (is_known_inst) { 1544 tj = tv; // Keep NotNull and klass_is_exact for instance type 1545 } else if (ptr == TypePtr::NotNull || tv->klass_is_exact()) { 1546 // During the 2nd round of IterGVN, NotNull castings are removed. 1547 // Make sure the Bottom and NotNull variants alias the same. 1548 // Also, make sure exact and non-exact variants alias the same. 1549 tj = tv = TypeValueTypePtr::make(TypePtr::BotPTR, tv->value_klass(), tv->const_oop(), Type::Offset(offset)); 1550 } 1551 // Canonicalize the holder of this field 1552 if (offset >= 0 && offset < instanceOopDesc::base_offset_in_bytes()) { 1553 // First handle header references such as a LoadKlassNode, even if the 1554 // object's klass is unloaded at compile time (4965979). 1555 if (!is_known_inst) { // Do it only for non-instance types 1556 tj = tv = TypeValueTypePtr::make(TypePtr::BotPTR, env()->___Value_klass()->as_value_klass(), NULL, Type::Offset(offset)); 1557 } 1558 } else if (offset < 0 || offset >= vk->size_helper() * wordSize) { 1559 // Static fields are in the space above the normal instance 1560 // fields in the java.lang.Class instance. 1561 tv = NULL; 1562 tj = TypeOopPtr::BOTTOM; 1563 offset = tj->offset(); 1564 } else { 1565 ciInstanceKlass* canonical_holder = vk->get_canonical_holder(offset); 1566 assert(vk->equals(canonical_holder), "value types should not inherit fields"); 1567 } 1568 } 1569 1570 // Klass pointers to object array klasses need some flattening 1571 const TypeKlassPtr *tk = tj->isa_klassptr(); 1572 if( tk ) { 1573 // If we are referencing a field within a Klass, we need 1574 // to assume the worst case of an Object. Both exact and 1575 // inexact types must flatten to the same alias class so 1576 // use NotNull as the PTR. 1577 if ( offset == Type::OffsetBot || (offset >= 0 && (size_t)offset < sizeof(Klass)) ) { 1578 1579 tj = tk = TypeKlassPtr::make(TypePtr::NotNull, 1580 TypeKlassPtr::OBJECT->klass(), 1581 Type::Offset(offset)); 1582 } 1583 1584 ciKlass* klass = tk->klass(); 1585 if (klass != NULL && klass->is_obj_array_klass()) { 1586 ciKlass* k = TypeAryPtr::OOPS->klass(); 1587 if( !k || !k->is_loaded() ) // Only fails for some -Xcomp runs 1588 k = TypeInstPtr::BOTTOM->klass(); 1589 tj = tk = TypeKlassPtr::make(TypePtr::NotNull, k, Type::Offset(offset)); |