1401 1402 // Process weird unsafe references. 1403 if (offset == Type::OffsetBot && (tj->isa_instptr() /*|| tj->isa_klassptr()*/)) { 1404 assert(InlineUnsafeOps, "indeterminate pointers come only from unsafe ops"); 1405 assert(!is_known_inst, "scalarizable allocation should not have unsafe references"); 1406 tj = TypeOopPtr::BOTTOM; 1407 ptr = tj->ptr(); 1408 offset = tj->offset(); 1409 } 1410 1411 // Array pointers need some flattening 1412 const TypeAryPtr *ta = tj->isa_aryptr(); 1413 if (ta && ta->is_stable()) { 1414 // Erase stability property for alias analysis. 1415 tj = ta = ta->cast_to_stable(false); 1416 } 1417 if( ta && is_known_inst ) { 1418 if ( offset != Type::OffsetBot && 1419 offset > arrayOopDesc::length_offset_in_bytes() ) { 1420 offset = Type::OffsetBot; // Flatten constant access into array body only 1421 tj = ta = TypeAryPtr::make(ptr, ta->ary(), ta->klass(), true, Type::Offset(offset), ta->_field_offset, ta->instance_id()); 1422 } 1423 } else if( ta && _AliasLevel >= 2 ) { 1424 // For arrays indexed by constant indices, we flatten the alias 1425 // space to include all of the array body. Only the header, klass 1426 // and array length can be accessed un-aliased. 1427 // For flattened value type array, each field has its own slice so 1428 // we must include the field offset. 1429 if( offset != Type::OffsetBot ) { 1430 if( ta->const_oop() ) { // MethodData* or Method* 1431 offset = Type::OffsetBot; // Flatten constant access into array body 1432 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),ta->ary(),ta->klass(),false,Type::Offset(offset), ta->_field_offset); 1433 } else if( offset == arrayOopDesc::length_offset_in_bytes() ) { 1434 // range is OK as-is. 1435 tj = ta = TypeAryPtr::RANGE; 1436 } else if( offset == oopDesc::klass_offset_in_bytes() ) { 1437 tj = TypeInstPtr::KLASS; // all klass loads look alike 1438 ta = TypeAryPtr::RANGE; // generic ignored junk 1439 ptr = TypePtr::BotPTR; 1440 } else if( offset == oopDesc::mark_offset_in_bytes() ) { 1441 tj = TypeInstPtr::MARK; 1442 ta = TypeAryPtr::RANGE; // generic ignored junk 1443 ptr = TypePtr::BotPTR; 1444 } else { // Random constant offset into array body 1445 offset = Type::OffsetBot; // Flatten constant access into array body 1446 tj = ta = TypeAryPtr::make(ptr,ta->ary(),ta->klass(),false,Type::Offset(offset), ta->_field_offset); 1447 } 1448 } 1449 // Arrays of fixed size alias with arrays of unknown size. 1450 if (ta->size() != TypeInt::POS) { 1451 const TypeAry *tary = TypeAry::make(ta->elem(), TypeInt::POS); 1452 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,ta->klass(),false,Type::Offset(offset), ta->_field_offset); 1453 } 1454 // Arrays of known objects become arrays of unknown objects. 1455 if (ta->elem()->isa_narrowoop() && ta->elem() != TypeNarrowOop::BOTTOM) { 1456 const TypeAry *tary = TypeAry::make(TypeNarrowOop::BOTTOM, ta->size()); 1457 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,NULL,false,Type::Offset(offset), ta->_field_offset); 1458 } 1459 if (ta->elem()->isa_oopptr() && ta->elem() != TypeInstPtr::BOTTOM) { 1460 const TypeAry *tary = TypeAry::make(TypeInstPtr::BOTTOM, ta->size()); 1461 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,NULL,false,Type::Offset(offset), ta->_field_offset); 1462 } 1463 // Arrays of bytes and of booleans both use 'bastore' and 'baload' so 1464 // cannot be distinguished by bytecode alone. 1465 if (ta->elem() == TypeInt::BOOL) { 1466 const TypeAry *tary = TypeAry::make(TypeInt::BYTE, ta->size()); 1467 ciKlass* aklass = ciTypeArrayKlass::make(T_BYTE); 1468 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,aklass,false,Type::Offset(offset), ta->_field_offset); 1469 } 1470 // During the 2nd round of IterGVN, NotNull castings are removed. 1471 // Make sure the Bottom and NotNull variants alias the same. 1472 // Also, make sure exact and non-exact variants alias the same. 1473 if (ptr == TypePtr::NotNull || ta->klass_is_exact() || ta->speculative() != NULL) { 1474 tj = ta = TypeAryPtr::make(TypePtr::BotPTR,ta->ary(),ta->klass(),false,Type::Offset(offset), ta->_field_offset); 1475 } 1476 } 1477 1478 // Oop pointers need some flattening 1479 const TypeInstPtr *to = tj->isa_instptr(); 1480 if( to && _AliasLevel >= 2 && to != TypeOopPtr::BOTTOM ) { 1481 ciInstanceKlass *k = to->klass()->as_instance_klass(); 1482 if( ptr == TypePtr::Constant ) { 1483 if (to->klass() != ciEnv::current()->Class_klass() || 1484 offset < k->size_helper() * wordSize) { 1485 // No constant oop pointers (such as Strings); they alias with 1486 // unknown strings. 1487 assert(!is_known_inst, "not scalarizable allocation"); 1488 tj = to = TypeInstPtr::make(TypePtr::BotPTR,to->klass(),false,0,Type::Offset(offset)); 1489 } 1490 } else if( is_known_inst ) { 1491 tj = to; // Keep NotNull and klass_is_exact for instance type 1492 } else if( ptr == TypePtr::NotNull || to->klass_is_exact() ) { 1493 // During the 2nd round of IterGVN, NotNull castings are removed. 1494 // Make sure the Bottom and NotNull variants alias the same. | 1401 1402 // Process weird unsafe references. 1403 if (offset == Type::OffsetBot && (tj->isa_instptr() /*|| tj->isa_klassptr()*/)) { 1404 assert(InlineUnsafeOps, "indeterminate pointers come only from unsafe ops"); 1405 assert(!is_known_inst, "scalarizable allocation should not have unsafe references"); 1406 tj = TypeOopPtr::BOTTOM; 1407 ptr = tj->ptr(); 1408 offset = tj->offset(); 1409 } 1410 1411 // Array pointers need some flattening 1412 const TypeAryPtr *ta = tj->isa_aryptr(); 1413 if (ta && ta->is_stable()) { 1414 // Erase stability property for alias analysis. 1415 tj = ta = ta->cast_to_stable(false); 1416 } 1417 if( ta && is_known_inst ) { 1418 if ( offset != Type::OffsetBot && 1419 offset > arrayOopDesc::length_offset_in_bytes() ) { 1420 offset = Type::OffsetBot; // Flatten constant access into array body only 1421 tj = ta = TypeAryPtr::make(ptr, ta->ary(), ta->klass(), true, Type::Offset(offset), ta->field_offset(), ta->instance_id()); 1422 } 1423 } else if( ta && _AliasLevel >= 2 ) { 1424 // For arrays indexed by constant indices, we flatten the alias 1425 // space to include all of the array body. Only the header, klass 1426 // and array length can be accessed un-aliased. 1427 // For flattened value type array, each field has its own slice so 1428 // we must include the field offset. 1429 if( offset != Type::OffsetBot ) { 1430 if( ta->const_oop() ) { // MethodData* or Method* 1431 offset = Type::OffsetBot; // Flatten constant access into array body 1432 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),ta->ary(),ta->klass(),false,Type::Offset(offset), ta->field_offset()); 1433 } else if( offset == arrayOopDesc::length_offset_in_bytes() ) { 1434 // range is OK as-is. 1435 tj = ta = TypeAryPtr::RANGE; 1436 } else if( offset == oopDesc::klass_offset_in_bytes() ) { 1437 tj = TypeInstPtr::KLASS; // all klass loads look alike 1438 ta = TypeAryPtr::RANGE; // generic ignored junk 1439 ptr = TypePtr::BotPTR; 1440 } else if( offset == oopDesc::mark_offset_in_bytes() ) { 1441 tj = TypeInstPtr::MARK; 1442 ta = TypeAryPtr::RANGE; // generic ignored junk 1443 ptr = TypePtr::BotPTR; 1444 } else { // Random constant offset into array body 1445 offset = Type::OffsetBot; // Flatten constant access into array body 1446 tj = ta = TypeAryPtr::make(ptr,ta->ary(),ta->klass(),false,Type::Offset(offset), ta->field_offset()); 1447 } 1448 } 1449 // Arrays of fixed size alias with arrays of unknown size. 1450 if (ta->size() != TypeInt::POS) { 1451 const TypeAry *tary = TypeAry::make(ta->elem(), TypeInt::POS); 1452 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,ta->klass(),false,Type::Offset(offset), ta->field_offset()); 1453 } 1454 // Arrays of known objects become arrays of unknown objects. 1455 if (ta->elem()->isa_narrowoop() && ta->elem() != TypeNarrowOop::BOTTOM) { 1456 const TypeAry *tary = TypeAry::make(TypeNarrowOop::BOTTOM, ta->size()); 1457 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,NULL,false,Type::Offset(offset), ta->field_offset()); 1458 } 1459 if (ta->elem()->isa_oopptr() && ta->elem() != TypeInstPtr::BOTTOM) { 1460 const TypeAry *tary = TypeAry::make(TypeInstPtr::BOTTOM, ta->size()); 1461 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,NULL,false,Type::Offset(offset), ta->field_offset()); 1462 } 1463 // Arrays of bytes and of booleans both use 'bastore' and 'baload' so 1464 // cannot be distinguished by bytecode alone. 1465 if (ta->elem() == TypeInt::BOOL) { 1466 const TypeAry *tary = TypeAry::make(TypeInt::BYTE, ta->size()); 1467 ciKlass* aklass = ciTypeArrayKlass::make(T_BYTE); 1468 tj = ta = TypeAryPtr::make(ptr,ta->const_oop(),tary,aklass,false,Type::Offset(offset), ta->field_offset()); 1469 } 1470 // During the 2nd round of IterGVN, NotNull castings are removed. 1471 // Make sure the Bottom and NotNull variants alias the same. 1472 // Also, make sure exact and non-exact variants alias the same. 1473 if (ptr == TypePtr::NotNull || ta->klass_is_exact() || ta->speculative() != NULL) { 1474 tj = ta = TypeAryPtr::make(TypePtr::BotPTR,ta->ary(),ta->klass(),false,Type::Offset(offset), ta->field_offset()); 1475 } 1476 } 1477 1478 // Oop pointers need some flattening 1479 const TypeInstPtr *to = tj->isa_instptr(); 1480 if( to && _AliasLevel >= 2 && to != TypeOopPtr::BOTTOM ) { 1481 ciInstanceKlass *k = to->klass()->as_instance_klass(); 1482 if( ptr == TypePtr::Constant ) { 1483 if (to->klass() != ciEnv::current()->Class_klass() || 1484 offset < k->size_helper() * wordSize) { 1485 // No constant oop pointers (such as Strings); they alias with 1486 // unknown strings. 1487 assert(!is_known_inst, "not scalarizable allocation"); 1488 tj = to = TypeInstPtr::make(TypePtr::BotPTR,to->klass(),false,0,Type::Offset(offset)); 1489 } 1490 } else if( is_known_inst ) { 1491 tj = to; // Keep NotNull and klass_is_exact for instance type 1492 } else if( ptr == TypePtr::NotNull || to->klass_is_exact() ) { 1493 // During the 2nd round of IterGVN, NotNull castings are removed. 1494 // Make sure the Bottom and NotNull variants alias the same. |