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// This class defines a Type lattice. The lattice is used in the constant 0N/A// propagation algorithms, and for some type-checking of the iloc code. 0N/A// Basic types include RSD's (lower bound, upper bound, stride for integers), 0N/A// float & double precision constants, sets of data-labels and code-labels. 0N/A// The complete lattice is described below. Subtypes have no relationship to 0N/A// up or down in the lattice; that is entirely determined by the behavior of 0N/A//------------------------------Type------------------------------------------- 0N/A// Basic Type object, represents a set of primitive Values. 0N/A// Types are hash-cons'd into a private class dictionary, so only one of each 0N/A// different kind of Type exists. Types are never modified after creation, so 0N/A// all their interesting fields are constant. 0N/A Long,
// Long integer range (lo-hi) 0N/A Half,
// Placeholder half of doubleword 0N/A Tuple,
// Method signature or object layout 0N/A AnyPtr,
// Any old raw, klass, inst, or array pointer 0N/A // (Ptr order matters: See is_ptr, isa_ptr, is_oopptr, isa_oopptr.) 0N/A // Signal values for offsets from a base pointer 0N/A // Min and max WIDEN values. 0N/A // Dictionary of types shared among compilations. 0N/A // Structural equality check. Assumes that cmp() has already compared 0N/A // the _base types and thus knows it can cast 't' appropriately. 0N/A // Top-level hash-table of types 0N/A // DUAL operation: reflect around lattice centerline. Used instead of 0N/A // join to ensure my lattice is symmetric up and down. Dual is computed 0N/A // lazily, on demand, and cached in _dual. 0N/A // Table for efficient dualing of base types 0N/A // Each class of type is also identified by its base. 0N/A // ~Type(); // Use fast deallocation 0N/A inline void operator delete(
void*
ptr ) {
0N/A // Initialize the type system for a particular compilation. 0N/A // Initialize the types shared by all compilations. 0N/A // Create a new hash-consd type 0N/A // Test for equivalence of types 0N/A // Test for higher or equal in lattice 0N/A // MEET operation; lower in lattice. 0N/A // WIDEN: 'widens' for Ints and other range types 0N/A // NARROW: complement for widen, used by pessimistic phases 0N/A // DUAL operation: reflect around lattice centerline. Used instead of 0N/A // join to ensure my lattice is symmetric up and down. 0N/A // Compute meet dependent on base type 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // JOIN operation; higher in lattice. Done by finding the dual of the 0N/A // meet of the dual of the 2 inputs. 0N/A // Modified version of JOIN adapted to the needs Node::Value. 0N/A // Normalizes all empty values to TOP. Does not kill _widen bits. 0N/A // Currently, it also works around limitations involving interface types. 820N/A // One type is interface, the other is oop 113N/A // Returns true if this pointer points at memory which contains a 163N/A // compressed oop references. 0N/A // Convenience access 0N/A virtual bool is_nan()
const;
// Is not a number (NaN) 221N/A // Returns this ptr type or the equivalent ptr type for this compressed pointer. 827N/A // Returns this oopptr type or the equivalent oopptr type for this compressed pointer. 827N/A // Asserts if the underlying type is not an oopptr or narrowoop. 221N/A // Returns this compressed pointer or the equivalent compressed version 221N/A // of this pointer type. 0N/A // Special test for register pressure heuristic 0N/A // Do you have memory, directly or through a tuple? 0N/A // Are you a pointer type or not? 0N/A // TRUE if type is a singleton 0N/A // TRUE if type is above the lattice centerline, and is therefore vacuous 0N/A // Return a hash for this type. The hash function is public so ConNode 0N/A // (constants) can hash on their constant, which is represented by a Type. 0N/A // Map ideal registers (machine types) to ideal types 0N/A // Printing, statistics 0N/A // Create basic type 0N/A // Mapping to the array element's basic type. 0N/A // Create standard type for a ciType: 0N/A // Create standard zero value: 0N/A // Report if this is a zero value (not top). 0N/A // Convenience common pre-built types. 0N/A // Mapping from compiler type to VM BasicType 0N/A // Mapping from CI type system to compiler type: 0N/A//------------------------------TypeF------------------------------------------ 0N/A// Class of Float-Constant Types. 0N/A virtual int hash()
const;
// Type specific hashing 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A const float _f;
// Float constant 0N/A virtual bool is_nan()
const;
// Is not a number (NaN) 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Convenience common pre-built types. 0N/A//------------------------------TypeD------------------------------------------ 0N/A// Class of Double-Constant Types. 0N/A virtual int hash()
const;
// Type specific hashing 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A const double _d;
// Double constant 0N/A virtual bool is_nan()
const;
// Is not a number (NaN) 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Convenience common pre-built types. 0N/A//------------------------------TypeInt---------------------------------------- 0N/A// Class of integer ranges, the set of integers between a lower bound and an 0N/A// upper bound, inclusive. 0N/A virtual int hash()
const;
// Type specific hashing 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A const short _widen;
// Limit on times we widen this sucker 0N/A // must always specify w 0N/A // Check for single integer 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Do not kill _widen bits. 0N/A // Convenience common pre-built types. 0N/A//------------------------------TypeLong--------------------------------------- 0N/A// Class of long integer ranges, the set of integers between a lower bound and 0N/A// an upper bound, inclusive. 0N/A virtual int hash()
const;
// Type specific hashing 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A const short _widen;
// Limit on times we widen this sucker 0N/A // must always specify w 0N/A // Check for single integer 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Do not kill _widen bits. 0N/A // Convenience common pre-built types. 0N/A//------------------------------TypeTuple-------------------------------------- 0N/A// Class of Tuple Types, essentially type collections for function signatures 0N/A// and class layouts. It happens to also be a fast cache for the HotSpot 0N/A virtual int hash()
const;
// Type specific hashing 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A // Subroutine call type with space allocated for argument types 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Convenience common pre-built types. 0N/A//------------------------------TypeAry---------------------------------------- 0N/A// Class of Array Types 0N/A virtual int hash()
const;
// Type specific hashing 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 820N/A // One type is interface, the other is oop 3845N/A//------------------------------TypeVect--------------------------------------- 3845N/A virtual int hash()
const;
// Type specific hashing 3845N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 3845N/A // Use bottom primitive type. 3845N/A // Used directly by Replicate nodes to construct singleton vector. 0N/A//------------------------------TypePtr---------------------------------------- 0N/A// Class of machine Pointer Types: raw data, instances or arrays. 0N/A// If the _base enum is AnyPtr, then this refers to all of the above. 0N/A// Otherwise the _base will indicate which subset of pointers is affected, 0N/A// and the class will be inherited from. 0N/A virtual int hash()
const;
// Type specific hashing 0N/A const int _offset;
// Offset into oop, with TOP & BOT 0N/A // Return a 'ptr' version of this type 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // meet, dual and join over pointer equivalence sets 0N/A // This is textually confusing unless one recalls that 0N/A // join(t) == dual()->meet(t->dual())->dual(). 0N/A // Tests for relation to centerline of type lattice: 0N/A // Convenience common pre-built types. 0N/A//------------------------------TypeRawPtr------------------------------------- 0N/A// Class of raw pointers, pointers to things other than Oops. Examples 0N/A// include the stack pointer, top of heap, card-marking area, handles, etc. 0N/A virtual int hash()
const;
// Type specific hashing 0N/A // Return a 'ptr' version of this type 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Convenience common pre-built types. 0N/A//------------------------------TypeOopPtr------------------------------------- 0N/A// Some kind of oop (Java pointer), either klass or instance or array. 0N/A virtual int hash()
const;
// Type specific hashing 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A // Oop is NULL, unless this is a constant oop. 0N/A // If _klass is NULL, then so is _sig. This is an unloaded klass. 0N/A // Does the type exclude subclasses of the klass? (Inexact == polymorphic.) 223N/A // If not InstanceTop or InstanceBot, indicates that this is 223N/A // a particular instance of this type which is distinct. 223N/A // This is the the node index of the allocation node creating this instance. 0N/A // Creates a type given a klass. Correctly handles multi-dimensional arrays 0N/A // Respects UseUniqueSubclasses. 0N/A // If the klass is final, the resulting type will be exact. 0N/A // Same as before, but will produce an exact type, even if 0N/A // the klass is not final, as long as it has exactly one implementation. 0N/A // Same as before, but does not respects UseUniqueSubclasses. 0N/A // Use this only for creating array element types. 0N/A // Creates a singleton type given an object. 989N/A // If the object cannot be rendered as a constant, 989N/A // may return a non-singleton type. 989N/A // If require_constant, produce a NULL if a singleton is not possible. 0N/A // Make a generic (unclassed) pointer to an oop. 163N/A // Returns true if this pointer points at memory which contains a 163N/A // compressed oop references. 0N/A // corresponding pointer to klass, for a given instance 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Do not allow interface-vs.-noninterface joins to collapse to top. 0N/A // Convenience common pre-built type. 0N/A//------------------------------TypeInstPtr------------------------------------ 0N/A// Class of Java object pointers, pointing either to non-array Java instances 0N/A// or to a klassOop (including array klasses). 0N/A virtual int hash()
const;
// Type specific hashing 0N/A // Make a pointer to a constant oop. 0N/A // Make a pointer to a constant oop with offset. 0N/A // Make a pointer to some value of type klass. 0N/A // Make a pointer to some non-polymorphic value of exactly type klass. 0N/A // Make a pointer to some value of type klass with offset. 0N/A // Make a pointer to an oop. 0N/A // If this is a java.lang.Class constant, return the type for it or NULL. 0N/A // Pass to Type::get_const_type to turn it to a type, which will usually 0N/A // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc. 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Convenience common pre-built types. 0N/A//------------------------------TypeAryPtr------------------------------------- 0N/A// Class of Java array pointers 1681N/A TypeAryPtr(
PTR ptr,
ciObject* o,
const TypeAry *
ary,
ciKlass* k,
bool xk,
int offset,
int instance_id ) :
TypeOopPtr(
AryPtr,
ptr,k,
xk,o,
offset,
instance_id),
_ary(
ary) {
1681N/A // Verify that specified klass and TypeAryPtr::klass() follow the same rules. 0N/A virtual int hash()
const;
// Type specific hashing 0N/A // Constant pointer to array 0N/A // Return a 'ptr' version of this type 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Convenience common pre-built types. 0N/A // selects one of the above: 0N/A // sharpen the type of an int which is used as an array size 820N/A // One type is interface, the other is oop 0N/A//------------------------------TypeKlassPtr----------------------------------- 0N/A// Class of Java Klass pointers 0N/A virtual int hash()
const;
// Type specific hashing 0N/A // ptr to klass 'k' with offset 0N/A // ptr to klass 'k' or sub-klass 0N/A // corresponding pointer to instance, for a given class 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Convenience common pre-built types. 163N/A//------------------------------TypeNarrowOop---------------------------------- 113N/A// A compressed reference to some kind of Oop. This type wraps around 113N/A// a preexisting TypeOopPtr and forwards most of it's operations to 113N/A// the underlying type. It's only real purpose is to track the 113N/A// oopness of the compressed oop value when we expose the conversion 113N/A// between the normal and the compressed form. 113N/A virtual int hash()
const;
// Type specific hashing 113N/A // Do not allow interface-vs.-noninterface joins to collapse to top. 113N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 221N/A // returns the equivalent ptr type for this compressed pointer 0N/A//------------------------------TypeFunc--------------------------------------- 0N/A// Class of Array Types 0N/A virtual int hash()
const;
// Type specific hashing 0N/A virtual bool singleton(
void)
const;
// TRUE if type is a singleton 0N/A virtual bool empty(
void)
const;
// TRUE if type is vacuous 0N/A // Constants are shared among ADLC and VM 0N/A virtual const Type *
xdual()
const;
// Compute dual right now. 0N/A // Convenience common pre-built types. 0N/A//------------------------------accessors-------------------------------------- 0N/A // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. 0N/A // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between. 0N/A // OopPtr is the first and KlassPtr the last, with no non-oops between. 0N/A // OopPtr is the first and KlassPtr the last, with no non-oops between. 113N/A // OopPtr is the first and KlassPtr the last, with no non-oops between. 113N/A // OopPtr is the first and KlassPtr the last, with no non-oops between. 0N/A// =============================================================== 0N/A// Things that need to be 64-bits in the 64-bit build but 0N/A// 32-bits in the 32-bit build. Done this way to get full 0N/A// optimization AND strong typing. 0N/A// For type queries and asserts 0N/A// For 'ideal_reg' machine registers 0N/A// For phase->intcon variants 0N/A// For array index arithmetic 0N/A// For object size computation: 0N/A// For card marks and hashcodes 0N/A// For type queries and asserts 0N/A// For 'ideal_reg' machine registers 0N/A// For phase->intcon variants 0N/A// For array index arithmetic 0N/A// For object size computation: 0N/A// For card marks and hashcodes 1879N/A#
endif // SHARE_VM_OPTO_TYPE_HPP