src/share/vm/opto/type.hpp

Tue, 23 Jun 2009 17:52:29 -0700

author
kvn
date
Tue, 23 Jun 2009 17:52:29 -0700
changeset 1255
915cc9c5ebc6
parent 1063
7bb995fbd3c0
child 1262
bf3489cc0aa0
permissions
-rw-r--r--

6837094: False positive for "meet not symmetric" failure
Summary: Have the meet not symmetric check recursively do the interface-vs-oop check on array subtypes.
Reviewed-by: jrose
Contributed-by: rasbold@google.com

     1 /*
     2  * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 // Portions of code courtesy of Clifford Click
    27 // Optimization - Graph Style
    30 // This class defines a Type lattice.  The lattice is used in the constant
    31 // propagation algorithms, and for some type-checking of the iloc code.
    32 // Basic types include RSD's (lower bound, upper bound, stride for integers),
    33 // float & double precision constants, sets of data-labels and code-labels.
    34 // The complete lattice is described below.  Subtypes have no relationship to
    35 // up or down in the lattice; that is entirely determined by the behavior of
    36 // the MEET/JOIN functions.
    38 class Dict;
    39 class Type;
    40 class   TypeD;
    41 class   TypeF;
    42 class   TypeInt;
    43 class   TypeLong;
    44 class   TypeNarrowOop;
    45 class   TypeAry;
    46 class   TypeTuple;
    47 class   TypePtr;
    48 class     TypeRawPtr;
    49 class     TypeOopPtr;
    50 class       TypeInstPtr;
    51 class       TypeAryPtr;
    52 class       TypeKlassPtr;
    54 //------------------------------Type-------------------------------------------
    55 // Basic Type object, represents a set of primitive Values.
    56 // Types are hash-cons'd into a private class dictionary, so only one of each
    57 // different kind of Type exists.  Types are never modified after creation, so
    58 // all their interesting fields are constant.
    59 class Type {
    60 public:
    61   enum TYPES {
    62     Bad=0,                      // Type check
    63     Control,                    // Control of code (not in lattice)
    64     Top,                        // Top of the lattice
    65     Int,                        // Integer range (lo-hi)
    66     Long,                       // Long integer range (lo-hi)
    67     Half,                       // Placeholder half of doubleword
    68     NarrowOop,                  // Compressed oop pointer
    70     Tuple,                      // Method signature or object layout
    71     Array,                      // Array types
    73     AnyPtr,                     // Any old raw, klass, inst, or array pointer
    74     RawPtr,                     // Raw (non-oop) pointers
    75     OopPtr,                     // Any and all Java heap entities
    76     InstPtr,                    // Instance pointers (non-array objects)
    77     AryPtr,                     // Array pointers
    78     KlassPtr,                   // Klass pointers
    79     // (Ptr order matters:  See is_ptr, isa_ptr, is_oopptr, isa_oopptr.)
    81     Function,                   // Function signature
    82     Abio,                       // Abstract I/O
    83     Return_Address,             // Subroutine return address
    84     Memory,                     // Abstract store
    85     FloatTop,                   // No float value
    86     FloatCon,                   // Floating point constant
    87     FloatBot,                   // Any float value
    88     DoubleTop,                  // No double value
    89     DoubleCon,                  // Double precision constant
    90     DoubleBot,                  // Any double value
    91     Bottom,                     // Bottom of lattice
    92     lastype                     // Bogus ending type (not in lattice)
    93   };
    95   // Signal values for offsets from a base pointer
    96   enum OFFSET_SIGNALS {
    97     OffsetTop = -2000000000,    // undefined offset
    98     OffsetBot = -2000000001     // any possible offset
    99   };
   101   // Min and max WIDEN values.
   102   enum WIDEN {
   103     WidenMin = 0,
   104     WidenMax = 3
   105   };
   107 private:
   108   // Dictionary of types shared among compilations.
   109   static Dict* _shared_type_dict;
   111   static int uhash( const Type *const t );
   112   // Structural equality check.  Assumes that cmp() has already compared
   113   // the _base types and thus knows it can cast 't' appropriately.
   114   virtual bool eq( const Type *t ) const;
   116   // Top-level hash-table of types
   117   static Dict *type_dict() {
   118     return Compile::current()->type_dict();
   119   }
   121   // DUAL operation: reflect around lattice centerline.  Used instead of
   122   // join to ensure my lattice is symmetric up and down.  Dual is computed
   123   // lazily, on demand, and cached in _dual.
   124   const Type *_dual;            // Cached dual value
   125   // Table for efficient dualing of base types
   126   static const TYPES dual_type[lastype];
   128 protected:
   129   // Each class of type is also identified by its base.
   130   const TYPES _base;            // Enum of Types type
   132   Type( TYPES t ) : _dual(NULL),  _base(t) {} // Simple types
   133   // ~Type();                   // Use fast deallocation
   134   const Type *hashcons();       // Hash-cons the type
   136 public:
   138   inline void* operator new( size_t x ) {
   139     Compile* compile = Compile::current();
   140     compile->set_type_last_size(x);
   141     void *temp = compile->type_arena()->Amalloc_D(x);
   142     compile->set_type_hwm(temp);
   143     return temp;
   144   }
   145   inline void operator delete( void* ptr ) {
   146     Compile* compile = Compile::current();
   147     compile->type_arena()->Afree(ptr,compile->type_last_size());
   148   }
   150   // Initialize the type system for a particular compilation.
   151   static void Initialize(Compile* compile);
   153   // Initialize the types shared by all compilations.
   154   static void Initialize_shared(Compile* compile);
   156   TYPES base() const {
   157     assert(_base > Bad && _base < lastype, "sanity");
   158     return _base;
   159   }
   161   // Create a new hash-consd type
   162   static const Type *make(enum TYPES);
   163   // Test for equivalence of types
   164   static int cmp( const Type *const t1, const Type *const t2 );
   165   // Test for higher or equal in lattice
   166   int higher_equal( const Type *t ) const { return !cmp(meet(t),t); }
   168   // MEET operation; lower in lattice.
   169   const Type *meet( const Type *t ) const;
   170   // WIDEN: 'widens' for Ints and other range types
   171   virtual const Type *widen( const Type *old ) const { return this; }
   172   // NARROW: complement for widen, used by pessimistic phases
   173   virtual const Type *narrow( const Type *old ) const { return this; }
   175   // DUAL operation: reflect around lattice centerline.  Used instead of
   176   // join to ensure my lattice is symmetric up and down.
   177   const Type *dual() const { return _dual; }
   179   // Compute meet dependent on base type
   180   virtual const Type *xmeet( const Type *t ) const;
   181   virtual const Type *xdual() const;    // Compute dual right now.
   183   // JOIN operation; higher in lattice.  Done by finding the dual of the
   184   // meet of the dual of the 2 inputs.
   185   const Type *join( const Type *t ) const {
   186     return dual()->meet(t->dual())->dual(); }
   188   // Modified version of JOIN adapted to the needs Node::Value.
   189   // Normalizes all empty values to TOP.  Does not kill _widen bits.
   190   // Currently, it also works around limitations involving interface types.
   191   virtual const Type *filter( const Type *kills ) const;
   193 #ifdef ASSERT
   194   // One type is interface, the other is oop
   195   virtual bool interface_vs_oop(const Type *t) const;
   196 #endif
   198   // Returns true if this pointer points at memory which contains a
   199   // compressed oop references.
   200   bool is_ptr_to_narrowoop() const;
   202   // Convenience access
   203   float getf() const;
   204   double getd() const;
   206   const TypeInt    *is_int() const;
   207   const TypeInt    *isa_int() const;             // Returns NULL if not an Int
   208   const TypeLong   *is_long() const;
   209   const TypeLong   *isa_long() const;            // Returns NULL if not a Long
   210   const TypeD      *is_double_constant() const;  // Asserts it is a DoubleCon
   211   const TypeD      *isa_double_constant() const; // Returns NULL if not a DoubleCon
   212   const TypeF      *is_float_constant() const;   // Asserts it is a FloatCon
   213   const TypeF      *isa_float_constant() const;  // Returns NULL if not a FloatCon
   214   const TypeTuple  *is_tuple() const;            // Collection of fields, NOT a pointer
   215   const TypeAry    *is_ary() const;              // Array, NOT array pointer
   216   const TypePtr    *is_ptr() const;              // Asserts it is a ptr type
   217   const TypePtr    *isa_ptr() const;             // Returns NULL if not ptr type
   218   const TypeRawPtr *isa_rawptr() const;          // NOT Java oop
   219   const TypeRawPtr *is_rawptr() const;           // Asserts is rawptr
   220   const TypeNarrowOop  *is_narrowoop() const;    // Java-style GC'd pointer
   221   const TypeNarrowOop  *isa_narrowoop() const;   // Returns NULL if not oop ptr type
   222   const TypeOopPtr   *isa_oopptr() const;        // Returns NULL if not oop ptr type
   223   const TypeOopPtr   *is_oopptr() const;         // Java-style GC'd pointer
   224   const TypeKlassPtr *isa_klassptr() const;      // Returns NULL if not KlassPtr
   225   const TypeKlassPtr *is_klassptr() const;       // assert if not KlassPtr
   226   const TypeInstPtr  *isa_instptr() const;       // Returns NULL if not InstPtr
   227   const TypeInstPtr  *is_instptr() const;        // Instance
   228   const TypeAryPtr   *isa_aryptr() const;        // Returns NULL if not AryPtr
   229   const TypeAryPtr   *is_aryptr() const;         // Array oop
   230   virtual bool      is_finite() const;           // Has a finite value
   231   virtual bool      is_nan()    const;           // Is not a number (NaN)
   233   // Returns this ptr type or the equivalent ptr type for this compressed pointer.
   234   const TypePtr* make_ptr() const;
   235   // Returns this compressed pointer or the equivalent compressed version
   236   // of this pointer type.
   237   const TypeNarrowOop* make_narrowoop() const;
   239   // Special test for register pressure heuristic
   240   bool is_floatingpoint() const;        // True if Float or Double base type
   242   // Do you have memory, directly or through a tuple?
   243   bool has_memory( ) const;
   245   // Are you a pointer type or not?
   246   bool isa_oop_ptr() const;
   248   // TRUE if type is a singleton
   249   virtual bool singleton(void) const;
   251   // TRUE if type is above the lattice centerline, and is therefore vacuous
   252   virtual bool empty(void) const;
   254   // Return a hash for this type.  The hash function is public so ConNode
   255   // (constants) can hash on their constant, which is represented by a Type.
   256   virtual int hash() const;
   258   // Map ideal registers (machine types) to ideal types
   259   static const Type *mreg2type[];
   261   // Printing, statistics
   262   static const char * const msg[lastype]; // Printable strings
   263 #ifndef PRODUCT
   264   void         dump_on(outputStream *st) const;
   265   void         dump() const {
   266     dump_on(tty);
   267   }
   268   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
   269   static  void dump_stats();
   270   static  void verify_lastype();          // Check that arrays match type enum
   271 #endif
   272   void typerr(const Type *t) const; // Mixing types error
   274   // Create basic type
   275   static const Type* get_const_basic_type(BasicType type) {
   276     assert((uint)type <= T_CONFLICT && _const_basic_type[type] != NULL, "bad type");
   277     return _const_basic_type[type];
   278   }
   280   // Mapping to the array element's basic type.
   281   BasicType array_element_basic_type() const;
   283   // Create standard type for a ciType:
   284   static const Type* get_const_type(ciType* type);
   286   // Create standard zero value:
   287   static const Type* get_zero_type(BasicType type) {
   288     assert((uint)type <= T_CONFLICT && _zero_type[type] != NULL, "bad type");
   289     return _zero_type[type];
   290   }
   292   // Report if this is a zero value (not top).
   293   bool is_zero_type() const {
   294     BasicType type = basic_type();
   295     if (type == T_VOID || type >= T_CONFLICT)
   296       return false;
   297     else
   298       return (this == _zero_type[type]);
   299   }
   301   // Convenience common pre-built types.
   302   static const Type *ABIO;
   303   static const Type *BOTTOM;
   304   static const Type *CONTROL;
   305   static const Type *DOUBLE;
   306   static const Type *FLOAT;
   307   static const Type *HALF;
   308   static const Type *MEMORY;
   309   static const Type *MULTI;
   310   static const Type *RETURN_ADDRESS;
   311   static const Type *TOP;
   313   // Mapping from compiler type to VM BasicType
   314   BasicType basic_type() const { return _basic_type[_base]; }
   316   // Mapping from CI type system to compiler type:
   317   static const Type* get_typeflow_type(ciType* type);
   319 private:
   320   // support arrays
   321   static const BasicType _basic_type[];
   322   static const Type*        _zero_type[T_CONFLICT+1];
   323   static const Type* _const_basic_type[T_CONFLICT+1];
   324 };
   326 //------------------------------TypeF------------------------------------------
   327 // Class of Float-Constant Types.
   328 class TypeF : public Type {
   329   TypeF( float f ) : Type(FloatCon), _f(f) {};
   330 public:
   331   virtual bool eq( const Type *t ) const;
   332   virtual int  hash() const;             // Type specific hashing
   333   virtual bool singleton(void) const;    // TRUE if type is a singleton
   334   virtual bool empty(void) const;        // TRUE if type is vacuous
   335 public:
   336   const float _f;               // Float constant
   338   static const TypeF *make(float f);
   340   virtual bool        is_finite() const;  // Has a finite value
   341   virtual bool        is_nan()    const;  // Is not a number (NaN)
   343   virtual const Type *xmeet( const Type *t ) const;
   344   virtual const Type *xdual() const;    // Compute dual right now.
   345   // Convenience common pre-built types.
   346   static const TypeF *ZERO; // positive zero only
   347   static const TypeF *ONE;
   348 #ifndef PRODUCT
   349   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
   350 #endif
   351 };
   353 //------------------------------TypeD------------------------------------------
   354 // Class of Double-Constant Types.
   355 class TypeD : public Type {
   356   TypeD( double d ) : Type(DoubleCon), _d(d) {};
   357 public:
   358   virtual bool eq( const Type *t ) const;
   359   virtual int  hash() const;             // Type specific hashing
   360   virtual bool singleton(void) const;    // TRUE if type is a singleton
   361   virtual bool empty(void) const;        // TRUE if type is vacuous
   362 public:
   363   const double _d;              // Double constant
   365   static const TypeD *make(double d);
   367   virtual bool        is_finite() const;  // Has a finite value
   368   virtual bool        is_nan()    const;  // Is not a number (NaN)
   370   virtual const Type *xmeet( const Type *t ) const;
   371   virtual const Type *xdual() const;    // Compute dual right now.
   372   // Convenience common pre-built types.
   373   static const TypeD *ZERO; // positive zero only
   374   static const TypeD *ONE;
   375 #ifndef PRODUCT
   376   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
   377 #endif
   378 };
   380 //------------------------------TypeInt----------------------------------------
   381 // Class of integer ranges, the set of integers between a lower bound and an
   382 // upper bound, inclusive.
   383 class TypeInt : public Type {
   384   TypeInt( jint lo, jint hi, int w );
   385 public:
   386   virtual bool eq( const Type *t ) const;
   387   virtual int  hash() const;             // Type specific hashing
   388   virtual bool singleton(void) const;    // TRUE if type is a singleton
   389   virtual bool empty(void) const;        // TRUE if type is vacuous
   390 public:
   391   const jint _lo, _hi;          // Lower bound, upper bound
   392   const short _widen;           // Limit on times we widen this sucker
   394   static const TypeInt *make(jint lo);
   395   // must always specify w
   396   static const TypeInt *make(jint lo, jint hi, int w);
   398   // Check for single integer
   399   int is_con() const { return _lo==_hi; }
   400   bool is_con(int i) const { return is_con() && _lo == i; }
   401   jint get_con() const { assert( is_con(), "" );  return _lo; }
   403   virtual bool        is_finite() const;  // Has a finite value
   405   virtual const Type *xmeet( const Type *t ) const;
   406   virtual const Type *xdual() const;    // Compute dual right now.
   407   virtual const Type *widen( const Type *t ) const;
   408   virtual const Type *narrow( const Type *t ) const;
   409   // Do not kill _widen bits.
   410   virtual const Type *filter( const Type *kills ) const;
   411   // Convenience common pre-built types.
   412   static const TypeInt *MINUS_1;
   413   static const TypeInt *ZERO;
   414   static const TypeInt *ONE;
   415   static const TypeInt *BOOL;
   416   static const TypeInt *CC;
   417   static const TypeInt *CC_LT;  // [-1]  == MINUS_1
   418   static const TypeInt *CC_GT;  // [1]   == ONE
   419   static const TypeInt *CC_EQ;  // [0]   == ZERO
   420   static const TypeInt *CC_LE;  // [-1,0]
   421   static const TypeInt *CC_GE;  // [0,1] == BOOL (!)
   422   static const TypeInt *BYTE;
   423   static const TypeInt *UBYTE;
   424   static const TypeInt *CHAR;
   425   static const TypeInt *SHORT;
   426   static const TypeInt *POS;
   427   static const TypeInt *POS1;
   428   static const TypeInt *INT;
   429   static const TypeInt *SYMINT; // symmetric range [-max_jint..max_jint]
   430 #ifndef PRODUCT
   431   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
   432 #endif
   433 };
   436 //------------------------------TypeLong---------------------------------------
   437 // Class of long integer ranges, the set of integers between a lower bound and
   438 // an upper bound, inclusive.
   439 class TypeLong : public Type {
   440   TypeLong( jlong lo, jlong hi, int w );
   441 public:
   442   virtual bool eq( const Type *t ) const;
   443   virtual int  hash() const;             // Type specific hashing
   444   virtual bool singleton(void) const;    // TRUE if type is a singleton
   445   virtual bool empty(void) const;        // TRUE if type is vacuous
   446 public:
   447   const jlong _lo, _hi;         // Lower bound, upper bound
   448   const short _widen;           // Limit on times we widen this sucker
   450   static const TypeLong *make(jlong lo);
   451   // must always specify w
   452   static const TypeLong *make(jlong lo, jlong hi, int w);
   454   // Check for single integer
   455   int is_con() const { return _lo==_hi; }
   456   bool is_con(int i) const { return is_con() && _lo == i; }
   457   jlong get_con() const { assert( is_con(), "" ); return _lo; }
   459   virtual bool        is_finite() const;  // Has a finite value
   461   virtual const Type *xmeet( const Type *t ) const;
   462   virtual const Type *xdual() const;    // Compute dual right now.
   463   virtual const Type *widen( const Type *t ) const;
   464   virtual const Type *narrow( const Type *t ) const;
   465   // Do not kill _widen bits.
   466   virtual const Type *filter( const Type *kills ) const;
   467   // Convenience common pre-built types.
   468   static const TypeLong *MINUS_1;
   469   static const TypeLong *ZERO;
   470   static const TypeLong *ONE;
   471   static const TypeLong *POS;
   472   static const TypeLong *LONG;
   473   static const TypeLong *INT;    // 32-bit subrange [min_jint..max_jint]
   474   static const TypeLong *UINT;   // 32-bit unsigned [0..max_juint]
   475 #ifndef PRODUCT
   476   virtual void dump2( Dict &d, uint, outputStream *st  ) const;// Specialized per-Type dumping
   477 #endif
   478 };
   480 //------------------------------TypeTuple--------------------------------------
   481 // Class of Tuple Types, essentially type collections for function signatures
   482 // and class layouts.  It happens to also be a fast cache for the HotSpot
   483 // signature types.
   484 class TypeTuple : public Type {
   485   TypeTuple( uint cnt, const Type **fields ) : Type(Tuple), _cnt(cnt), _fields(fields) { }
   486 public:
   487   virtual bool eq( const Type *t ) const;
   488   virtual int  hash() const;             // Type specific hashing
   489   virtual bool singleton(void) const;    // TRUE if type is a singleton
   490   virtual bool empty(void) const;        // TRUE if type is vacuous
   492 public:
   493   const uint          _cnt;              // Count of fields
   494   const Type ** const _fields;           // Array of field types
   496   // Accessors:
   497   uint cnt() const { return _cnt; }
   498   const Type* field_at(uint i) const {
   499     assert(i < _cnt, "oob");
   500     return _fields[i];
   501   }
   502   void set_field_at(uint i, const Type* t) {
   503     assert(i < _cnt, "oob");
   504     _fields[i] = t;
   505   }
   507   static const TypeTuple *make( uint cnt, const Type **fields );
   508   static const TypeTuple *make_range(ciSignature *sig);
   509   static const TypeTuple *make_domain(ciInstanceKlass* recv, ciSignature *sig);
   511   // Subroutine call type with space allocated for argument types
   512   static const Type **fields( uint arg_cnt );
   514   virtual const Type *xmeet( const Type *t ) const;
   515   virtual const Type *xdual() const;    // Compute dual right now.
   516   // Convenience common pre-built types.
   517   static const TypeTuple *IFBOTH;
   518   static const TypeTuple *IFFALSE;
   519   static const TypeTuple *IFTRUE;
   520   static const TypeTuple *IFNEITHER;
   521   static const TypeTuple *LOOPBODY;
   522   static const TypeTuple *MEMBAR;
   523   static const TypeTuple *STORECONDITIONAL;
   524   static const TypeTuple *START_I2C;
   525   static const TypeTuple *INT_PAIR;
   526   static const TypeTuple *LONG_PAIR;
   527 #ifndef PRODUCT
   528   virtual void dump2( Dict &d, uint, outputStream *st  ) const; // Specialized per-Type dumping
   529 #endif
   530 };
   532 //------------------------------TypeAry----------------------------------------
   533 // Class of Array Types
   534 class TypeAry : public Type {
   535   TypeAry( const Type *elem, const TypeInt *size) : Type(Array),
   536     _elem(elem), _size(size) {}
   537 public:
   538   virtual bool eq( const Type *t ) const;
   539   virtual int  hash() const;             // Type specific hashing
   540   virtual bool singleton(void) const;    // TRUE if type is a singleton
   541   virtual bool empty(void) const;        // TRUE if type is vacuous
   543 private:
   544   const Type *_elem;            // Element type of array
   545   const TypeInt *_size;         // Elements in array
   546   friend class TypeAryPtr;
   548 public:
   549   static const TypeAry *make(  const Type *elem, const TypeInt *size);
   551   virtual const Type *xmeet( const Type *t ) const;
   552   virtual const Type *xdual() const;    // Compute dual right now.
   553   bool ary_must_be_exact() const;  // true if arrays of such are never generic
   554 #ifdef ASSERT
   555   // One type is interface, the other is oop
   556   virtual bool interface_vs_oop(const Type *t) const;
   557 #endif
   558 #ifndef PRODUCT
   559   virtual void dump2( Dict &d, uint, outputStream *st  ) const; // Specialized per-Type dumping
   560 #endif
   561 };
   563 //------------------------------TypePtr----------------------------------------
   564 // Class of machine Pointer Types: raw data, instances or arrays.
   565 // If the _base enum is AnyPtr, then this refers to all of the above.
   566 // Otherwise the _base will indicate which subset of pointers is affected,
   567 // and the class will be inherited from.
   568 class TypePtr : public Type {
   569   friend class TypeNarrowOop;
   570 public:
   571   enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR };
   572 protected:
   573   TypePtr( TYPES t, PTR ptr, int offset ) : Type(t), _ptr(ptr), _offset(offset) {}
   574   virtual bool eq( const Type *t ) const;
   575   virtual int  hash() const;             // Type specific hashing
   576   static const PTR ptr_meet[lastPTR][lastPTR];
   577   static const PTR ptr_dual[lastPTR];
   578   static const char * const ptr_msg[lastPTR];
   580 public:
   581   const int _offset;            // Offset into oop, with TOP & BOT
   582   const PTR _ptr;               // Pointer equivalence class
   584   const int offset() const { return _offset; }
   585   const PTR ptr()    const { return _ptr; }
   587   static const TypePtr *make( TYPES t, PTR ptr, int offset );
   589   // Return a 'ptr' version of this type
   590   virtual const Type *cast_to_ptr_type(PTR ptr) const;
   592   virtual intptr_t get_con() const;
   594   int xadd_offset( intptr_t offset ) const;
   595   virtual const TypePtr *add_offset( intptr_t offset ) const;
   597   virtual bool singleton(void) const;    // TRUE if type is a singleton
   598   virtual bool empty(void) const;        // TRUE if type is vacuous
   599   virtual const Type *xmeet( const Type *t ) const;
   600   int meet_offset( int offset ) const;
   601   int dual_offset( ) const;
   602   virtual const Type *xdual() const;    // Compute dual right now.
   604   // meet, dual and join over pointer equivalence sets
   605   PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; }
   606   PTR dual_ptr()                   const { return ptr_dual[ptr()];      }
   608   // This is textually confusing unless one recalls that
   609   // join(t) == dual()->meet(t->dual())->dual().
   610   PTR join_ptr( const PTR in_ptr ) const {
   611     return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ];
   612   }
   614   // Tests for relation to centerline of type lattice:
   615   static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); }
   616   static bool below_centerline(PTR ptr) { return (ptr >= NotNull); }
   617   // Convenience common pre-built types.
   618   static const TypePtr *NULL_PTR;
   619   static const TypePtr *NOTNULL;
   620   static const TypePtr *BOTTOM;
   621 #ifndef PRODUCT
   622   virtual void dump2( Dict &d, uint depth, outputStream *st  ) const;
   623 #endif
   624 };
   626 //------------------------------TypeRawPtr-------------------------------------
   627 // Class of raw pointers, pointers to things other than Oops.  Examples
   628 // include the stack pointer, top of heap, card-marking area, handles, etc.
   629 class TypeRawPtr : public TypePtr {
   630 protected:
   631   TypeRawPtr( PTR ptr, address bits ) : TypePtr(RawPtr,ptr,0), _bits(bits){}
   632 public:
   633   virtual bool eq( const Type *t ) const;
   634   virtual int  hash() const;     // Type specific hashing
   636   const address _bits;          // Constant value, if applicable
   638   static const TypeRawPtr *make( PTR ptr );
   639   static const TypeRawPtr *make( address bits );
   641   // Return a 'ptr' version of this type
   642   virtual const Type *cast_to_ptr_type(PTR ptr) const;
   644   virtual intptr_t get_con() const;
   646   virtual const TypePtr *add_offset( intptr_t offset ) const;
   648   virtual const Type *xmeet( const Type *t ) const;
   649   virtual const Type *xdual() const;    // Compute dual right now.
   650   // Convenience common pre-built types.
   651   static const TypeRawPtr *BOTTOM;
   652   static const TypeRawPtr *NOTNULL;
   653 #ifndef PRODUCT
   654   virtual void dump2( Dict &d, uint depth, outputStream *st  ) const;
   655 #endif
   656 };
   658 //------------------------------TypeOopPtr-------------------------------------
   659 // Some kind of oop (Java pointer), either klass or instance or array.
   660 class TypeOopPtr : public TypePtr {
   661 protected:
   662   TypeOopPtr( TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id );
   663 public:
   664   virtual bool eq( const Type *t ) const;
   665   virtual int  hash() const;             // Type specific hashing
   666   virtual bool singleton(void) const;    // TRUE if type is a singleton
   667   enum {
   668    InstanceTop = -1,   // undefined instance
   669    InstanceBot = 0     // any possible instance
   670   };
   671 protected:
   673   // Oop is NULL, unless this is a constant oop.
   674   ciObject*     _const_oop;   // Constant oop
   675   // If _klass is NULL, then so is _sig.  This is an unloaded klass.
   676   ciKlass*      _klass;       // Klass object
   677   // Does the type exclude subclasses of the klass?  (Inexact == polymorphic.)
   678   bool          _klass_is_exact;
   679   bool          _is_ptr_to_narrowoop;
   681   // If not InstanceTop or InstanceBot, indicates that this is
   682   // a particular instance of this type which is distinct.
   683   // This is the the node index of the allocation node creating this instance.
   684   int           _instance_id;
   686   static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact);
   688   int dual_instance_id() const;
   689   int meet_instance_id(int uid) const;
   691 public:
   692   // Creates a type given a klass. Correctly handles multi-dimensional arrays
   693   // Respects UseUniqueSubclasses.
   694   // If the klass is final, the resulting type will be exact.
   695   static const TypeOopPtr* make_from_klass(ciKlass* klass) {
   696     return make_from_klass_common(klass, true, false);
   697   }
   698   // Same as before, but will produce an exact type, even if
   699   // the klass is not final, as long as it has exactly one implementation.
   700   static const TypeOopPtr* make_from_klass_unique(ciKlass* klass) {
   701     return make_from_klass_common(klass, true, true);
   702   }
   703   // Same as before, but does not respects UseUniqueSubclasses.
   704   // Use this only for creating array element types.
   705   static const TypeOopPtr* make_from_klass_raw(ciKlass* klass) {
   706     return make_from_klass_common(klass, false, false);
   707   }
   708   // Creates a singleton type given an object.
   709   static const TypeOopPtr* make_from_constant(ciObject* o);
   711   // Make a generic (unclassed) pointer to an oop.
   712   static const TypeOopPtr* make(PTR ptr, int offset);
   714   ciObject* const_oop()    const { return _const_oop; }
   715   virtual ciKlass* klass() const { return _klass;     }
   716   bool klass_is_exact()    const { return _klass_is_exact; }
   718   // Returns true if this pointer points at memory which contains a
   719   // compressed oop references.
   720   bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; }
   722   bool is_known_instance()       const { return _instance_id > 0; }
   723   int  instance_id()             const { return _instance_id; }
   724   bool is_known_instance_field() const { return is_known_instance() && _offset >= 0; }
   726   virtual intptr_t get_con() const;
   728   virtual const Type *cast_to_ptr_type(PTR ptr) const;
   730   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
   732   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
   734   // corresponding pointer to klass, for a given instance
   735   const TypeKlassPtr* as_klass_type() const;
   737   virtual const TypePtr *add_offset( intptr_t offset ) const;
   739   virtual const Type *xmeet( const Type *t ) const;
   740   virtual const Type *xdual() const;    // Compute dual right now.
   742   // Do not allow interface-vs.-noninterface joins to collapse to top.
   743   virtual const Type *filter( const Type *kills ) const;
   745   // Convenience common pre-built type.
   746   static const TypeOopPtr *BOTTOM;
   747 #ifndef PRODUCT
   748   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
   749 #endif
   750 };
   752 //------------------------------TypeInstPtr------------------------------------
   753 // Class of Java object pointers, pointing either to non-array Java instances
   754 // or to a klassOop (including array klasses).
   755 class TypeInstPtr : public TypeOopPtr {
   756   TypeInstPtr( PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id );
   757   virtual bool eq( const Type *t ) const;
   758   virtual int  hash() const;             // Type specific hashing
   760   ciSymbol*  _name;        // class name
   762  public:
   763   ciSymbol* name()         const { return _name; }
   765   bool  is_loaded() const { return _klass->is_loaded(); }
   767   // Make a pointer to a constant oop.
   768   static const TypeInstPtr *make(ciObject* o) {
   769     return make(TypePtr::Constant, o->klass(), true, o, 0);
   770   }
   772   // Make a pointer to a constant oop with offset.
   773   static const TypeInstPtr *make(ciObject* o, int offset) {
   774     return make(TypePtr::Constant, o->klass(), true, o, offset);
   775   }
   777   // Make a pointer to some value of type klass.
   778   static const TypeInstPtr *make(PTR ptr, ciKlass* klass) {
   779     return make(ptr, klass, false, NULL, 0);
   780   }
   782   // Make a pointer to some non-polymorphic value of exactly type klass.
   783   static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) {
   784     return make(ptr, klass, true, NULL, 0);
   785   }
   787   // Make a pointer to some value of type klass with offset.
   788   static const TypeInstPtr *make(PTR ptr, ciKlass* klass, int offset) {
   789     return make(ptr, klass, false, NULL, offset);
   790   }
   792   // Make a pointer to an oop.
   793   static const TypeInstPtr *make(PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id = InstanceBot );
   795   // If this is a java.lang.Class constant, return the type for it or NULL.
   796   // Pass to Type::get_const_type to turn it to a type, which will usually
   797   // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc.
   798   ciType* java_mirror_type() const;
   800   virtual const Type *cast_to_ptr_type(PTR ptr) const;
   802   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
   804   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
   806   virtual const TypePtr *add_offset( intptr_t offset ) const;
   808   virtual const Type *xmeet( const Type *t ) const;
   809   virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const;
   810   virtual const Type *xdual() const;    // Compute dual right now.
   812   // Convenience common pre-built types.
   813   static const TypeInstPtr *NOTNULL;
   814   static const TypeInstPtr *BOTTOM;
   815   static const TypeInstPtr *MIRROR;
   816   static const TypeInstPtr *MARK;
   817   static const TypeInstPtr *KLASS;
   818 #ifndef PRODUCT
   819   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
   820 #endif
   821 };
   823 //------------------------------TypeAryPtr-------------------------------------
   824 // Class of Java array pointers
   825 class TypeAryPtr : public TypeOopPtr {
   826   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) {};
   827   virtual bool eq( const Type *t ) const;
   828   virtual int hash() const;     // Type specific hashing
   829   const TypeAry *_ary;          // Array we point into
   831 public:
   832   // Accessors
   833   ciKlass* klass() const;
   834   const TypeAry* ary() const  { return _ary; }
   835   const Type*    elem() const { return _ary->_elem; }
   836   const TypeInt* size() const { return _ary->_size; }
   838   static const TypeAryPtr *make( PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot);
   839   // Constant pointer to array
   840   static const TypeAryPtr *make( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id = InstanceBot);
   842   // Convenience
   843   static const TypeAryPtr *make(ciObject* o);
   845   // Return a 'ptr' version of this type
   846   virtual const Type *cast_to_ptr_type(PTR ptr) const;
   848   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
   850   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
   852   virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
   853   virtual const TypeInt* narrow_size_type(const TypeInt* size) const;
   855   virtual bool empty(void) const;        // TRUE if type is vacuous
   856   virtual const TypePtr *add_offset( intptr_t offset ) const;
   858   virtual const Type *xmeet( const Type *t ) const;
   859   virtual const Type *xdual() const;    // Compute dual right now.
   861   // Convenience common pre-built types.
   862   static const TypeAryPtr *RANGE;
   863   static const TypeAryPtr *OOPS;
   864   static const TypeAryPtr *NARROWOOPS;
   865   static const TypeAryPtr *BYTES;
   866   static const TypeAryPtr *SHORTS;
   867   static const TypeAryPtr *CHARS;
   868   static const TypeAryPtr *INTS;
   869   static const TypeAryPtr *LONGS;
   870   static const TypeAryPtr *FLOATS;
   871   static const TypeAryPtr *DOUBLES;
   872   // selects one of the above:
   873   static const TypeAryPtr *get_array_body_type(BasicType elem) {
   874     assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != NULL, "bad elem type");
   875     return _array_body_type[elem];
   876   }
   877   static const TypeAryPtr *_array_body_type[T_CONFLICT+1];
   878   // sharpen the type of an int which is used as an array size
   879 #ifdef ASSERT
   880   // One type is interface, the other is oop
   881   virtual bool interface_vs_oop(const Type *t) const;
   882 #endif
   883 #ifndef PRODUCT
   884   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
   885 #endif
   886 };
   888 //------------------------------TypeKlassPtr-----------------------------------
   889 // Class of Java Klass pointers
   890 class TypeKlassPtr : public TypeOopPtr {
   891   TypeKlassPtr( PTR ptr, ciKlass* klass, int offset );
   893   virtual bool eq( const Type *t ) const;
   894   virtual int hash() const;             // Type specific hashing
   896 public:
   897   ciSymbol* name()  const { return _klass->name(); }
   899   bool  is_loaded() const { return _klass->is_loaded(); }
   901   // ptr to klass 'k'
   902   static const TypeKlassPtr *make( ciKlass* k ) { return make( TypePtr::Constant, k, 0); }
   903   // ptr to klass 'k' with offset
   904   static const TypeKlassPtr *make( ciKlass* k, int offset ) { return make( TypePtr::Constant, k, offset); }
   905   // ptr to klass 'k' or sub-klass
   906   static const TypeKlassPtr *make( PTR ptr, ciKlass* k, int offset);
   908   virtual const Type *cast_to_ptr_type(PTR ptr) const;
   910   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
   912   // corresponding pointer to instance, for a given class
   913   const TypeOopPtr* as_instance_type() const;
   915   virtual const TypePtr *add_offset( intptr_t offset ) const;
   916   virtual const Type    *xmeet( const Type *t ) const;
   917   virtual const Type    *xdual() const;      // Compute dual right now.
   919   // Convenience common pre-built types.
   920   static const TypeKlassPtr* OBJECT; // Not-null object klass or below
   921   static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
   922 #ifndef PRODUCT
   923   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
   924 #endif
   925 };
   927 //------------------------------TypeNarrowOop----------------------------------
   928 // A compressed reference to some kind of Oop.  This type wraps around
   929 // a preexisting TypeOopPtr and forwards most of it's operations to
   930 // the underlying type.  It's only real purpose is to track the
   931 // oopness of the compressed oop value when we expose the conversion
   932 // between the normal and the compressed form.
   933 class TypeNarrowOop : public Type {
   934 protected:
   935   const TypePtr* _ooptype; // Could be TypePtr::NULL_PTR
   937   TypeNarrowOop( const TypePtr* ooptype): Type(NarrowOop),
   938     _ooptype(ooptype) {
   939     assert(ooptype->offset() == 0 ||
   940            ooptype->offset() == OffsetBot ||
   941            ooptype->offset() == OffsetTop, "no real offsets");
   942   }
   943 public:
   944   virtual bool eq( const Type *t ) const;
   945   virtual int  hash() const;             // Type specific hashing
   946   virtual bool singleton(void) const;    // TRUE if type is a singleton
   948   virtual const Type *xmeet( const Type *t ) const;
   949   virtual const Type *xdual() const;    // Compute dual right now.
   951   virtual intptr_t get_con() const;
   953   // Do not allow interface-vs.-noninterface joins to collapse to top.
   954   virtual const Type *filter( const Type *kills ) const;
   956   virtual bool empty(void) const;        // TRUE if type is vacuous
   958   static const TypeNarrowOop *make( const TypePtr* type);
   960   static const TypeNarrowOop* make_from_constant(ciObject* con) {
   961     return make(TypeOopPtr::make_from_constant(con));
   962   }
   964   // returns the equivalent ptr type for this compressed pointer
   965   const TypePtr *make_oopptr() const {
   966     return _ooptype;
   967   }
   969   static const TypeNarrowOop *BOTTOM;
   970   static const TypeNarrowOop *NULL_PTR;
   972 #ifndef PRODUCT
   973   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
   974 #endif
   975 };
   977 //------------------------------TypeFunc---------------------------------------
   978 // Class of Array Types
   979 class TypeFunc : public Type {
   980   TypeFunc( const TypeTuple *domain, const TypeTuple *range ) : Type(Function),  _domain(domain), _range(range) {}
   981   virtual bool eq( const Type *t ) const;
   982   virtual int  hash() const;             // Type specific hashing
   983   virtual bool singleton(void) const;    // TRUE if type is a singleton
   984   virtual bool empty(void) const;        // TRUE if type is vacuous
   985 public:
   986   // Constants are shared among ADLC and VM
   987   enum { Control    = AdlcVMDeps::Control,
   988          I_O        = AdlcVMDeps::I_O,
   989          Memory     = AdlcVMDeps::Memory,
   990          FramePtr   = AdlcVMDeps::FramePtr,
   991          ReturnAdr  = AdlcVMDeps::ReturnAdr,
   992          Parms      = AdlcVMDeps::Parms
   993   };
   995   const TypeTuple* const _domain;     // Domain of inputs
   996   const TypeTuple* const _range;      // Range of results
   998   // Accessors:
   999   const TypeTuple* domain() const { return _domain; }
  1000   const TypeTuple* range()  const { return _range; }
  1002   static const TypeFunc *make(ciMethod* method);
  1003   static const TypeFunc *make(ciSignature signature, const Type* extra);
  1004   static const TypeFunc *make(const TypeTuple* domain, const TypeTuple* range);
  1006   virtual const Type *xmeet( const Type *t ) const;
  1007   virtual const Type *xdual() const;    // Compute dual right now.
  1009   BasicType return_type() const;
  1011 #ifndef PRODUCT
  1012   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
  1013   void print_flattened() const; // Print a 'flattened' signature
  1014 #endif
  1015   // Convenience common pre-built types.
  1016 };
  1018 //------------------------------accessors--------------------------------------
  1019 inline bool Type::is_ptr_to_narrowoop() const {
  1020 #ifdef _LP64
  1021   return (isa_oopptr() != NULL && is_oopptr()->is_ptr_to_narrowoop_nv());
  1022 #else
  1023   return false;
  1024 #endif
  1027 inline float Type::getf() const {
  1028   assert( _base == FloatCon, "Not a FloatCon" );
  1029   return ((TypeF*)this)->_f;
  1032 inline double Type::getd() const {
  1033   assert( _base == DoubleCon, "Not a DoubleCon" );
  1034   return ((TypeD*)this)->_d;
  1037 inline const TypeF *Type::is_float_constant() const {
  1038   assert( _base == FloatCon, "Not a Float" );
  1039   return (TypeF*)this;
  1042 inline const TypeF *Type::isa_float_constant() const {
  1043   return ( _base == FloatCon ? (TypeF*)this : NULL);
  1046 inline const TypeD *Type::is_double_constant() const {
  1047   assert( _base == DoubleCon, "Not a Double" );
  1048   return (TypeD*)this;
  1051 inline const TypeD *Type::isa_double_constant() const {
  1052   return ( _base == DoubleCon ? (TypeD*)this : NULL);
  1055 inline const TypeInt *Type::is_int() const {
  1056   assert( _base == Int, "Not an Int" );
  1057   return (TypeInt*)this;
  1060 inline const TypeInt *Type::isa_int() const {
  1061   return ( _base == Int ? (TypeInt*)this : NULL);
  1064 inline const TypeLong *Type::is_long() const {
  1065   assert( _base == Long, "Not a Long" );
  1066   return (TypeLong*)this;
  1069 inline const TypeLong *Type::isa_long() const {
  1070   return ( _base == Long ? (TypeLong*)this : NULL);
  1073 inline const TypeTuple *Type::is_tuple() const {
  1074   assert( _base == Tuple, "Not a Tuple" );
  1075   return (TypeTuple*)this;
  1078 inline const TypeAry *Type::is_ary() const {
  1079   assert( _base == Array , "Not an Array" );
  1080   return (TypeAry*)this;
  1083 inline const TypePtr *Type::is_ptr() const {
  1084   // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between.
  1085   assert(_base >= AnyPtr && _base <= KlassPtr, "Not a pointer");
  1086   return (TypePtr*)this;
  1089 inline const TypePtr *Type::isa_ptr() const {
  1090   // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between.
  1091   return (_base >= AnyPtr && _base <= KlassPtr) ? (TypePtr*)this : NULL;
  1094 inline const TypeOopPtr *Type::is_oopptr() const {
  1095   // OopPtr is the first and KlassPtr the last, with no non-oops between.
  1096   assert(_base >= OopPtr && _base <= KlassPtr, "Not a Java pointer" ) ;
  1097   return (TypeOopPtr*)this;
  1100 inline const TypeOopPtr *Type::isa_oopptr() const {
  1101   // OopPtr is the first and KlassPtr the last, with no non-oops between.
  1102   return (_base >= OopPtr && _base <= KlassPtr) ? (TypeOopPtr*)this : NULL;
  1105 inline const TypeRawPtr *Type::isa_rawptr() const {
  1106   return (_base == RawPtr) ? (TypeRawPtr*)this : NULL;
  1109 inline const TypeRawPtr *Type::is_rawptr() const {
  1110   assert( _base == RawPtr, "Not a raw pointer" );
  1111   return (TypeRawPtr*)this;
  1114 inline const TypeInstPtr *Type::isa_instptr() const {
  1115   return (_base == InstPtr) ? (TypeInstPtr*)this : NULL;
  1118 inline const TypeInstPtr *Type::is_instptr() const {
  1119   assert( _base == InstPtr, "Not an object pointer" );
  1120   return (TypeInstPtr*)this;
  1123 inline const TypeAryPtr *Type::isa_aryptr() const {
  1124   return (_base == AryPtr) ? (TypeAryPtr*)this : NULL;
  1127 inline const TypeAryPtr *Type::is_aryptr() const {
  1128   assert( _base == AryPtr, "Not an array pointer" );
  1129   return (TypeAryPtr*)this;
  1132 inline const TypeNarrowOop *Type::is_narrowoop() const {
  1133   // OopPtr is the first and KlassPtr the last, with no non-oops between.
  1134   assert(_base == NarrowOop, "Not a narrow oop" ) ;
  1135   return (TypeNarrowOop*)this;
  1138 inline const TypeNarrowOop *Type::isa_narrowoop() const {
  1139   // OopPtr is the first and KlassPtr the last, with no non-oops between.
  1140   return (_base == NarrowOop) ? (TypeNarrowOop*)this : NULL;
  1143 inline const TypeKlassPtr *Type::isa_klassptr() const {
  1144   return (_base == KlassPtr) ? (TypeKlassPtr*)this : NULL;
  1147 inline const TypeKlassPtr *Type::is_klassptr() const {
  1148   assert( _base == KlassPtr, "Not a klass pointer" );
  1149   return (TypeKlassPtr*)this;
  1152 inline const TypePtr* Type::make_ptr() const {
  1153   return (_base == NarrowOop) ? is_narrowoop()->make_oopptr() :
  1154                                 (isa_ptr() ? is_ptr() : NULL);
  1157 inline const TypeNarrowOop* Type::make_narrowoop() const {
  1158   return (_base == NarrowOop) ? is_narrowoop() :
  1159                                 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL);
  1162 inline bool Type::is_floatingpoint() const {
  1163   if( (_base == FloatCon)  || (_base == FloatBot) ||
  1164       (_base == DoubleCon) || (_base == DoubleBot) )
  1165     return true;
  1166   return false;
  1170 // ===============================================================
  1171 // Things that need to be 64-bits in the 64-bit build but
  1172 // 32-bits in the 32-bit build.  Done this way to get full
  1173 // optimization AND strong typing.
  1174 #ifdef _LP64
  1176 // For type queries and asserts
  1177 #define is_intptr_t  is_long
  1178 #define isa_intptr_t isa_long
  1179 #define find_intptr_t_type find_long_type
  1180 #define find_intptr_t_con  find_long_con
  1181 #define TypeX        TypeLong
  1182 #define Type_X       Type::Long
  1183 #define TypeX_X      TypeLong::LONG
  1184 #define TypeX_ZERO   TypeLong::ZERO
  1185 // For 'ideal_reg' machine registers
  1186 #define Op_RegX      Op_RegL
  1187 // For phase->intcon variants
  1188 #define MakeConX     longcon
  1189 #define ConXNode     ConLNode
  1190 // For array index arithmetic
  1191 #define MulXNode     MulLNode
  1192 #define AndXNode     AndLNode
  1193 #define OrXNode      OrLNode
  1194 #define CmpXNode     CmpLNode
  1195 #define SubXNode     SubLNode
  1196 #define LShiftXNode  LShiftLNode
  1197 // For object size computation:
  1198 #define AddXNode     AddLNode
  1199 #define RShiftXNode  RShiftLNode
  1200 // For card marks and hashcodes
  1201 #define URShiftXNode URShiftLNode
  1202 // UseOptoBiasInlining
  1203 #define XorXNode     XorLNode
  1204 #define StoreXConditionalNode StoreLConditionalNode
  1205 // Opcodes
  1206 #define Op_LShiftX   Op_LShiftL
  1207 #define Op_AndX      Op_AndL
  1208 #define Op_AddX      Op_AddL
  1209 #define Op_SubX      Op_SubL
  1210 // conversions
  1211 #define ConvI2X(x)   ConvI2L(x)
  1212 #define ConvL2X(x)   (x)
  1213 #define ConvX2I(x)   ConvL2I(x)
  1214 #define ConvX2L(x)   (x)
  1216 #else
  1218 // For type queries and asserts
  1219 #define is_intptr_t  is_int
  1220 #define isa_intptr_t isa_int
  1221 #define find_intptr_t_type find_int_type
  1222 #define find_intptr_t_con  find_int_con
  1223 #define TypeX        TypeInt
  1224 #define Type_X       Type::Int
  1225 #define TypeX_X      TypeInt::INT
  1226 #define TypeX_ZERO   TypeInt::ZERO
  1227 // For 'ideal_reg' machine registers
  1228 #define Op_RegX      Op_RegI
  1229 // For phase->intcon variants
  1230 #define MakeConX     intcon
  1231 #define ConXNode     ConINode
  1232 // For array index arithmetic
  1233 #define MulXNode     MulINode
  1234 #define AndXNode     AndINode
  1235 #define OrXNode      OrINode
  1236 #define CmpXNode     CmpINode
  1237 #define SubXNode     SubINode
  1238 #define LShiftXNode  LShiftINode
  1239 // For object size computation:
  1240 #define AddXNode     AddINode
  1241 #define RShiftXNode  RShiftINode
  1242 // For card marks and hashcodes
  1243 #define URShiftXNode URShiftINode
  1244 // UseOptoBiasInlining
  1245 #define XorXNode     XorINode
  1246 #define StoreXConditionalNode StoreIConditionalNode
  1247 // Opcodes
  1248 #define Op_LShiftX   Op_LShiftI
  1249 #define Op_AndX      Op_AndI
  1250 #define Op_AddX      Op_AddI
  1251 #define Op_SubX      Op_SubI
  1252 // conversions
  1253 #define ConvI2X(x)   (x)
  1254 #define ConvL2X(x)   ConvL2I(x)
  1255 #define ConvX2I(x)   (x)
  1256 #define ConvX2L(x)   ConvI2L(x)
  1258 #endif

mercurial