3845N/A * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// Portions of code courtesy of Clifford Click 0N/A// Optimization - Graph Style 0N/A// Dictionary of types shared among compilations. 0N/A// Array which maps compiler types to Basic Types 0N/A T_ADDRESS,
// AnyPtr // shows up in factory methods for NULL_PTR 0N/A// Map ideal registers (machine types) to ideal types 0N/A// Map basic types to canonical Type* pointers. 0N/A// Map basic types to constant-zero Types. 0N/A// Map basic types to array-body alias types. 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------get_const_type--------------------------- 0N/A//---------------------------array_element_basic_type--------------------------------- 0N/A// Mapping to the array element's basic type. 0N/A//---------------------------get_typeflow_type--------------------------------- 0N/A// Import a type produced by ciTypeFlow. 0N/A // The ciTypeFlow pass pushes a long, then the half. 0N/A // The ciTypeFlow pass pushes double, then the half. 0N/A // Our convention is the same. 0N/A // make sure we did not mix up the cases: 0N/A//------------------------------make------------------------------------------- 0N/A// Create a simple Type, with default empty symbol sets. Then hashcons it 0N/A// and look for an existing copy in the type dictionary. 0N/A//------------------------------cmp-------------------------------------------- 0N/A return 1;
// Missed badly 0N/A//------------------------------hash------------------------------------------- 0N/A//--------------------------Initialize_shared---------------------------------- 0N/A // This method does not need to be locked because the first system 0N/A // compilations (stub compilations) occur serially. If they are 0N/A // changed to proceed in parallel, then this section will need 0N/A // Make shared pre-built types. 0N/A // CmpL is overloaded both as the bytecode computation returning 0N/A // a trinary (-1,0,+1) integer result AND as an efficient long 0N/A // compare returning optimizer ideal-type flags. 163N/A // There is no shared klass for Object[]. See note in TypeAryPtr::klass(). 163N/A // Nobody should ask _array_body_type[T_NARROWOOP]. Use NULL as assert. 0N/A // get_zero_type() should not happen for T_CONFLICT 3845N/A // Vector predefined types, it needs initialized _const_basic_type[]. 0N/A // Restore working type arena. 0N/A//------------------------------Initialize------------------------------------- 0N/A // Create the hash-cons'ing dictionary with top-level storage allocation 0N/A // Transfer the shared types. 0N/A//------------------------------hashcons--------------------------------------- 0N/A// Do the hash-cons trick. If the Type already exists in the type table, 0N/A// delete the current Type and return the existing Type. Otherwise stick the 0N/A// current Type in the Type table. 0N/A // Look up the Type in the Type dictionary 0N/A if(
old ) {
// Pre-existing Type? 0N/A if(
old !=
this )
// Yes, this guy is not the pre-existing? 0N/A delete this;
// Yes, Nuke this guy 0N/A return old;
// Return pre-existing 0N/A // Every type has a dual (to make my lattice symmetric). 0N/A // Since we just discovered a new Type, compute its dual right now. 0N/A // New Type, insert into Type table 0N/A return this;
// Return new Type 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A return true;
// Nothing else can go wrong 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------is_finite-------------------------------------- 0N/A// Has a finite value 0N/A//------------------------------is_nan----------------------------------------- 0N/A// Is not a number (NaN) 820N/A//----------------------interface_vs_oop--------------------------------------- 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. NOT virtual. It enforces that meet is 0N/A// commutative and the lattice is symmetric. 0N/A // Interface meet Oop is Not Symmetric: 0N/A // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull 0N/A//------------------------------xmeet------------------------------------------ 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Meeting TOP with anything? 0N/A // Meeting BOTTOM with anything? 0N/A // Current "this->_base" is one of: Bad, Multi, Control, Top, 0N/A // Abio, Abstore, Floatxxx, Doublexxx, Bottom, lastype. 0N/A switch (t->
base()) {
// Switch on original type 0N/A // Cut in half the number of cases I must handle. Only need cases for when 0N/A // the given enum "t->type" is less than or equal to the local enum "type". 0N/A default:
// Bogus type not in lattice 0N/A // These next few cases must match exactly or it is a compile-time error. 0N/A case Abio:
// State of world outside of program 0N/A case Top:
// Top of the lattice 0N/A // The type is unchanged 0N/A//-----------------------------filter------------------------------------------ 0N/A//------------------------------xdual------------------------------------------ 0N/A// Compute dual right now. 0N/A Bad,
// Int - handled in v-call 0N/A Bad,
// Long - handled in v-call 0N/A Bad,
// Tuple - handled in v-call 0N/A Bad,
// Array - handled in v-call 0N/A Bad,
// AnyPtr - handled in v-call 0N/A Bad,
// RawPtr - handled in v-call 0N/A Bad,
// OopPtr - handled in v-call 0N/A Bad,
// InstPtr - handled in v-call 0N/A Bad,
// AryPtr - handled in v-call 0N/A Bad,
// KlassPtr - handled in v-call 0N/A Bad,
// Function - handled in v-call 0N/A // Note: the base() accessor asserts the sanity of _base. 0N/A//------------------------------has_memory------------------------------------- 0N/A//------------------------------dump2------------------------------------------ 0N/A//------------------------------dump------------------------------------------- 0N/A//------------------------------data------------------------------------------- 113N/A "bad",
"control",
"top",
"int:",
"long:",
"half",
"narrowoop:",
3845N/A "tuple:",
"array:",
"vectors:",
"vectord:",
"vectorx:",
"vectory:",
3845N/A "anyptr:",
"rawptr:",
"java:",
"inst:",
"aryptr:",
"klass:",
0N/A "func",
"abIO",
"return_address",
"memory",
0N/A "float_top",
"ftcon:",
"float",
0N/A "double_top",
"dblcon:",
"double",
0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A// constants (Ldi nodes). Singletons are integer, float or double constants. 0N/A//------------------------------empty------------------------------------------ 0N/A// TRUE if Type is a type with no values, FALSE otherwise. 0N/A return false;
// never a singleton, therefore never empty 0N/A//------------------------------dump_stats------------------------------------- 0N/A// Dump collected statistics to stderr 0N/A//------------------------------typerr----------------------------------------- 0N/A//------------------------------isa_oop_ptr------------------------------------ 0N/A// Return true if type is an oop pointer type. False for raw pointers. 3845N/A 0,0,0,0,0,0,0
/*narrowoop*/,0
/*tuple*/, 0
/*array*/, 0, 0, 0, 0
/*vector*/,
0N/A 0
/*anyptr*/,0
/*rawptr*/,
1/*OopPtr*/,
1/*InstPtr*/,
1/*AryPtr*/,
1/*KlassPtr*/,
0N/A 0
/*func*/,0,0
/*return_address*/,0,
0N/A /*floats*/0,0,0,
/*doubles*/0,0,0,
0N/A//------------------------------dump_stats------------------------------------- 0N/A// // Check that arrays match type enum 0N/A // Check that arrays match enumeration 0N/A // assert( PhiNode::tbl [Type::lastype - 1] == NULL, "did not update array"); 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------make------------------------------------------- 0N/A// Create a float constant 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is FloatCon 0N/A switch (t->
base()) {
// Switch on original type 0N/A case AnyPtr:
// Mixing with oops happens when javac 0N/A default:
// All else is a mistake 0N/A // must compare bitwise as positive zero, negative zero and NaN have 0N/A // all the same representation in C++ 0N/A break;
// Return the float constant 0N/A return this;
// Return the float constant 0N/A//------------------------------xdual------------------------------------------ 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A // One or both are NANs. If both are NANs return true, else false. 0N/A // (NaN is impossible at this point, since it is not equal even to itself) 0N/A // difference between positive and negative zero 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------is_finite-------------------------------------- 0N/A// Has a finite value 0N/A//------------------------------is_nan----------------------------------------- 0N/A// Is not a number (NaN) 0N/A//------------------------------dump2------------------------------------------ 0N/A// Dump float constant Type 0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A// constants (Ldi nodes). Singletons are integer, float or double constants 0N/A// or a single symbol. 0N/A return true;
// Always a singleton 0N/A return false;
// always exactly a singleton 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------make------------------------------------------- 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is DoubleCon 0N/A switch (t->
base()) {
// Switch on original type 0N/A case AnyPtr:
// Mixing with oops happens when javac 0N/A default:
// All else is a mistake 0N/A return this;
// Return the double constant 0N/A//------------------------------xdual------------------------------------------ 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A // One or both are NANs. If both are NANs return true, else false. 0N/A // (NaN is impossible at this point, since it is not equal even to itself) 0N/A // difference between positive and negative zero 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------is_finite-------------------------------------- 0N/A// Has a finite value 0N/A//------------------------------is_nan----------------------------------------- 0N/A// Is not a number (NaN) 0N/A//------------------------------dump2------------------------------------------ 0N/A// Dump double constant Type 0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A// constants (Ldi nodes). Singletons are integer, float or double constants 0N/A// or a single symbol. 0N/A return true;
// Always a singleton 0N/A return false;
// always exactly a singleton 0N/A//============================================================================= 0N/A// Convience common pre-built types. 0N/A//------------------------------TypeInt---------------------------------------- 0N/A//------------------------------make------------------------------------------- 0N/A // Certain normalizations keep us sane when comparing types. 0N/A // The 'SMALLINT' covers constants and also CC and its relatives. 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type representation object 0N/A// with reference count equal to the number of Types pointing at it. 0N/A// Caller should wrap a Types around it. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type? 0N/A // Currently "this->_base" is a TypeInt 0N/A switch (t->
base()) {
// Switch on original type 0N/A case AnyPtr:
// Mixing with oops happens when javac 0N/A default:
// All else is a mistake 0N/A // Expand covered set 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: reverse hi & lo; flip widen 0N/A//------------------------------widen------------------------------------------ 0N/A// Only happens for optimistic top-down optimizations. 0N/A // Coming from TOP or such; no widening 0N/A // If new guy is equal to old guy, no widening 0N/A // If new guy contains old, then we widened 0N/A // If new guy is already wider than old, no widening 0N/A // If old guy was a constant, do not bother 0N/A // Now widen new guy. 0N/A // Check for widening too far 0N/A // If neither endpoint is extremal yet, push out the endpoint 0N/A // which is closer to its respective limit. 0N/A if (
_lo >= 0 ||
// easy common case 0N/A // Try to widen to an unsigned range type of 31 bits: 0N/A // Returned widened new guy 0N/A // If old guy contains new, then we probably widened too far & dropped to 0N/A // bottom. Return the wider fellow. 0N/A //fatal("Integer value range is not subset"); 0N/A//------------------------------narrow--------------------------------------- 0N/A// Only happens for pessimistic optimizations. 0N/A if (
_lo >=
_hi)
return this;
// already narrow enough 0N/A // If new guy is equal to old guy, no narrowing 0N/A // If old guy was maximum range, allow the narrowing 0N/A return this;
// doesn't narrow; pretty wierd 0N/A // The new type narrows the old type, so look for a "death march". 0N/A // See comments on PhaseTransform::saturate. 0N/A // Use the new type only if the range shrinks a lot. 0N/A // We do not want the optimizer computing 2^31 point by point. 0N/A//-----------------------------filter------------------------------------------ 0N/A // Do not allow the value of kill->_widen to affect the outcome. 0N/A // The widen bits must be allowed to run freely through the graph. 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------is_finite-------------------------------------- 0N/A// Has a finite value 0N/A//------------------------------dump2------------------------------------------ 0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------TypeLong--------------------------------------- 0N/A//------------------------------make------------------------------------------- 0N/A // Certain normalizations keep us sane when comparing types. 1540N/A // The 'SMALLINT' covers constants. 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type representation object 0N/A// with reference count equal to the number of Types pointing at it. 0N/A// Caller should wrap a Types around it. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type? 0N/A // Currently "this->_base" is a TypeLong 0N/A switch (t->
base()) {
// Switch on original type 0N/A case AnyPtr:
// Mixing with oops happens when javac 0N/A default:
// All else is a mistake 0N/A // Expand covered set 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: reverse hi & lo; flip widen 0N/A//------------------------------widen------------------------------------------ 0N/A// Only happens for optimistic top-down optimizations. 0N/A // Coming from TOP or such; no widening 0N/A // If new guy is equal to old guy, no widening 0N/A // If new guy contains old, then we widened 0N/A // If new guy is already wider than old, no widening 0N/A // If old guy was a constant, do not bother 0N/A // Now widen new guy. 0N/A // Check for widening too far 0N/A // If neither endpoint is extremal yet, push out the endpoint 0N/A // which is closer to its respective limit. 0N/A if (
_lo >= 0 ||
// easy common case 0N/A // Try to widen to an unsigned range type of 32/63 bits: 0N/A // Returned widened new guy 0N/A // If old guy contains new, then we probably widened too far & dropped to 0N/A // bottom. Return the wider fellow. 0N/A // fatal("Long value range is not subset"); 0N/A//------------------------------narrow---------------------------------------- 0N/A// Only happens for pessimistic optimizations. 0N/A if (
_lo >=
_hi)
return this;
// already narrow enough 0N/A // If new guy is equal to old guy, no narrowing 0N/A // If old guy was maximum range, allow the narrowing 0N/A return this;
// doesn't narrow; pretty wierd 0N/A // The new type narrows the old type, so look for a "death march". 0N/A // See comments on PhaseTransform::saturate. 0N/A // Use the new type only if the range shrinks a lot. 0N/A // We do not want the optimizer computing 2^31 point by point. 0N/A//-----------------------------filter------------------------------------------ 0N/A // Do not allow the value of kill->_widen to affect the outcome. 0N/A // The widen bits must be allowed to run freely through the graph. 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------is_finite-------------------------------------- 0N/A// Has a finite value 0N/A//------------------------------dump2------------------------------------------ 0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------make------------------------------------------- 0N/A// Make a TypeTuple from the range of a method signature 0N/A// Make a TypeTuple from the domain of a method signature 0N/A // Use get_const_type here because it respects UseUniqueSubclasses: 0N/A//------------------------------fields----------------------------------------- 0N/A// Subroutine call type with space allocated for argument types 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is Tuple 0N/A switch (t->
base()) {
// switch on original type 0N/A default:
// All else is a mistake 0N/A return this;
// Return the double constant 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: compute field-by-field dual 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A if (
_cnt != s->
_cnt)
return false;
// Unequal field counts 0N/A return false;
// Missed 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------dump2------------------------------------------ 0N/A// Dump signature Type 0N/A if( !
depth || d[
this] ) {
// Check for recursive print 0N/A d.
Insert((
void*)
this, (
void*)
this);
// Stop recursion 0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A// constants (Ldi nodes). Singletons are integer, float or double constants 0N/A// or a single symbol. 0N/A return false;
// Never a singleton 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A // Certain normalizations keep us sane when comparing types. 0N/A // We do not want arrayOop variables to differ only by the wideness 0N/A // of their index types. Pick minimum wideness, since that is the 0N/A // forced wideness of small ranges anyway. 0N/A//------------------------------make------------------------------------------- 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is Ary 0N/A switch (t->
base()) {
// switch on original type 0N/A default:
// All else is a mistake 0N/A return this;
// Return the double constant 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: compute field-by-field dual 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 820N/A//----------------------interface_vs_oop--------------------------------------- 0N/A//------------------------------dump2------------------------------------------ 0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A// constants (Ldi nodes). Singletons are integer, float or double constants 0N/A// or a single symbol. 0N/A return false;
// Never a singleton 0N/A//--------------------------ary_must_be_exact---------------------------------- 0N/A // This logic looks at the element type of an array, and returns true 0N/A // if the element type is either a primitive or a final instance class. 0N/A // In such cases, an array built on this ary must have no subclasses. 0N/A if (
_elem ==
TOP )
return false;
// inverted general array not exact 0N/A if (!
toop)
return true;
// a primitive type, like int 3845N/A//==============================TypeVect======================================= 3845N/A// Convenience common pre-built types. 3845N/A//------------------------------make------------------------------------------- 3845N/A//------------------------------meet------------------------------------------- 3845N/A// Compute the MEET of two types. It returns a new Type object. 3845N/A // Perform a fast test for common case; meeting the same types together. 3845N/A if(
this == t )
return this;
// Meeting same type-rep? 3845N/A // Current "this->_base" is Vector 3845N/A switch (t->
base()) {
// switch on original type 3845N/A default:
// All else is a mistake 3845N/A//------------------------------xdual------------------------------------------ 3845N/A// Dual: compute field-by-field dual 3845N/A//------------------------------eq--------------------------------------------- 3845N/A// Structural equality check for Type representations 3845N/A//------------------------------hash------------------------------------------- 3845N/A// Type-specific hashing function. 3845N/A//------------------------------singleton-------------------------------------- 3845N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 3845N/A// constants (Ldi nodes). Vector is singleton if all elements are the same 3845N/A// constant value (when vector is created with Replicate code). 3845N/A// There is no Con node for vectors yet. 3845N/A// return _elem->singleton(); 3845N/A//------------------------------dump2------------------------------------------ 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------meet------------------------------------------- 0N/A// Meet over the PTR enum 0N/A // TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, 0N/A//------------------------------make------------------------------------------- 0N/A//------------------------------cast_to_ptr_type------------------------------- 0N/A//------------------------------get_con---------------------------------------- 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is AnyPtr 0N/A switch (t->
base()) {
// switch on original type 0N/A case Int:
// Mixing ints & oops happens when javac 0N/A case Long:
// reuses local variables 0N/A case RawPtr:
// For these, flip the call around to cut down 0N/A return t->
xmeet(
this);
// Call in reverse direction 0N/A default:
// All else is a mistake 0N/A//------------------------------meet_offset------------------------------------ 0N/A // Either is 'TOP' offset? Return the other offset! 0N/A // If either is different, return 'BOTTOM' offset 0N/A//------------------------------dual_offset------------------------------------ 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: compute field-by-field dual 306N/A//------------------------------xadd_offset------------------------------------ 306N/A // Adding to 'TOP' offset? Return 'TOP'! 306N/A // Adding to 'BOTTOM' offset? Return 'BOTTOM'! 306N/A // Addition overflows or "accidentally" equals to OffsetTop? Return 'BOTTOM'! 306N/A // assert( _offset >= 0 && _offset+offset >= 0, "" ); 306N/A // It is possible to construct a negative offset during PhaseCCP 0N/A//------------------------------add_offset------------------------------------- 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------dump2------------------------------------------ 0N/A "TopPTR",
"AnyNull",
"Constant",
"NULL",
"NotNull",
"BotPTR" 0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A // TopPTR, Null, AnyNull, Constant are all singletons 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------make------------------------------------------- 0N/A//------------------------------cast_to_ptr_type------------------------------- 0N/A//------------------------------get_con---------------------------------------- 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is RawPtr 0N/A switch( t->
base() ) {
// switch on original type 0N/A default:
// All else is a mistake 0N/A // Found an AnyPtr type vs self-RawPtr type 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: compute field-by-field dual 0N/A//------------------------------add_offset------------------------------------- 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------dump2------------------------------------------ 0N/A//============================================================================= 0N/A// Convenience common pre-built type. 163N/A//------------------------------TypeOopPtr------------------------------------- 2223N/A // Perm objects don't use compressed references 163N/A }
else {
// exclude unsafe ops 2223N/A // Special hidden fields from the Class. 2223N/A // Instance fields which contains a compressed oop references. 2223N/A // Compile::find_alias_type() cast exactness on all types to verify 2223N/A // that it does not affect alias type. 2223N/A // Type for the copy start in LibraryCallKit::inline_native_clone(). 0N/A//------------------------------make------------------------------------------- 0N/A//------------------------------cast_to_ptr_type------------------------------- 247N/A//-----------------------------cast_to_instance_id---------------------------- 0N/A // There are no instances of a general oop. 0N/A // Return self unchanged. 0N/A//-----------------------------cast_to_exactness------------------------------- 0N/A // There is no such thing as an exact general oop. 0N/A // Return self unchanged. 0N/A//------------------------------as_klass_type---------------------------------- 0N/A// Return the klass type corresponding to this instance or array type. 0N/A// It is the type that is loaded from an object of this type. 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is OopPtr 0N/A switch (t->
base()) {
// switch on original type 0N/A case Int:
// Mixing ints & oops happens when javac 0N/A case Long:
// reuses local variables 0N/A default:
// All else is a mistake 0N/A // Found an AnyPtr type vs self-OopPtr type 0N/A // else fall through: 0N/A case InstPtr:
// For these, flip the call around to cut down 0N/A return t->
xmeet(
this);
// Call in reverse direction 0N/A return this;
// Return the double constant 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual of a pure heap pointer. No relevant klass or oop information. 0N/A//--------------------------make_from_klass_common----------------------------- 0N/A// Computes the element-type given a klass. 0N/A // Element is an instance 0N/A // Try to set klass_is_exact. 0N/A // Add a dependence; if concrete subclass added we need to recompile 0N/A // Element is an object array. Recursively call ourself. 0N/A // We used to pass NotNull in here, asserting that the sub-arrays 0N/A // are all not-null. This is not true in generally, as code can 0N/A // slam NULLs down in the subarrays. 0N/A // Element is an typeArray 0N/A // We used to pass NotNull in here, asserting that the array pointer 0N/A // is not-null. That was not true in general. 0N/A//------------------------------make_from_constant----------------------------- 0N/A// Make a java pointer from an oop constant 0N/A // Treat much like a typeArray of bytes, like below, but fake the type... 3848N/A // Treat much like a objArray, like below, but fake the type... 0N/A // Element is an instance 0N/A // Element is an object array. Recursively call ourself. 0N/A // We used to pass NotNull in here, asserting that the sub-arrays 0N/A // are all not-null. This is not true in generally, as code can 0N/A // slam NULLs down in the subarrays. 0N/A // Element is an typeArray 0N/A // We used to pass NotNull in here, asserting that the array pointer 0N/A // is not-null. That was not true in general. 0N/A//------------------------------get_con---------------------------------------- 0N/A // After being ported to the compiler interface, the compiler no longer 0N/A // directly manipulates the addresses of oops. Rather, it only has a pointer 0N/A // to a handle at compile time. This handle is embedded in the generated 0N/A // code and dereferenced at the time the nmethod is made. Until that time, 0N/A // it is not reasonable to do arithmetic with the addresses of oops (we don't 0N/A // have access to the addresses!). This does not seem to currently happen, 605N/A // but this assertion here is to help prevent its occurence. 0N/A//-----------------------------filter------------------------------------------ 0N/A// Do not allow interface-vs.-noninterface joins to collapse to top. 0N/A // Check for evil case of 'this' being a class and 'kills' expecting an 0N/A // interface. This can happen because the bytecodes do not contain 0N/A // enough type info to distinguish a Java-level interface variable 0N/A // from a Java-level object variable. If we meet 2 classes which 0N/A // both implement interface I, but their meet is at 'j/l/O' which 0N/A // doesn't implement I, we have no way to tell if the result should 0N/A // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows 0N/A // into a Phi which "knows" it's an Interface type we'll have to 0N/A // If we have an interface-typed Phi or cast and we narrow to a class type, 0N/A // the join should report back the class. However, if we have a J/L/Object 0N/A // class-typed Phi and an interface flows in, it's possible that the meet & 0N/A // join report an interface back out. This isn't possible but happens 0N/A // because the type system doesn't interact well with interfaces. 0N/A // Happens in a CTW of rt.jar, 320-341, no extra flags 1335N/A // Interface klass type could be exact in opposite to interface type, 1335N/A // return it here instead of incorrect Constant ptr J/L/Object (6894807). 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------dump2------------------------------------------ 0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A // detune optimizer to not generate constant oop + constant offset as a constant! 0N/A // TopPTR, Null, AnyNull, Constant are all singletons 0N/A//------------------------------add_offset------------------------------------- 223N/A//------------------------------meet_instance_id-------------------------------- 223N/A // Either is 'TOP' instance? Return the other instance! 223N/A // If either is different, return 'BOTTOM' instance 223N/A//------------------------------dual_instance_id-------------------------------- 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------TypeInstPtr------------------------------------- 0N/A "cannot have constants with non-loaded klass");
0N/A//------------------------------make------------------------------------------- 0N/A // Either const_oop() is NULL or else ptr is Constant 0N/A "constant pointers must have a value supplied" );
0N/A // Ptr is never Null 0N/A // Note: This case includes meta-object constants, such as methods. 0N/A // Now hash this baby 0N/A//------------------------------cast_to_ptr_type------------------------------- 0N/A // Reconstruct _sig info here since not a problem with later lazy 0N/A // construction, _sig will show up on demand. 0N/A//-----------------------------cast_to_exactness------------------------------- 247N/A//-----------------------------cast_to_instance_id---------------------------- 0N/A//------------------------------xmeet_unloaded--------------------------------- 0N/A// Compute the MEET of two InstPtrs when at least one is unloaded. 0N/A // Object | TOP | AnyNull | Constant | NotNull | BOTTOM | 0N/A // =================================================================== 0N/A // TOP | ..........................Unloaded......................| 0N/A // AnyNull | U-AN |................Unloaded......................| 0N/A // Constant | ... O-NN .................................. | O-BOT | 0N/A // NotNull | ... O-NN .................................. | O-BOT | 0N/A // BOTTOM | ........................Object-BOTTOM ..................| 0N/A // Both are unloaded, not the same class, not Object 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is Pointer 0N/A switch (t->
base()) {
// switch on original type 0N/A case Int:
// Mixing ints & oops happens when javac 0N/A case Long:
// reuses local variables 0N/A default:
// All else is a mistake 0N/A case AryPtr: {
// All arrays inherit from Object class 0N/A case AnyNull:
// Fall 'down' to dual of object klass 0N/A // cannot subclass, so the meet has to fall badly below the centerline 0N/A // LCA is object_klass, but if we subclass from the top we can do better 0N/A // If 'this' (InstPtr) is above the centerline and it is Object class 605N/A // then we can subclass in the Java class hierarchy. 0N/A // that is, tp's array type is a subtype of my klass 0N/A // The other case cannot happen, since I cannot be a subtype of an array. 0N/A // The meet falls down to Object class below centerline. 0N/A // Found a OopPtr type vs self-InstPtr type 0N/A // Found an AnyPtr type vs self-InstPtr type 223N/A // else fall through to AnyNull 0N/A | / | \ | } Any-nulls 0N/A B-con A-con C-con } constants; not comparable across classes 0N/A | \ | / | } not-nulls 0N/A // Found an InstPtr sub-type vs self-InstPtr type 0N/A // Check for easy case; klasses are equal (and perhaps not loaded!) 0N/A // If we have constants, then we created oops so classes are loaded 0N/A // and we can handle the constants further down. This case handles 0N/A // both-not-loaded or both-loaded classes 0N/A // Classes require inspection in the Java klass hierarchy. Must be loaded. 0N/A // One of these classes has not been loaded 0N/A // Handle mixing oops and interfaces first. 0N/A // because we need a bottom for the interface hierarchy. 0N/A // Oop meets interface! 0N/A // See if the oop subtypes (implements) interface. 0N/A // Oop indeed subtypes. Now keep oop or interface depending 0N/A // on whether we are both above the centerline or either is 0N/A // below the centerline. If we are on the centerline 0N/A // (e.g., Constant vs. AnyNull interface), use the constant. 0N/A // If we are keeping this_klass, keep its exactness too. 0N/A }
else {
// Does not implement, fall to Object 0N/A // Oop does not implement interface, so mixing falls to Object 0N/A // just like the verifier does (if both are above the 0N/A // centerline fall to interface) 0N/A // Watch out for Constant vs. AnyNull interface. 0N/A // Find out which constant. 0N/A // Either oop vs oop or interface vs interface or interface vs Object 0N/A // !!! Here's how the symmetry requirement breaks down into invariants: 0N/A // If we split one up & one down AND they subtype, take the down man. 0N/A // If we split one up & one down AND they do NOT subtype, "fall hard". 0N/A // If both are up and they subtype, take the subtype class. 0N/A // If both are up and they do NOT subtype, "fall hard". 0N/A // If both are down and they subtype, take the supertype class. 0N/A // If both are down and they do NOT subtype, "fall hard". 0N/A // Constants treated as down. 0N/A // Now, reorder the above list; observe that both-down+subtype is also 0N/A // "fall hard"; "fall hard" becomes the default case: 0N/A // If we split one up & one down AND they subtype, take the down man. 0N/A // If both are up and they subtype, take the subtype class. 0N/A // If both are down and they subtype, "fall hard". 0N/A // If both are down and they do NOT subtype, "fall hard". 0N/A // If both are up and they do NOT subtype, "fall hard". 0N/A // If we split one up & one down AND they do NOT subtype, "fall hard". 0N/A // If a proper subtype is exact, and we return it, we return it exactly. 0N/A // If a proper supertype is exact, there can be no subtyping relationship! 0N/A // If both types are equal to the subtype, exactness is and-ed below the 0N/A // centerline and or-ed above it. (N.B. Constants are always exact.) 0N/A // Check for subtyping: 0N/A // Check for classes now being equal 0N/A // If the klasses are equal, the constants may still differ. Fall to 0N/A // NotNull if they do (neither constant is NULL; that is a special case 0N/A // handled elsewhere). 0N/A }
// Else classes are not equal 0N/A // Since klasses are different, we require a LCA in the Java 0N/A // class hierarchy - which means we have to fall to at least NotNull. 0N/A // Now we find the LCA of Java classes 0N/A }
// End of case InstPtr 0N/A return this;
// Return the double constant 0N/A//------------------------java_mirror_type-------------------------------------- 0N/A // must be a singleton type 0N/A // must be of type java.lang.Class 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: do NOT dual on klasses. This means I do NOT understand the Java 605N/A// inheritance mechanism. 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------dump2------------------------------------------ 0N/A // Print the name of the klass. 0N/A // TO DO: Make CI print the hex address of the underlying oop. 0N/A//------------------------------add_offset------------------------------------- 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------make------------------------------------------- 0N/A "integral arrays must be pre-equipped with a class");
0N/A//------------------------------make------------------------------------------- 0N/A "integral arrays must be pre-equipped with a class");
0N/A//------------------------------cast_to_ptr_type------------------------------- 0N/A//-----------------------------cast_to_exactness------------------------------- 247N/A//-----------------------------cast_to_instance_id---------------------------- 0N/A//-----------------------------narrow_size_type------------------------------- 0N/A// Local cache for arrayOopDesc::max_array_length(etype), 0N/A// which is kind of slow (and cached elsewhere by other users). 0N/A// Narrow the given size type to the index range for the given array base type. 0N/A// Return NULL if the resulting int type becomes empty. 0N/A //if (index_not_size) --max_hi; // type of a valid array index, FTR 605N/A // Negative length arrays will produce weird intermediate dead fast-path code 0N/A//-------------------------------cast_to_size---------------------------------- 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is Pointer 0N/A switch (t->
base()) {
// switch on original type 0N/A // Mixing ints & oops happens when javac reuses local variables 0N/A default:
// All else is a mistake 0N/A // Found a OopPtr type vs self-AryPtr type 0N/A // Found an AnyPtr type vs self-AryPtr type 223N/A // else fall through to AnyNull 0N/A // Integral array element types have irrelevant lattice relations. 0N/A // It is the klass that determines array layout, not the element type. 0N/A // Something like byte[int+] meets char[int+]. 0N/A // This must fall to bottom, not (int[-128..65535])[int+]. 2198N/A }
else // Non integral arrays. 2198N/A // Must fall to bottom if exact klasses in upper lattice 2198N/A // are not equal or super klass is exact. 2198N/A // meet with top[] and bottom[] are processed further down: 2198N/A // both are exact and not equal: 2198N/A // 'tap' is exact and super or unrelated: 2198N/A // 'this' is exact and super or unrelated: 0N/A // Compute new klass on demand, do not use tap->_klass 1685N/A // Only precise for identical arrays 0N/A // Compute new klass on demand, do not use tap->_klass 0N/A // All arrays inherit from Object class 0N/A case AnyNull:
// Fall 'down' to dual of object klass 0N/A // cannot subclass, so the meet has to fall badly below the centerline 0N/A // LCA is object_klass, but if we subclass from the top we can do better 0N/A // If 'tp' is above the centerline and it is Object class 605N/A // then we can subclass in the Java class hierarchy. 0N/A // that is, my array type is a subtype of 'tp' klass 0N/A // The other case cannot happen, since t cannot be a subtype of an array. 0N/A // The meet falls down to Object class below centerline. 0N/A return this;
// Lint noise 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: compute field-by-field dual 820N/A//----------------------interface_vs_oop--------------------------------------- 0N/A//------------------------------dump2------------------------------------------ 0N/A//------------------------------add_offset------------------------------------- 0N/A//============================================================================= 113N/A//------------------------------hash------------------------------------------- 113N/A// Type-specific hashing function. 293N/A//------------------------------xmeet------------------------------------------ 113N/A// Compute the MEET of two types. It returns a new Type object. 113N/A // Perform a fast test for common case; meeting the same types together. 113N/A if(
this == t )
return this;
// Meeting same type-rep? 113N/A // Current "this->_base" is OopPtr 113N/A switch (t->
base()) {
// switch on original type 113N/A case Int:
// Mixing ints & oops happens when javac 113N/A default:
// All else is a mistake 113N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A// Not-null object klass or below 0N/A//------------------------------TypeKlasPtr------------------------------------ 0N/A//------------------------------make------------------------------------------- 0N/A// ptr to klass 'k', if Constant, or possibly to a sub-klass if not a Constant 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 1681N/A//----------------------compute_klass------------------------------------------ 1681N/A// Compute the defining klass for this class 1681N/A // Compute _klass based on element type. 0N/A // Get element klass 0N/A // Compute array klass from element klass 0N/A // Compute array klass from element klass 0N/A // If element type is something like bottom[], k_elem will be null. 0N/A // element type of Bottom occurs from meet of basic type 0N/A // and object; Top occurs when doing join on Bottom. 0N/A // Leave k_ary at NULL. 0N/A // Cannot compute array klass directly from basic type, 0N/A // since subtypes of TypeInt all have basic type T_INT. 1681N/A // Check simple cases when verifying klass. 0N/A "integral arrays must be pre-equipped with a class");
0N/A // Compute array klass directly from basic type 1681N/A//------------------------------klass------------------------------------------ 1681N/A// Return the defining klass for this class 1681N/A // Oops, need to compute _klass and cache it 0N/A // The _klass field acts as a cache of the underlying 0N/A // ciKlass for this array type. In order to set the field, 0N/A // we need to cast away const-ness. 0N/A // IMPORTANT NOTE: we *never* set the _klass field for the 0N/A // type TypeAryPtr::OOPS. This Type is shared between all 0N/A // active compilations. However, the ciKlass which represents 0N/A // this Type is *not* shared between compilations, so caching 0N/A // this value would result in fetching a dangling pointer. 0N/A // Recomputing the underlying ciKlass for each request is 0N/A // a bit less efficient than caching, but calls to 0N/A // TypeAryPtr::OOPS->klass() are not common enough to matter. 0N/A//------------------------------add_offset------------------------------------- 0N/A// Access internals of klass object 0N/A//------------------------------cast_to_ptr_type------------------------------- 0N/A//-----------------------------cast_to_exactness------------------------------- 0N/A//-----------------------------as_instance_type-------------------------------- 0N/A// Corresponding type for an instance of the given class. 0N/A// It will be NotNull, and exact if and only if the klass type is exact. 0N/A //return TypeInstPtr::make(TypePtr::NotNull, k, xk, NULL, 0); 0N/A//------------------------------xmeet------------------------------------------ 0N/A// Compute the MEET of two types, return a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is Pointer 0N/A switch (t->
base()) {
// switch on original type 0N/A case Int:
// Mixing ints & oops happens when javac 0N/A case Long:
// reuses local variables 0N/A default:
// All else is a mistake 0N/A // Found a OopPtr type vs self-KlassPtr type 0N/A // Found an AnyPtr type vs self-KlassPtr type 0N/A // B-top A-any C-top } 0N/A // | / | \ | } Any-nulls 0N/A // B-con A-con C-con } constants; not comparable across classes 0N/A // | \ | / | } not-nulls 0N/A // B-bot A-not C-bot } 0N/A // Check for easy case; klasses are equal (and perhaps not loaded!) 0N/A // If we have constants, then we created oops so classes are loaded 0N/A // and we can handle the constants further down. This case handles 0N/A // not-loaded classes 0N/A // Classes require inspection in the Java klass hierarchy. Must be loaded. 0N/A // If 'this' type is above the centerline and is a superclass of the 0N/A // other, we can treat 'this' as having the same type as the other. 0N/A // If 'tinst' type is above the centerline and is a superclass of the 0N/A // other, we can treat 'tinst' as having the same type as the other. 0N/A // Check for classes now being equal 0N/A // If the klasses are equal, the constants may still differ. Fall to 0N/A // NotNull if they do (neither constant is NULL; that is a special case 0N/A // handled elsewhere). 0N/A }
// Else classes are not equal 0N/A // Since klasses are different, we require the LCA in the Java 0N/A // class hierarchy - which means we have to fall to at least NotNull. 0N/A // Now we find the LCA of Java classes 0N/A }
// End of case KlassPtr 0N/A return this;
// Return the double constant 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: compute field-by-field dual 0N/A//------------------------------dump2------------------------------------------ 0N/A//============================================================================= 0N/A// Convenience common pre-built types. 0N/A//------------------------------make------------------------------------------- 0N/A//------------------------------make------------------------------------------- 0N/A if (
tf !=
NULL)
return tf;
// The hit rate here is almost 50%. 0N/A//------------------------------meet------------------------------------------- 0N/A// Compute the MEET of two types. It returns a new Type object. 0N/A // Perform a fast test for common case; meeting the same types together. 0N/A if(
this == t )
return this;
// Meeting same type-rep? 0N/A // Current "this->_base" is Func 0N/A switch (t->
base()) {
// switch on original type 0N/A default:
// All else is a mistake 0N/A return this;
// Return the double constant 0N/A//------------------------------xdual------------------------------------------ 0N/A// Dual: compute field-by-field dual 0N/A//------------------------------eq--------------------------------------------- 0N/A// Structural equality check for Type representations 0N/A//------------------------------hash------------------------------------------- 0N/A// Type-specific hashing function. 0N/A//------------------------------dump2------------------------------------------ 0N/A// Dump Function Type 0N/A if( !
depth || d[
this] ) {
// Check for recursive dump 0N/A d.
Insert((
void*)
this,(
void*)
this);
// Stop recursion 0N/A//------------------------------print_flattened-------------------------------- 0N/A// Print a 'flattened' signature 113N/A "bad",
"control",
"top",
"int",
"long",
"_",
"narrowoop",
3845N/A "tuple:",
"array:",
"vectors:",
"vectord:",
"vectorx:",
"vectory:",
0N/A "ptr",
"rawptr",
"ptr",
"ptr",
"ptr",
"ptr",
0N/A "func",
"abIO",
"return_address",
"mem",
0N/A "float_top",
"ftcon:",
"flt",
0N/A "double_top",
"dblcon:",
"dbl",
0N/A//------------------------------singleton-------------------------------------- 0N/A// TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 0N/A// constants (Ldi nodes). Singletons are integer, float or double constants 0N/A// or a single symbol. 0N/A return false;
// Never a singleton 0N/A return false;
// Never empty