1 /*
   2  * Copyright (c) 1997, 2021, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_OPTO_TYPE_HPP
  26 #define SHARE_OPTO_TYPE_HPP
  27 
  28 #include "ci/ciInlineKlass.hpp"
  29 #include "opto/adlcVMDeps.hpp"
  30 #include "runtime/handles.hpp"
  31 #include "runtime/sharedRuntime.hpp"
  32 
  33 // Portions of code courtesy of Clifford Click
  34 
  35 // Optimization - Graph Style
  36 
  37 
  38 // This class defines a Type lattice.  The lattice is used in the constant
  39 // propagation algorithms, and for some type-checking of the iloc code.
  40 // Basic types include RSD's (lower bound, upper bound, stride for integers),
  41 // float & double precision constants, sets of data-labels and code-labels.
  42 // The complete lattice is described below.  Subtypes have no relationship to
  43 // up or down in the lattice; that is entirely determined by the behavior of
  44 // the MEET/JOIN functions.
  45 
  46 class Dict;
  47 class Type;
  48 class   TypeD;
  49 class   TypeF;
  50 class   TypeInteger;
  51 class     TypeInt;
  52 class     TypeLong;
  53 class   TypeNarrowPtr;
  54 class     TypeNarrowOop;
  55 class     TypeNarrowKlass;
  56 class   TypeAry;
  57 class   TypeTuple;
  58 class   TypeInlineType;
  59 class   TypeVect;
  60 class     TypeVectA;
  61 class     TypeVectS;
  62 class     TypeVectD;
  63 class     TypeVectX;
  64 class     TypeVectY;
  65 class     TypeVectZ;
  66 class     TypeVectMask;
  67 class   TypePtr;
  68 class     TypeRawPtr;
  69 class     TypeOopPtr;
  70 class       TypeInstPtr;
  71 class       TypeAryPtr;
  72 class     TypeKlassPtr;
  73 class       TypeInstKlassPtr;
  74 class       TypeAryKlassPtr;
  75 class     TypeMetadataPtr;
  76 
  77 //------------------------------Type-------------------------------------------
  78 // Basic Type object, represents a set of primitive Values.
  79 // Types are hash-cons'd into a private class dictionary, so only one of each
  80 // different kind of Type exists.  Types are never modified after creation, so
  81 // all their interesting fields are constant.
  82 class Type {
  83   friend class VMStructs;
  84 
  85 public:
  86   enum TYPES {
  87     Bad=0,                      // Type check
  88     Control,                    // Control of code (not in lattice)
  89     Top,                        // Top of the lattice
  90     Int,                        // Integer range (lo-hi)
  91     Long,                       // Long integer range (lo-hi)
  92     Half,                       // Placeholder half of doubleword
  93     NarrowOop,                  // Compressed oop pointer
  94     NarrowKlass,                // Compressed klass pointer
  95 
  96     Tuple,                      // Method signature or object layout
  97     Array,                      // Array types
  98 
  99     VectorMask,                 // Vector predicate/mask type
 100     VectorA,                    // (Scalable) Vector types for vector length agnostic
 101     VectorS,                    //  32bit Vector types
 102     VectorD,                    //  64bit Vector types
 103     VectorX,                    // 128bit Vector types
 104     VectorY,                    // 256bit Vector types
 105     VectorZ,                    // 512bit Vector types
 106     InlineType,                 // Inline type
 107 
 108     AnyPtr,                     // Any old raw, klass, inst, or array pointer
 109     RawPtr,                     // Raw (non-oop) pointers
 110     OopPtr,                     // Any and all Java heap entities
 111     InstPtr,                    // Instance pointers (non-array objects)
 112     AryPtr,                     // Array pointers
 113     // (Ptr order matters:  See is_ptr, isa_ptr, is_oopptr, isa_oopptr.)
 114 
 115     MetadataPtr,                // Generic metadata
 116     KlassPtr,                   // Klass pointers
 117     InstKlassPtr,
 118     AryKlassPtr,
 119 
 120     Function,                   // Function signature
 121     Abio,                       // Abstract I/O
 122     Return_Address,             // Subroutine return address
 123     Memory,                     // Abstract store
 124     FloatTop,                   // No float value
 125     FloatCon,                   // Floating point constant
 126     FloatBot,                   // Any float value
 127     DoubleTop,                  // No double value
 128     DoubleCon,                  // Double precision constant
 129     DoubleBot,                  // Any double value
 130     Bottom,                     // Bottom of lattice
 131     lastype                     // Bogus ending type (not in lattice)
 132   };
 133 
 134   // Signal values for offsets from a base pointer
 135   enum OFFSET_SIGNALS {
 136     OffsetTop = -2000000000,    // undefined offset
 137     OffsetBot = -2000000001     // any possible offset
 138   };
 139 
 140   class Offset {
 141   private:
 142     int _offset;
 143 
 144   public:
 145     explicit Offset(int offset) : _offset(offset) {}
 146 
 147     const Offset meet(const Offset other) const;
 148     const Offset dual() const;
 149     const Offset add(intptr_t offset) const;
 150     bool operator==(const Offset& other) const {
 151       return _offset == other._offset;
 152     }
 153     bool operator!=(const Offset& other) const {
 154       return _offset != other._offset;
 155     }
 156     int get() const { return _offset; }
 157 
 158     void dump2(outputStream *st) const;
 159 
 160     static const Offset top;
 161     static const Offset bottom;
 162   };
 163 
 164   // Min and max WIDEN values.
 165   enum WIDEN {
 166     WidenMin = 0,
 167     WidenMax = 3
 168   };
 169 
 170 private:
 171   typedef struct {
 172     TYPES                dual_type;
 173     BasicType            basic_type;
 174     const char*          msg;
 175     bool                 isa_oop;
 176     uint                 ideal_reg;
 177     relocInfo::relocType reloc;
 178   } TypeInfo;
 179 
 180   // Dictionary of types shared among compilations.
 181   static Dict* _shared_type_dict;
 182   static const TypeInfo _type_info[];
 183 
 184   static int uhash( const Type *const t );
 185   // Structural equality check.  Assumes that cmp() has already compared
 186   // the _base types and thus knows it can cast 't' appropriately.
 187   virtual bool eq( const Type *t ) const;
 188 
 189   // Top-level hash-table of types
 190   static Dict *type_dict() {
 191     return Compile::current()->type_dict();
 192   }
 193 
 194   // DUAL operation: reflect around lattice centerline.  Used instead of
 195   // join to ensure my lattice is symmetric up and down.  Dual is computed
 196   // lazily, on demand, and cached in _dual.
 197   const Type *_dual;            // Cached dual value
 198 
 199 #ifdef ASSERT
 200   // One type is interface, the other is oop
 201   virtual bool interface_vs_oop_helper(const Type *t) const;
 202 #endif
 203 
 204   const Type *meet_helper(const Type *t, bool include_speculative) const;
 205   void check_symmetrical(const Type *t, const Type *mt) const;
 206 
 207 protected:
 208   // Each class of type is also identified by its base.
 209   const TYPES _base;            // Enum of Types type
 210 
 211   Type( TYPES t ) : _dual(NULL),  _base(t) {} // Simple types
 212   // ~Type();                   // Use fast deallocation
 213   const Type *hashcons();       // Hash-cons the type
 214   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
 215   const Type *join_helper(const Type *t, bool include_speculative) const {
 216     return dual()->meet_helper(t->dual(), include_speculative)->dual();
 217   }
 218 
 219 public:
 220 
 221   inline void* operator new( size_t x ) throw() {
 222     Compile* compile = Compile::current();
 223     compile->set_type_last_size(x);
 224     return compile->type_arena()->AmallocWords(x);
 225   }
 226   inline void operator delete( void* ptr ) {
 227     Compile* compile = Compile::current();
 228     compile->type_arena()->Afree(ptr,compile->type_last_size());
 229   }
 230 
 231   // Initialize the type system for a particular compilation.
 232   static void Initialize(Compile* compile);
 233 
 234   // Initialize the types shared by all compilations.
 235   static void Initialize_shared(Compile* compile);
 236 
 237   TYPES base() const {
 238     assert(_base > Bad && _base < lastype, "sanity");
 239     return _base;
 240   }
 241 
 242   // Create a new hash-consd type
 243   static const Type *make(enum TYPES);
 244   // Test for equivalence of types
 245   static int cmp( const Type *const t1, const Type *const t2 );
 246   // Test for higher or equal in lattice
 247   // Variant that drops the speculative part of the types
 248   bool higher_equal(const Type *t) const {
 249     return !cmp(meet(t),t->remove_speculative());
 250   }
 251   // Variant that keeps the speculative part of the types
 252   bool higher_equal_speculative(const Type *t) const {
 253     return !cmp(meet_speculative(t),t);
 254   }
 255 
 256   // MEET operation; lower in lattice.
 257   // Variant that drops the speculative part of the types
 258   const Type *meet(const Type *t) const {
 259     return meet_helper(t, false);
 260   }
 261   // Variant that keeps the speculative part of the types
 262   const Type *meet_speculative(const Type *t) const {
 263     return meet_helper(t, true)->cleanup_speculative();
 264   }
 265   // WIDEN: 'widens' for Ints and other range types
 266   virtual const Type *widen( const Type *old, const Type* limit ) const { return this; }
 267   // NARROW: complement for widen, used by pessimistic phases
 268   virtual const Type *narrow( const Type *old ) const { return this; }
 269 
 270   // DUAL operation: reflect around lattice centerline.  Used instead of
 271   // join to ensure my lattice is symmetric up and down.
 272   const Type *dual() const { return _dual; }
 273 
 274   // Compute meet dependent on base type
 275   virtual const Type *xmeet( const Type *t ) const;
 276   virtual const Type *xdual() const;    // Compute dual right now.
 277 
 278   // JOIN operation; higher in lattice.  Done by finding the dual of the
 279   // meet of the dual of the 2 inputs.
 280   // Variant that drops the speculative part of the types
 281   const Type *join(const Type *t) const {
 282     return join_helper(t, false);
 283   }
 284   // Variant that keeps the speculative part of the types
 285   const Type *join_speculative(const Type *t) const {
 286     return join_helper(t, true)->cleanup_speculative();
 287   }
 288 
 289   // Modified version of JOIN adapted to the needs Node::Value.
 290   // Normalizes all empty values to TOP.  Does not kill _widen bits.
 291   // Currently, it also works around limitations involving interface types.
 292   // Variant that drops the speculative part of the types
 293   const Type *filter(const Type *kills) const {
 294     return filter_helper(kills, false);
 295   }
 296   // Variant that keeps the speculative part of the types
 297   const Type *filter_speculative(const Type *kills) const {
 298     return filter_helper(kills, true)->cleanup_speculative();
 299   }
 300 
 301 #ifdef ASSERT
 302   // One type is interface, the other is oop
 303   virtual bool interface_vs_oop(const Type *t) const;
 304 #endif
 305 
 306   // Returns true if this pointer points at memory which contains a
 307   // compressed oop references.
 308   bool is_ptr_to_narrowoop() const;
 309   bool is_ptr_to_narrowklass() const;
 310 
 311   // Convenience access
 312   float getf() const;
 313   double getd() const;
 314 
 315   const TypeInt    *is_int() const;
 316   const TypeInt    *isa_int() const;             // Returns NULL if not an Int
 317   const TypeInteger* is_integer(BasicType bt) const;
 318   const TypeInteger* isa_integer(BasicType bt) const;
 319   const TypeLong   *is_long() const;
 320   const TypeLong   *isa_long() const;            // Returns NULL if not a Long
 321   const TypeD      *isa_double() const;          // Returns NULL if not a Double{Top,Con,Bot}
 322   const TypeD      *is_double_constant() const;  // Asserts it is a DoubleCon
 323   const TypeD      *isa_double_constant() const; // Returns NULL if not a DoubleCon
 324   const TypeF      *isa_float() const;           // Returns NULL if not a Float{Top,Con,Bot}
 325   const TypeF      *is_float_constant() const;   // Asserts it is a FloatCon
 326   const TypeF      *isa_float_constant() const;  // Returns NULL if not a FloatCon
 327   const TypeTuple  *is_tuple() const;            // Collection of fields, NOT a pointer
 328   const TypeAry    *is_ary() const;              // Array, NOT array pointer
 329   const TypeAry    *isa_ary() const;             // Returns NULL of not ary
 330   const TypeVect   *is_vect() const;             // Vector
 331   const TypeVect   *isa_vect() const;            // Returns NULL if not a Vector
 332   const TypeVectMask *is_vectmask() const;       // Predicate/Mask Vector
 333   const TypeVectMask *isa_vectmask() const;      // Returns NULL if not a Vector Predicate/Mask
 334   const TypePtr    *is_ptr() const;              // Asserts it is a ptr type
 335   const TypePtr    *isa_ptr() const;             // Returns NULL if not ptr type
 336   const TypeRawPtr *isa_rawptr() const;          // NOT Java oop
 337   const TypeRawPtr *is_rawptr() const;           // Asserts is rawptr
 338   const TypeNarrowOop  *is_narrowoop() const;    // Java-style GC'd pointer
 339   const TypeNarrowOop  *isa_narrowoop() const;   // Returns NULL if not oop ptr type
 340   const TypeNarrowKlass *is_narrowklass() const; // compressed klass pointer
 341   const TypeNarrowKlass *isa_narrowklass() const;// Returns NULL if not oop ptr type
 342   const TypeOopPtr   *isa_oopptr() const;        // Returns NULL if not oop ptr type
 343   const TypeOopPtr   *is_oopptr() const;         // Java-style GC'd pointer
 344   const TypeInstPtr  *isa_instptr() const;       // Returns NULL if not InstPtr
 345   const TypeInstPtr  *is_instptr() const;        // Instance
 346   const TypeAryPtr   *isa_aryptr() const;        // Returns NULL if not AryPtr
 347   const TypeAryPtr   *is_aryptr() const;         // Array oop
 348   const TypeInlineType* isa_inlinetype() const;  // Returns NULL if not Inline Type
 349   const TypeInlineType* is_inlinetype() const;   // Inline Type
 350 
 351   const TypeMetadataPtr   *isa_metadataptr() const;   // Returns NULL if not oop ptr type
 352   const TypeMetadataPtr   *is_metadataptr() const;    // Java-style GC'd pointer
 353   const TypeKlassPtr      *isa_klassptr() const;      // Returns NULL if not KlassPtr
 354   const TypeKlassPtr      *is_klassptr() const;       // assert if not KlassPtr
 355   const TypeInstKlassPtr  *isa_instklassptr() const;  // Returns NULL if not IntKlassPtr
 356   const TypeInstKlassPtr  *is_instklassptr() const;   // assert if not IntKlassPtr
 357   const TypeAryKlassPtr   *isa_aryklassptr() const;   // Returns NULL if not AryKlassPtr
 358   const TypeAryKlassPtr   *is_aryklassptr() const;    // assert if not AryKlassPtr
 359 
 360   virtual bool      is_finite() const;           // Has a finite value
 361   virtual bool      is_nan()    const;           // Is not a number (NaN)
 362 
 363   bool is_inlinetypeptr() const;
 364   virtual ciInlineKlass* inline_klass() const;
 365 
 366   // Returns this ptr type or the equivalent ptr type for this compressed pointer.
 367   const TypePtr* make_ptr() const;
 368 
 369   // Returns this oopptr type or the equivalent oopptr type for this compressed pointer.
 370   // Asserts if the underlying type is not an oopptr or narrowoop.
 371   const TypeOopPtr* make_oopptr() const;
 372 
 373   // Returns this compressed pointer or the equivalent compressed version
 374   // of this pointer type.
 375   const TypeNarrowOop* make_narrowoop() const;
 376 
 377   // Returns this compressed klass pointer or the equivalent
 378   // compressed version of this pointer type.
 379   const TypeNarrowKlass* make_narrowklass() const;
 380 
 381   // Special test for register pressure heuristic
 382   bool is_floatingpoint() const;        // True if Float or Double base type
 383 
 384   // Do you have memory, directly or through a tuple?
 385   bool has_memory( ) const;
 386 
 387   // TRUE if type is a singleton
 388   virtual bool singleton(void) const;
 389 
 390   // TRUE if type is above the lattice centerline, and is therefore vacuous
 391   virtual bool empty(void) const;
 392 
 393   // Return a hash for this type.  The hash function is public so ConNode
 394   // (constants) can hash on their constant, which is represented by a Type.
 395   virtual int hash() const;
 396 
 397   // Map ideal registers (machine types) to ideal types
 398   static const Type *mreg2type[];
 399 
 400   // Printing, statistics
 401 #ifndef PRODUCT
 402   void         dump_on(outputStream *st) const;
 403   void         dump() const {
 404     dump_on(tty);
 405   }
 406   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
 407   static  void dump_stats();
 408   // Groups of types, for debugging and visualization only.
 409   enum class Category {
 410     Data,
 411     Memory,
 412     Mixed,   // Tuples with types of different categories.
 413     Control,
 414     Other,   // {Type::Top, Type::Abio, Type::Bottom}.
 415     Undef    // {Type::Bad, Type::lastype}, for completeness.
 416   };
 417   // Return the category of this type.
 418   Category category() const;
 419 
 420   static const char* str(const Type* t);
 421 #endif // !PRODUCT
 422   void typerr(const Type *t) const; // Mixing types error
 423 
 424   // Create basic type
 425   static const Type* get_const_basic_type(BasicType type) {
 426     assert((uint)type <= T_CONFLICT && _const_basic_type[type] != NULL, "bad type");
 427     return _const_basic_type[type];
 428   }
 429 
 430   // For two instance arrays of same dimension, return the base element types.
 431   // Otherwise or if the arrays have different dimensions, return NULL.
 432   static void get_arrays_base_elements(const Type *a1, const Type *a2,
 433                                        const TypeInstPtr **e1, const TypeInstPtr **e2);
 434 
 435   // Mapping to the array element's basic type.
 436   BasicType array_element_basic_type() const;
 437 
 438   // Create standard type for a ciType:
 439   static const Type* get_const_type(ciType* type);
 440 
 441   // Create standard zero value:
 442   static const Type* get_zero_type(BasicType type) {
 443     assert((uint)type <= T_CONFLICT && _zero_type[type] != NULL, "bad type");
 444     return _zero_type[type];
 445   }
 446 
 447   // Report if this is a zero value (not top).
 448   bool is_zero_type() const {
 449     BasicType type = basic_type();
 450     if (type == T_VOID || type >= T_CONFLICT)
 451       return false;
 452     else
 453       return (this == _zero_type[type]);
 454   }
 455 
 456   // Convenience common pre-built types.
 457   static const Type *ABIO;
 458   static const Type *BOTTOM;
 459   static const Type *CONTROL;
 460   static const Type *DOUBLE;
 461   static const Type *FLOAT;
 462   static const Type *HALF;
 463   static const Type *MEMORY;
 464   static const Type *MULTI;
 465   static const Type *RETURN_ADDRESS;
 466   static const Type *TOP;
 467 
 468   // Mapping from compiler type to VM BasicType
 469   BasicType basic_type() const       { return _type_info[_base].basic_type; }
 470   uint ideal_reg() const             { return _type_info[_base].ideal_reg; }
 471   const char* msg() const            { return _type_info[_base].msg; }
 472   bool isa_oop_ptr() const           { return _type_info[_base].isa_oop; }
 473   relocInfo::relocType reloc() const { return _type_info[_base].reloc; }
 474 
 475   // Mapping from CI type system to compiler type:
 476   static const Type* get_typeflow_type(ciType* type);
 477 
 478   static const Type* make_from_constant(ciConstant constant,
 479                                         bool require_constant = false,
 480                                         int stable_dimension = 0,
 481                                         bool is_narrow = false,
 482                                         bool is_autobox_cache = false);
 483 
 484   static const Type* make_constant_from_field(ciInstance* holder,
 485                                               int off,
 486                                               bool is_unsigned_load,
 487                                               BasicType loadbt);
 488 
 489   static const Type* make_constant_from_field(ciField* field,
 490                                               ciInstance* holder,
 491                                               BasicType loadbt,
 492                                               bool is_unsigned_load);
 493 
 494   static const Type* make_constant_from_array_element(ciArray* array,
 495                                                       int off,
 496                                                       int stable_dimension,
 497                                                       BasicType loadbt,
 498                                                       bool is_unsigned_load);
 499 
 500   // Speculative type helper methods. See TypePtr.
 501   virtual const TypePtr* speculative() const                                  { return NULL; }
 502   virtual ciKlass* speculative_type() const                                   { return NULL; }
 503   virtual ciKlass* speculative_type_not_null() const                          { return NULL; }
 504   virtual bool speculative_maybe_null() const                                 { return true; }
 505   virtual bool speculative_always_null() const                                { return true; }
 506   virtual const Type* remove_speculative() const                              { return this; }
 507   virtual const Type* cleanup_speculative() const                             { return this; }
 508   virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const { return exact_kls != NULL; }
 509   virtual bool would_improve_ptr(ProfilePtrKind ptr_kind) const { return ptr_kind == ProfileAlwaysNull || ptr_kind == ProfileNeverNull; }
 510   const Type* maybe_remove_speculative(bool include_speculative) const;
 511 
 512   virtual bool maybe_null() const { return true; }
 513   virtual bool is_known_instance() const { return false; }
 514 
 515 private:
 516   // support arrays
 517   static const Type*        _zero_type[T_CONFLICT+1];
 518   static const Type* _const_basic_type[T_CONFLICT+1];
 519 };
 520 
 521 //------------------------------TypeF------------------------------------------
 522 // Class of Float-Constant Types.
 523 class TypeF : public Type {
 524   TypeF( float f ) : Type(FloatCon), _f(f) {};
 525 public:
 526   virtual bool eq( const Type *t ) const;
 527   virtual int  hash() const;             // Type specific hashing
 528   virtual bool singleton(void) const;    // TRUE if type is a singleton
 529   virtual bool empty(void) const;        // TRUE if type is vacuous
 530 public:
 531   const float _f;               // Float constant
 532 
 533   static const TypeF *make(float f);
 534 
 535   virtual bool        is_finite() const;  // Has a finite value
 536   virtual bool        is_nan()    const;  // Is not a number (NaN)
 537 
 538   virtual const Type *xmeet( const Type *t ) const;
 539   virtual const Type *xdual() const;    // Compute dual right now.
 540   // Convenience common pre-built types.
 541   static const TypeF *MAX;
 542   static const TypeF *MIN;
 543   static const TypeF *ZERO; // positive zero only
 544   static const TypeF *ONE;
 545   static const TypeF *POS_INF;
 546   static const TypeF *NEG_INF;
 547 #ifndef PRODUCT
 548   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
 549 #endif
 550 };
 551 
 552 //------------------------------TypeD------------------------------------------
 553 // Class of Double-Constant Types.
 554 class TypeD : public Type {
 555   TypeD( double d ) : Type(DoubleCon), _d(d) {};
 556 public:
 557   virtual bool eq( const Type *t ) const;
 558   virtual int  hash() const;             // Type specific hashing
 559   virtual bool singleton(void) const;    // TRUE if type is a singleton
 560   virtual bool empty(void) const;        // TRUE if type is vacuous
 561 public:
 562   const double _d;              // Double constant
 563 
 564   static const TypeD *make(double d);
 565 
 566   virtual bool        is_finite() const;  // Has a finite value
 567   virtual bool        is_nan()    const;  // Is not a number (NaN)
 568 
 569   virtual const Type *xmeet( const Type *t ) const;
 570   virtual const Type *xdual() const;    // Compute dual right now.
 571   // Convenience common pre-built types.
 572   static const TypeD *MAX;
 573   static const TypeD *MIN;
 574   static const TypeD *ZERO; // positive zero only
 575   static const TypeD *ONE;
 576   static const TypeD *POS_INF;
 577   static const TypeD *NEG_INF;
 578 #ifndef PRODUCT
 579   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
 580 #endif
 581 };
 582 
 583 class TypeInteger : public Type {
 584 protected:
 585   TypeInteger(TYPES t) : Type(t) {}
 586 
 587 public:
 588   virtual jlong hi_as_long() const = 0;
 589   virtual jlong lo_as_long() const = 0;
 590   jlong get_con_as_long(BasicType bt) const;
 591 
 592   static const TypeInteger* make(jlong lo, jlong hi, int w, BasicType bt);
 593 
 594   static const TypeInteger* bottom(BasicType type);
 595 };
 596 
 597 
 598 
 599 //------------------------------TypeInt----------------------------------------
 600 // Class of integer ranges, the set of integers between a lower bound and an
 601 // upper bound, inclusive.
 602 class TypeInt : public TypeInteger {
 603   TypeInt( jint lo, jint hi, int w );
 604 protected:
 605   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
 606 
 607 public:
 608   typedef jint NativeType;
 609   virtual bool eq( const Type *t ) const;
 610   virtual int  hash() const;             // Type specific hashing
 611   virtual bool singleton(void) const;    // TRUE if type is a singleton
 612   virtual bool empty(void) const;        // TRUE if type is vacuous
 613   const jint _lo, _hi;          // Lower bound, upper bound
 614   const short _widen;           // Limit on times we widen this sucker
 615 
 616   static const TypeInt *make(jint lo);
 617   // must always specify w
 618   static const TypeInt *make(jint lo, jint hi, int w);
 619 
 620   // Check for single integer
 621   int is_con() const { return _lo==_hi; }
 622   bool is_con(int i) const { return is_con() && _lo == i; }
 623   jint get_con() const { assert( is_con(), "" );  return _lo; }
 624 
 625   virtual bool        is_finite() const;  // Has a finite value
 626 
 627   virtual const Type *xmeet( const Type *t ) const;
 628   virtual const Type *xdual() const;    // Compute dual right now.
 629   virtual const Type *widen( const Type *t, const Type* limit_type ) const;
 630   virtual const Type *narrow( const Type *t ) const;
 631 
 632   virtual jlong hi_as_long() const { return _hi; }
 633   virtual jlong lo_as_long() const { return _lo; }
 634 
 635   // Do not kill _widen bits.
 636   // Convenience common pre-built types.
 637   static const TypeInt *MAX;
 638   static const TypeInt *MIN;
 639   static const TypeInt *MINUS_1;
 640   static const TypeInt *ZERO;
 641   static const TypeInt *ONE;
 642   static const TypeInt *BOOL;
 643   static const TypeInt *CC;
 644   static const TypeInt *CC_LT;  // [-1]  == MINUS_1
 645   static const TypeInt *CC_GT;  // [1]   == ONE
 646   static const TypeInt *CC_EQ;  // [0]   == ZERO
 647   static const TypeInt *CC_LE;  // [-1,0]
 648   static const TypeInt *CC_GE;  // [0,1] == BOOL (!)
 649   static const TypeInt *BYTE;
 650   static const TypeInt *UBYTE;
 651   static const TypeInt *CHAR;
 652   static const TypeInt *SHORT;
 653   static const TypeInt *POS;
 654   static const TypeInt *POS1;
 655   static const TypeInt *INT;
 656   static const TypeInt *SYMINT; // symmetric range [-max_jint..max_jint]
 657   static const TypeInt *TYPE_DOMAIN; // alias for TypeInt::INT
 658 
 659   static const TypeInt *as_self(const Type *t) { return t->is_int(); }
 660 #ifndef PRODUCT
 661   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
 662 #endif
 663 };
 664 
 665 
 666 //------------------------------TypeLong---------------------------------------
 667 // Class of long integer ranges, the set of integers between a lower bound and
 668 // an upper bound, inclusive.
 669 class TypeLong : public TypeInteger {
 670   TypeLong( jlong lo, jlong hi, int w );
 671 protected:
 672   // Do not kill _widen bits.
 673   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
 674 public:
 675   typedef jlong NativeType;
 676   virtual bool eq( const Type *t ) const;
 677   virtual int  hash() const;             // Type specific hashing
 678   virtual bool singleton(void) const;    // TRUE if type is a singleton
 679   virtual bool empty(void) const;        // TRUE if type is vacuous
 680 public:
 681   const jlong _lo, _hi;         // Lower bound, upper bound
 682   const short _widen;           // Limit on times we widen this sucker
 683 
 684   static const TypeLong *make(jlong lo);
 685   // must always specify w
 686   static const TypeLong *make(jlong lo, jlong hi, int w);
 687 
 688   // Check for single integer
 689   int is_con() const { return _lo==_hi; }
 690   bool is_con(int i) const { return is_con() && _lo == i; }
 691   jlong get_con() const { assert( is_con(), "" ); return _lo; }
 692 
 693   // Check for positive 32-bit value.
 694   int is_positive_int() const { return _lo >= 0 && _hi <= (jlong)max_jint; }
 695 
 696   virtual bool        is_finite() const;  // Has a finite value
 697 
 698   virtual jlong hi_as_long() const { return _hi; }
 699   virtual jlong lo_as_long() const { return _lo; }
 700 
 701   virtual const Type *xmeet( const Type *t ) const;
 702   virtual const Type *xdual() const;    // Compute dual right now.
 703   virtual const Type *widen( const Type *t, const Type* limit_type ) const;
 704   virtual const Type *narrow( const Type *t ) const;
 705   // Convenience common pre-built types.
 706   static const TypeLong *MAX;
 707   static const TypeLong *MIN;
 708   static const TypeLong *MINUS_1;
 709   static const TypeLong *ZERO;
 710   static const TypeLong *ONE;
 711   static const TypeLong *POS;
 712   static const TypeLong *LONG;
 713   static const TypeLong *INT;    // 32-bit subrange [min_jint..max_jint]
 714   static const TypeLong *UINT;   // 32-bit unsigned [0..max_juint]
 715   static const TypeLong *TYPE_DOMAIN; // alias for TypeLong::LONG
 716 
 717   // static convenience methods.
 718   static const TypeLong *as_self(const Type *t) { return t->is_long(); }
 719 
 720 #ifndef PRODUCT
 721   virtual void dump2( Dict &d, uint, outputStream *st  ) const;// Specialized per-Type dumping
 722 #endif
 723 };
 724 
 725 //------------------------------TypeTuple--------------------------------------
 726 // Class of Tuple Types, essentially type collections for function signatures
 727 // and class layouts.  It happens to also be a fast cache for the HotSpot
 728 // signature types.
 729 class TypeTuple : public Type {
 730   TypeTuple( uint cnt, const Type **fields ) : Type(Tuple), _cnt(cnt), _fields(fields) { }
 731 
 732   const uint          _cnt;              // Count of fields
 733   const Type ** const _fields;           // Array of field types
 734 
 735 public:
 736   virtual bool eq( const Type *t ) const;
 737   virtual int  hash() const;             // Type specific hashing
 738   virtual bool singleton(void) const;    // TRUE if type is a singleton
 739   virtual bool empty(void) const;        // TRUE if type is vacuous
 740 
 741   // Accessors:
 742   uint cnt() const { return _cnt; }
 743   const Type* field_at(uint i) const {
 744     assert(i < _cnt, "oob");
 745     return _fields[i];
 746   }
 747   void set_field_at(uint i, const Type* t) {
 748     assert(i < _cnt, "oob");
 749     _fields[i] = t;
 750   }
 751 
 752   static const TypeTuple *make( uint cnt, const Type **fields );
 753   static const TypeTuple *make_range(ciSignature* sig, bool ret_vt_fields = false);
 754   static const TypeTuple *make_domain(ciMethod* method, bool vt_fields_as_args = false);
 755 
 756   // Subroutine call type with space allocated for argument types
 757   // Memory for Control, I_O, Memory, FramePtr, and ReturnAdr is allocated implicitly
 758   static const Type **fields( uint arg_cnt );
 759 
 760   virtual const Type *xmeet( const Type *t ) const;
 761   virtual const Type *xdual() const;    // Compute dual right now.
 762   // Convenience common pre-built types.
 763   static const TypeTuple *IFBOTH;
 764   static const TypeTuple *IFFALSE;
 765   static const TypeTuple *IFTRUE;
 766   static const TypeTuple *IFNEITHER;
 767   static const TypeTuple *LOOPBODY;
 768   static const TypeTuple *MEMBAR;
 769   static const TypeTuple *STORECONDITIONAL;
 770   static const TypeTuple *START_I2C;
 771   static const TypeTuple *INT_PAIR;
 772   static const TypeTuple *LONG_PAIR;
 773   static const TypeTuple *INT_CC_PAIR;
 774   static const TypeTuple *LONG_CC_PAIR;
 775 #ifndef PRODUCT
 776   virtual void dump2( Dict &d, uint, outputStream *st  ) const; // Specialized per-Type dumping
 777 #endif
 778 };
 779 
 780 //------------------------------TypeAry----------------------------------------
 781 // Class of Array Types
 782 class TypeAry : public Type {
 783   TypeAry(const Type* elem, const TypeInt* size, bool stable, bool not_flat, bool not_null_free) : Type(Array),
 784       _elem(elem), _size(size), _stable(stable), _not_flat(not_flat), _not_null_free(not_null_free) {}
 785 public:
 786   virtual bool eq( const Type *t ) const;
 787   virtual int  hash() const;             // Type specific hashing
 788   virtual bool singleton(void) const;    // TRUE if type is a singleton
 789   virtual bool empty(void) const;        // TRUE if type is vacuous
 790 
 791 private:
 792   const Type *_elem;            // Element type of array
 793   const TypeInt *_size;         // Elements in array
 794   const bool _stable;           // Are elements @Stable?
 795 
 796   // Inline type array properties
 797   const bool _not_flat;         // Array is never flattened
 798   const bool _not_null_free;    // Array is never null-free
 799 
 800   friend class TypeAryPtr;
 801 
 802 public:
 803   static const TypeAry* make(const Type* elem, const TypeInt* size, bool stable = false,
 804                              bool not_flat = false, bool not_null_free = false);
 805 
 806   virtual const Type *xmeet( const Type *t ) const;
 807   virtual const Type *xdual() const;    // Compute dual right now.
 808   bool ary_must_be_exact() const;  // true if arrays of such are never generic
 809   virtual const Type* remove_speculative() const;
 810   virtual const Type* cleanup_speculative() const;
 811 
 812 #ifdef ASSERT
 813   // One type is interface, the other is oop
 814   virtual bool interface_vs_oop(const Type *t) const;
 815 #endif
 816 #ifndef PRODUCT
 817   virtual void dump2( Dict &d, uint, outputStream *st  ) const; // Specialized per-Type dumping
 818 #endif
 819 };
 820 
 821 
 822 //------------------------------TypeValue---------------------------------------
 823 // Class of Inline Type Types
 824 class TypeInlineType : public Type {
 825 private:
 826   ciInlineKlass* _vk;
 827   bool _larval;
 828 
 829 protected:
 830   TypeInlineType(ciInlineKlass* vk, bool larval)
 831     : Type(InlineType),
 832       _vk(vk), _larval(larval) {
 833   }
 834 
 835 public:
 836   static const TypeInlineType* make(ciInlineKlass* vk, bool larval = false);
 837   virtual ciInlineKlass* inline_klass() const { return _vk; }
 838   bool larval() const { return _larval; }
 839 
 840   virtual bool eq(const Type* t) const;
 841   virtual int  hash() const;             // Type specific hashing
 842   virtual bool singleton(void) const;    // TRUE if type is a singleton
 843   virtual bool empty(void) const;        // TRUE if type is vacuous
 844 
 845   virtual const Type* xmeet(const Type* t) const;
 846   virtual const Type* xdual() const;     // Compute dual right now.
 847 
 848   virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const { return false; }
 849   virtual bool would_improve_ptr(ProfilePtrKind ptr_kind) const { return false; }
 850 
 851   virtual bool maybe_null() const { return false; }
 852 
 853   static const TypeInlineType* BOTTOM;
 854 
 855 #ifndef PRODUCT
 856   virtual void dump2(Dict &d, uint, outputStream* st) const; // Specialized per-Type dumping
 857 #endif
 858 };
 859 
 860 //------------------------------TypeVect---------------------------------------
 861 // Class of Vector Types
 862 class TypeVect : public Type {
 863   const Type*   _elem;  // Vector's element type
 864   const uint  _length;  // Elements in vector (power of 2)
 865 
 866 protected:
 867   TypeVect(TYPES t, const Type* elem, uint length) : Type(t),
 868     _elem(elem), _length(length) {}
 869 
 870 public:
 871   const Type* element_type() const { return _elem; }
 872   BasicType element_basic_type() const { return _elem->array_element_basic_type(); }
 873   uint length() const { return _length; }
 874   uint length_in_bytes() const {
 875    return _length * type2aelembytes(element_basic_type());
 876   }
 877 
 878   virtual bool eq(const Type *t) const;
 879   virtual int  hash() const;             // Type specific hashing
 880   virtual bool singleton(void) const;    // TRUE if type is a singleton
 881   virtual bool empty(void) const;        // TRUE if type is vacuous
 882 
 883   static const TypeVect *make(const BasicType elem_bt, uint length) {
 884     // Use bottom primitive type.
 885     return make(get_const_basic_type(elem_bt), length);
 886   }
 887   // Used directly by Replicate nodes to construct singleton vector.
 888   static const TypeVect *make(const Type* elem, uint length);
 889 
 890   static const TypeVect *makemask(const BasicType elem_bt, uint length) {
 891     // Use bottom primitive type.
 892     return makemask(get_const_basic_type(elem_bt), length);
 893   }
 894   static const TypeVect *makemask(const Type* elem, uint length);
 895 
 896 
 897   virtual const Type *xmeet( const Type *t) const;
 898   virtual const Type *xdual() const;     // Compute dual right now.
 899 
 900   static const TypeVect *VECTA;
 901   static const TypeVect *VECTS;
 902   static const TypeVect *VECTD;
 903   static const TypeVect *VECTX;
 904   static const TypeVect *VECTY;
 905   static const TypeVect *VECTZ;
 906   static const TypeVect *VECTMASK;
 907 
 908 #ifndef PRODUCT
 909   virtual void dump2(Dict &d, uint, outputStream *st) const; // Specialized per-Type dumping
 910 #endif
 911 };
 912 
 913 class TypeVectA : public TypeVect {
 914   friend class TypeVect;
 915   TypeVectA(const Type* elem, uint length) : TypeVect(VectorA, elem, length) {}
 916 };
 917 
 918 class TypeVectS : public TypeVect {
 919   friend class TypeVect;
 920   TypeVectS(const Type* elem, uint length) : TypeVect(VectorS, elem, length) {}
 921 };
 922 
 923 class TypeVectD : public TypeVect {
 924   friend class TypeVect;
 925   TypeVectD(const Type* elem, uint length) : TypeVect(VectorD, elem, length) {}
 926 };
 927 
 928 class TypeVectX : public TypeVect {
 929   friend class TypeVect;
 930   TypeVectX(const Type* elem, uint length) : TypeVect(VectorX, elem, length) {}
 931 };
 932 
 933 class TypeVectY : public TypeVect {
 934   friend class TypeVect;
 935   TypeVectY(const Type* elem, uint length) : TypeVect(VectorY, elem, length) {}
 936 };
 937 
 938 class TypeVectZ : public TypeVect {
 939   friend class TypeVect;
 940   TypeVectZ(const Type* elem, uint length) : TypeVect(VectorZ, elem, length) {}
 941 };
 942 
 943 class TypeVectMask : public TypeVect {
 944 public:
 945   friend class TypeVect;
 946   TypeVectMask(const Type* elem, uint length) : TypeVect(VectorMask, elem, length) {}
 947   virtual bool eq(const Type *t) const;
 948   virtual const Type *xdual() const;
 949 };
 950 
 951 //------------------------------TypePtr----------------------------------------
 952 // Class of machine Pointer Types: raw data, instances or arrays.
 953 // If the _base enum is AnyPtr, then this refers to all of the above.
 954 // Otherwise the _base will indicate which subset of pointers is affected,
 955 // and the class will be inherited from.
 956 class TypePtr : public Type {
 957   friend class TypeNarrowPtr;
 958 public:
 959   enum PTR { TopPTR, AnyNull, Constant, Null, NotNull, BotPTR, lastPTR };
 960 protected:
 961   TypePtr(TYPES t, PTR ptr, Offset offset,
 962           const TypePtr* speculative = NULL,
 963           int inline_depth = InlineDepthBottom) :
 964     Type(t), _speculative(speculative), _inline_depth(inline_depth), _offset(offset),
 965     _ptr(ptr) {}
 966   static const PTR ptr_meet[lastPTR][lastPTR];
 967   static const PTR ptr_dual[lastPTR];
 968   static const char * const ptr_msg[lastPTR];
 969 
 970   enum {
 971     InlineDepthBottom = INT_MAX,
 972     InlineDepthTop = -InlineDepthBottom
 973   };
 974 
 975   // Extra type information profiling gave us. We propagate it the
 976   // same way the rest of the type info is propagated. If we want to
 977   // use it, then we have to emit a guard: this part of the type is
 978   // not something we know but something we speculate about the type.
 979   const TypePtr*   _speculative;
 980   // For speculative types, we record at what inlining depth the
 981   // profiling point that provided the data is. We want to favor
 982   // profile data coming from outer scopes which are likely better for
 983   // the current compilation.
 984   int _inline_depth;
 985 
 986   // utility methods to work on the speculative part of the type
 987   const TypePtr* dual_speculative() const;
 988   const TypePtr* xmeet_speculative(const TypePtr* other) const;
 989   bool eq_speculative(const TypePtr* other) const;
 990   int hash_speculative() const;
 991   const TypePtr* add_offset_speculative(intptr_t offset) const;
 992 #ifndef PRODUCT
 993   void dump_speculative(outputStream *st) const;
 994 #endif
 995 
 996   // utility methods to work on the inline depth of the type
 997   int dual_inline_depth() const;
 998   int meet_inline_depth(int depth) const;
 999 #ifndef PRODUCT
1000   void dump_inline_depth(outputStream *st) const;
1001 #endif
1002 
1003   // TypeInstPtr (TypeAryPtr resp.) and TypeInstKlassPtr (TypeAryKlassPtr resp.) implement very similar meet logic.
1004   // The logic for meeting 2 instances (2 arrays resp.) is shared in the 2 utility methods below. However the logic for
1005   // the oop and klass versions can be slightly different and extra logic may have to be executed depending on what
1006   // exact case the meet falls into. The MeetResult struct is used by the utility methods to communicate what case was
1007   // encountered so the right logic specific to klasses or oops can be executed.,
1008   enum MeetResult {
1009     QUICK,
1010     UNLOADED,
1011     SUBTYPE,
1012     NOT_SUBTYPE,
1013     LCA
1014   };
1015   static MeetResult
1016   meet_instptr(PTR &ptr, ciKlass* this_klass, ciKlass* tinst_klass, bool this_xk, bool tinst_xk, PTR this_ptr,
1017                PTR tinst_ptr, bool this_flatten_array, bool tinst_flatten_array, ciKlass*&res_klass, bool &res_xk,
1018                bool& res_flatten_array);
1019 
1020   static MeetResult meet_aryptr(PTR &ptr, const Type* this_elem, const Type* tap_elem, ciKlass* this_klass, ciKlass* tap_klass,
1021                                 bool this_xk, bool tap_xk, PTR this_ptr, PTR tap_ptr, bool this_not_flat, bool tap_not_flat,
1022                                 bool this_not_null_free, bool tap_not_null_free, const Type*& res_elem, ciKlass*&res_klass,
1023                                 bool &res_xk, bool &res_not_flat, bool &res_not_null_free);
1024 
1025 public:
1026   const Offset _offset;         // Offset into oop, with TOP & BOT
1027   const PTR _ptr;               // Pointer equivalence class
1028 
1029   const int offset() const { return _offset.get(); }
1030   const PTR ptr()    const { return _ptr; }
1031 
1032   static const TypePtr* make(TYPES t, PTR ptr, Offset offset,
1033                              const TypePtr* speculative = NULL,
1034                              int inline_depth = InlineDepthBottom);
1035 
1036   // Return a 'ptr' version of this type
1037   virtual const Type *cast_to_ptr_type(PTR ptr) const;
1038 
1039   virtual intptr_t get_con() const;
1040 
1041   Offset xadd_offset(intptr_t offset) const;
1042   virtual const TypePtr *add_offset( intptr_t offset ) const;
1043   virtual const int flattened_offset() const { return offset(); }
1044 
1045   virtual bool eq(const Type *t) const;
1046   virtual int  hash() const;             // Type specific hashing
1047 
1048   virtual bool singleton(void) const;    // TRUE if type is a singleton
1049   virtual bool empty(void) const;        // TRUE if type is vacuous
1050   virtual const Type *xmeet( const Type *t ) const;
1051   virtual const Type *xmeet_helper( const Type *t ) const;
1052   Offset meet_offset(int offset) const;
1053   Offset dual_offset() const;
1054   virtual const Type *xdual() const;    // Compute dual right now.
1055 
1056   // meet, dual and join over pointer equivalence sets
1057   PTR meet_ptr( const PTR in_ptr ) const { return ptr_meet[in_ptr][ptr()]; }
1058   PTR dual_ptr()                   const { return ptr_dual[ptr()];      }
1059 
1060   // This is textually confusing unless one recalls that
1061   // join(t) == dual()->meet(t->dual())->dual().
1062   PTR join_ptr( const PTR in_ptr ) const {
1063     return ptr_dual[ ptr_meet[ ptr_dual[in_ptr] ] [ dual_ptr() ] ];
1064   }
1065 
1066   // Speculative type helper methods.
1067   virtual const TypePtr* speculative() const { return _speculative; }
1068   int inline_depth() const                   { return _inline_depth; }
1069   virtual ciKlass* speculative_type() const;
1070   virtual ciKlass* speculative_type_not_null() const;
1071   virtual bool speculative_maybe_null() const;
1072   virtual bool speculative_always_null() const;
1073   virtual const Type* remove_speculative() const;
1074   virtual const Type* cleanup_speculative() const;
1075   virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1076   virtual bool would_improve_ptr(ProfilePtrKind maybe_null) const;
1077   virtual const TypePtr* with_inline_depth(int depth) const;
1078 
1079   virtual bool maybe_null() const { return meet_ptr(Null) == ptr(); }
1080 
1081   virtual bool can_be_inline_type() const { return false; }
1082   virtual bool flatten_array() const { return false; }
1083   virtual bool is_not_flat() const { return false; }
1084   virtual bool is_not_null_free() const { return false; }
1085 
1086   // Tests for relation to centerline of type lattice:
1087   static bool above_centerline(PTR ptr) { return (ptr <= AnyNull); }
1088   static bool below_centerline(PTR ptr) { return (ptr >= NotNull); }
1089   // Convenience common pre-built types.
1090   static const TypePtr *NULL_PTR;
1091   static const TypePtr *NOTNULL;
1092   static const TypePtr *BOTTOM;
1093 #ifndef PRODUCT
1094   virtual void dump2( Dict &d, uint depth, outputStream *st  ) const;
1095 #endif
1096 };
1097 
1098 //------------------------------TypeRawPtr-------------------------------------
1099 // Class of raw pointers, pointers to things other than Oops.  Examples
1100 // include the stack pointer, top of heap, card-marking area, handles, etc.
1101 class TypeRawPtr : public TypePtr {
1102 protected:
1103   TypeRawPtr(PTR ptr, address bits) : TypePtr(RawPtr,ptr,Offset(0)), _bits(bits){}
1104 public:
1105   virtual bool eq( const Type *t ) const;
1106   virtual int  hash() const;     // Type specific hashing
1107 
1108   const address _bits;          // Constant value, if applicable
1109 
1110   static const TypeRawPtr *make( PTR ptr );
1111   static const TypeRawPtr *make( address bits );
1112 
1113   // Return a 'ptr' version of this type
1114   virtual const TypeRawPtr* cast_to_ptr_type(PTR ptr) const;
1115 
1116   virtual intptr_t get_con() const;
1117 
1118   virtual const TypePtr *add_offset( intptr_t offset ) const;
1119 
1120   virtual const Type *xmeet( const Type *t ) const;
1121   virtual const Type *xdual() const;    // Compute dual right now.
1122   // Convenience common pre-built types.
1123   static const TypeRawPtr *BOTTOM;
1124   static const TypeRawPtr *NOTNULL;
1125 #ifndef PRODUCT
1126   virtual void dump2( Dict &d, uint depth, outputStream *st  ) const;
1127 #endif
1128 };
1129 
1130 //------------------------------TypeOopPtr-------------------------------------
1131 // Some kind of oop (Java pointer), either instance or array.
1132 class TypeOopPtr : public TypePtr {
1133 protected:
1134   TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset, Offset field_offset,
1135              int instance_id, const TypePtr* speculative, int inline_depth);
1136 public:
1137   virtual bool eq( const Type *t ) const;
1138   virtual int  hash() const;             // Type specific hashing
1139   virtual bool singleton(void) const;    // TRUE if type is a singleton
1140   enum {
1141    InstanceTop = -1,   // undefined instance
1142    InstanceBot = 0     // any possible instance
1143   };
1144 protected:
1145 
1146   // Oop is NULL, unless this is a constant oop.
1147   ciObject*     _const_oop;   // Constant oop
1148   // If _klass is NULL, then so is _sig.  This is an unloaded klass.
1149   ciKlass*      _klass;       // Klass object
1150   // Does the type exclude subclasses of the klass?  (Inexact == polymorphic.)
1151   bool          _klass_is_exact;
1152   bool          _is_ptr_to_narrowoop;
1153   bool          _is_ptr_to_narrowklass;
1154   bool          _is_ptr_to_boxed_value;
1155 
1156   // If not InstanceTop or InstanceBot, indicates that this is
1157   // a particular instance of this type which is distinct.
1158   // This is the node index of the allocation node creating this instance.
1159   int           _instance_id;
1160 
1161   static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact);
1162 
1163   int dual_instance_id() const;
1164   int meet_instance_id(int uid) const;
1165 
1166   // Do not allow interface-vs.-noninterface joins to collapse to top.
1167   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1168 
1169 public:
1170   // Creates a type given a klass. Correctly handles multi-dimensional arrays
1171   // Respects UseUniqueSubclasses.
1172   // If the klass is final, the resulting type will be exact.
1173   static const TypeOopPtr* make_from_klass(ciKlass* klass) {
1174     return make_from_klass_common(klass, true, false);
1175   }
1176   // Same as before, but will produce an exact type, even if
1177   // the klass is not final, as long as it has exactly one implementation.
1178   static const TypeOopPtr* make_from_klass_unique(ciKlass* klass) {
1179     return make_from_klass_common(klass, true, true);
1180   }
1181   // Same as before, but does not respects UseUniqueSubclasses.
1182   // Use this only for creating array element types.
1183   static const TypeOopPtr* make_from_klass_raw(ciKlass* klass) {
1184     return make_from_klass_common(klass, false, false);
1185   }
1186   // Creates a singleton type given an object.
1187   // If the object cannot be rendered as a constant,
1188   // may return a non-singleton type.
1189   // If require_constant, produce a NULL if a singleton is not possible.
1190   static const TypeOopPtr* make_from_constant(ciObject* o,
1191                                               bool require_constant = false);
1192 
1193   // Make a generic (unclassed) pointer to an oop.
1194   static const TypeOopPtr* make(PTR ptr, Offset offset, int instance_id,
1195                                 const TypePtr* speculative = NULL,
1196                                 int inline_depth = InlineDepthBottom);
1197 
1198   ciObject* const_oop()    const { return _const_oop; }
1199   virtual ciKlass* klass() const { return _klass;     }
1200   bool klass_is_exact()    const { return _klass_is_exact; }
1201 
1202   // Returns true if this pointer points at memory which contains a
1203   // compressed oop references.
1204   bool is_ptr_to_narrowoop_nv() const { return _is_ptr_to_narrowoop; }
1205   bool is_ptr_to_narrowklass_nv() const { return _is_ptr_to_narrowklass; }
1206   bool is_ptr_to_boxed_value()   const { return _is_ptr_to_boxed_value; }
1207   bool is_known_instance()       const { return _instance_id > 0; }
1208   int  instance_id()             const { return _instance_id; }
1209   bool is_known_instance_field() const { return is_known_instance() && _offset.get() >= 0; }
1210 
1211   virtual bool can_be_inline_type() const { return EnableValhalla && (_klass == NULL || _klass->can_be_inline_klass(_klass_is_exact)); }
1212 
1213   virtual intptr_t get_con() const;
1214 
1215   virtual const TypeOopPtr* cast_to_ptr_type(PTR ptr) const;
1216 
1217   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1218 
1219   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1220 
1221   // corresponding pointer to klass, for a given instance
1222   virtual const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1223 
1224   virtual const TypePtr *add_offset( intptr_t offset ) const;
1225 
1226   // Speculative type helper methods.
1227   virtual const Type* remove_speculative() const;
1228   virtual const Type* cleanup_speculative() const;
1229   virtual bool would_improve_type(ciKlass* exact_kls, int inline_depth) const;
1230   virtual const TypePtr* with_inline_depth(int depth) const;
1231 
1232   virtual const TypePtr* with_instance_id(int instance_id) const;
1233 
1234   virtual const Type *xdual() const;    // Compute dual right now.
1235   // the core of the computation of the meet for TypeOopPtr and for its subclasses
1236   virtual const Type *xmeet_helper(const Type *t) const;
1237 
1238   // Convenience common pre-built type.
1239   static const TypeOopPtr *BOTTOM;
1240 #ifndef PRODUCT
1241   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1242 #endif
1243 };
1244 
1245 //------------------------------TypeInstPtr------------------------------------
1246 // Class of Java object pointers, pointing either to non-array Java instances
1247 // or to a Klass* (including array klasses).
1248 class TypeInstPtr : public TypeOopPtr {
1249   TypeInstPtr(PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset,
1250               bool flatten_array, int instance_id, const TypePtr* speculative,
1251               int inline_depth);
1252   virtual bool eq( const Type *t ) const;
1253   virtual int  hash() const;             // Type specific hashing
1254 
1255   ciSymbol*  _name;        // class name
1256   bool _flatten_array;     // Type is flat in arrays
1257 
1258  public:
1259   ciSymbol* name()         const { return _name; }
1260 
1261   bool  is_loaded() const { return _klass->is_loaded(); }
1262 
1263   // Make a pointer to a constant oop.
1264   static const TypeInstPtr *make(ciObject* o) {
1265     return make(TypePtr::Constant, o->klass(), true, o, Offset(0));
1266   }
1267   // Make a pointer to a constant oop with offset.
1268   static const TypeInstPtr* make(ciObject* o, Offset offset) {
1269     return make(TypePtr::Constant, o->klass(), true, o, offset);
1270   }
1271 
1272   // Make a pointer to some value of type klass.
1273   static const TypeInstPtr *make(PTR ptr, ciKlass* klass) {
1274     return make(ptr, klass, false, NULL, Offset(0));
1275   }
1276 
1277   // Make a pointer to some non-polymorphic value of exactly type klass.
1278   static const TypeInstPtr *make_exact(PTR ptr, ciKlass* klass) {
1279     return make(ptr, klass, true, NULL, Offset(0));
1280   }
1281 
1282   // Make a pointer to some value of type klass with offset.
1283   static const TypeInstPtr *make(PTR ptr, ciKlass* klass, Offset offset) {
1284     return make(ptr, klass, false, NULL, offset);
1285   }
1286 
1287   // Make a pointer to an oop.
1288   static const TypeInstPtr* make(PTR ptr, ciKlass* k, bool xk, ciObject* o, Offset offset,
1289                                  bool flatten_array = false,
1290                                  int instance_id = InstanceBot,
1291                                  const TypePtr* speculative = NULL,
1292                                  int inline_depth = InlineDepthBottom);
1293 
1294   /** Create constant type for a constant boxed value */
1295   const Type* get_const_boxed_value() const;
1296 
1297   // If this is a java.lang.Class constant, return the type for it or NULL.
1298   // Pass to Type::get_const_type to turn it to a type, which will usually
1299   // be a TypeInstPtr, but may also be a TypeInt::INT for int.class, etc.
1300   ciType* java_mirror_type(bool* is_val_mirror = NULL) const;
1301 
1302   virtual const TypeInstPtr* cast_to_ptr_type(PTR ptr) const;
1303 
1304   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1305 
1306   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1307 
1308   virtual const TypePtr *add_offset( intptr_t offset ) const;
1309 
1310   // Speculative type helper methods.
1311   virtual const Type* remove_speculative() const;
1312   virtual const TypePtr* with_inline_depth(int depth) const;
1313   virtual const TypePtr* with_instance_id(int instance_id) const;
1314 
1315   virtual const TypeInstPtr* cast_to_flatten_array() const;
1316   virtual bool flatten_array() const { return _flatten_array; }
1317 
1318   // the core of the computation of the meet of 2 types
1319   virtual const Type *xmeet_helper(const Type *t) const;
1320   virtual const TypeInstPtr *xmeet_unloaded( const TypeInstPtr *t ) const;
1321   virtual const Type *xdual() const;    // Compute dual right now.
1322 
1323   const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1324 
1325   // Convenience common pre-built types.
1326   static const TypeInstPtr *NOTNULL;
1327   static const TypeInstPtr *BOTTOM;
1328   static const TypeInstPtr *MIRROR;
1329   static const TypeInstPtr *MARK;
1330   static const TypeInstPtr *KLASS;
1331 #ifndef PRODUCT
1332   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1333 #endif
1334 };
1335 
1336 //------------------------------TypeAryPtr-------------------------------------
1337 // Class of Java array pointers
1338 class TypeAryPtr : public TypeOopPtr {
1339   TypeAryPtr(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk,
1340              Offset offset, Offset field_offset, int instance_id, bool is_autobox_cache,
1341              const TypePtr* speculative, int inline_depth)
1342     : TypeOopPtr(AryPtr, ptr, k, xk, o, offset, field_offset, instance_id, speculative, inline_depth),
1343     _ary(ary),
1344     _is_autobox_cache(is_autobox_cache),
1345     _field_offset(field_offset)
1346  {
1347 #ifdef ASSERT
1348     if (k != NULL) {
1349       // Verify that specified klass and TypeAryPtr::klass() follow the same rules.
1350       ciKlass* ck = compute_klass(true);
1351       if (k != ck) {
1352         this->dump(); tty->cr();
1353         tty->print(" k: ");
1354         k->print(); tty->cr();
1355         tty->print("ck: ");
1356         if (ck != NULL) ck->print();
1357         else tty->print("<NULL>");
1358         tty->cr();
1359         assert(false, "unexpected TypeAryPtr::_klass");
1360       }
1361     }
1362 #endif
1363   }
1364   virtual bool eq( const Type *t ) const;
1365   virtual int hash() const;     // Type specific hashing
1366   const TypeAry *_ary;          // Array we point into
1367   const bool     _is_autobox_cache;
1368   // For flattened inline type arrays, each field of the inline type in
1369   // the array has its own memory slice so we need to keep track of
1370   // which field is accessed
1371   const Offset _field_offset;
1372   Offset meet_field_offset(const Type::Offset offset) const;
1373   Offset dual_field_offset() const;
1374 
1375   ciKlass* compute_klass(DEBUG_ONLY(bool verify = false)) const;
1376 
1377 public:
1378   // Accessors
1379   ciKlass* klass() const;
1380   const TypeAry* ary() const  { return _ary; }
1381   const Type*    elem() const { return _ary->_elem; }
1382   const TypeInt* size() const { return _ary->_size; }
1383   bool      is_stable() const { return _ary->_stable; }
1384 
1385   // Inline type array properties
1386   bool is_flat()          const { return _ary->_elem->isa_inlinetype() != NULL; }
1387   bool is_not_flat()      const { return _ary->_not_flat; }
1388   bool is_null_free()     const { return is_flat() || (_ary->_elem->make_ptr() != NULL && _ary->_elem->make_ptr()->is_inlinetypeptr() && !_ary->_elem->make_ptr()->maybe_null()); }
1389   bool is_not_null_free() const { return _ary->_not_null_free; }
1390 
1391   bool is_autobox_cache() const { return _is_autobox_cache; }
1392 
1393   static const TypeAryPtr* make(PTR ptr, const TypeAry *ary, ciKlass* k, bool xk, Offset offset,
1394                                 Offset field_offset = Offset::bottom,
1395                                 int instance_id = InstanceBot,
1396                                 const TypePtr* speculative = NULL,
1397                                 int inline_depth = InlineDepthBottom);
1398   // Constant pointer to array
1399   static const TypeAryPtr* make(PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, Offset offset,
1400                                 Offset field_offset = Offset::bottom,
1401                                 int instance_id = InstanceBot,
1402                                 const TypePtr* speculative = NULL,
1403                                 int inline_depth = InlineDepthBottom,
1404                                 bool is_autobox_cache = false);
1405 
1406   // Return a 'ptr' version of this type
1407   virtual const TypeAryPtr* cast_to_ptr_type(PTR ptr) const;
1408 
1409   virtual const Type *cast_to_exactness(bool klass_is_exact) const;
1410 
1411   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
1412 
1413   virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
1414   virtual const TypeInt* narrow_size_type(const TypeInt* size) const;
1415 
1416   virtual bool empty(void) const;        // TRUE if type is vacuous
1417   virtual const TypePtr *add_offset( intptr_t offset ) const;
1418 
1419   // Speculative type helper methods.
1420   virtual const Type* remove_speculative() const;
1421   virtual const Type* cleanup_speculative() const;
1422   virtual const TypePtr* with_inline_depth(int depth) const;
1423   virtual const TypePtr* with_instance_id(int instance_id) const;
1424 
1425   // the core of the computation of the meet of 2 types
1426   virtual const Type *xmeet_helper(const Type *t) const;
1427   virtual const Type *xdual() const;    // Compute dual right now.
1428 
1429   // Inline type array properties
1430   const TypeAryPtr* cast_to_not_flat(bool not_flat = true) const;
1431   const TypeAryPtr* cast_to_not_null_free(bool not_null_free = true) const;
1432   const TypeAryPtr* update_properties(const TypeAryPtr* new_type) const;
1433 
1434   const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const;
1435   int stable_dimension() const;
1436 
1437   const TypeAryPtr* cast_to_autobox_cache() const;
1438 
1439   static jint max_array_length(BasicType etype);
1440 
1441   const int flattened_offset() const;
1442   const Offset field_offset() const { return _field_offset; }
1443   const TypeAryPtr* with_field_offset(int offset) const;
1444   const TypePtr* add_field_offset_and_offset(intptr_t offset) const;
1445 
1446   virtual bool can_be_inline_type() const { return false; }
1447   virtual const TypeKlassPtr* as_klass_type(bool try_for_exact = false) const;
1448 
1449   // Convenience common pre-built types.
1450   static const TypeAryPtr *RANGE;
1451   static const TypeAryPtr *OOPS;
1452   static const TypeAryPtr *NARROWOOPS;
1453   static const TypeAryPtr *BYTES;
1454   static const TypeAryPtr *SHORTS;
1455   static const TypeAryPtr *CHARS;
1456   static const TypeAryPtr *INTS;
1457   static const TypeAryPtr *LONGS;
1458   static const TypeAryPtr *FLOATS;
1459   static const TypeAryPtr *DOUBLES;
1460   static const TypeAryPtr *INLINES;
1461   // selects one of the above:
1462   static const TypeAryPtr *get_array_body_type(BasicType elem) {
1463     assert((uint)elem <= T_CONFLICT && _array_body_type[elem] != NULL, "bad elem type");
1464     return _array_body_type[elem];
1465   }
1466   static const TypeAryPtr *_array_body_type[T_CONFLICT+1];
1467   // sharpen the type of an int which is used as an array size
1468 #ifdef ASSERT
1469   // One type is interface, the other is oop
1470   virtual bool interface_vs_oop(const Type *t) const;
1471 #endif
1472 #ifndef PRODUCT
1473   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1474 #endif
1475 };
1476 
1477 //------------------------------TypeMetadataPtr-------------------------------------
1478 // Some kind of metadata, either Method*, MethodData* or CPCacheOop
1479 class TypeMetadataPtr : public TypePtr {
1480 protected:
1481   TypeMetadataPtr(PTR ptr, ciMetadata* metadata, Offset offset);
1482   // Do not allow interface-vs.-noninterface joins to collapse to top.
1483   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1484 public:
1485   virtual bool eq( const Type *t ) const;
1486   virtual int  hash() const;             // Type specific hashing
1487   virtual bool singleton(void) const;    // TRUE if type is a singleton
1488 
1489 private:
1490   ciMetadata*   _metadata;
1491 
1492 public:
1493   static const TypeMetadataPtr* make(PTR ptr, ciMetadata* m, Offset offset);
1494 
1495   static const TypeMetadataPtr* make(ciMethod* m);
1496   static const TypeMetadataPtr* make(ciMethodData* m);
1497 
1498   ciMetadata* metadata() const { return _metadata; }
1499 
1500   virtual const TypeMetadataPtr* cast_to_ptr_type(PTR ptr) const;
1501 
1502   virtual const TypePtr *add_offset( intptr_t offset ) const;
1503 
1504   virtual const Type *xmeet( const Type *t ) const;
1505   virtual const Type *xdual() const;    // Compute dual right now.
1506 
1507   virtual intptr_t get_con() const;
1508 
1509   // Convenience common pre-built types.
1510   static const TypeMetadataPtr *BOTTOM;
1511 
1512 #ifndef PRODUCT
1513   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1514 #endif
1515 };
1516 
1517 //------------------------------TypeKlassPtr-----------------------------------
1518 // Class of Java Klass pointers
1519 class TypeKlassPtr : public TypePtr {
1520 protected:
1521   TypeKlassPtr(TYPES t, PTR ptr, ciKlass* klass, Offset offset);
1522 
1523   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1524 
1525 public:
1526   virtual bool eq( const Type *t ) const;
1527   virtual int hash() const;
1528   virtual bool singleton(void) const;    // TRUE if type is a singleton
1529   virtual bool must_be_exact() const { ShouldNotReachHere(); return false; }
1530 
1531 protected:
1532 
1533   ciKlass* _klass;
1534 
1535 public:
1536 
1537   virtual ciKlass* klass() const { return  _klass; }
1538   bool klass_is_exact()    const { return _ptr == Constant; }
1539   bool  is_loaded() const { return klass()->is_loaded(); }
1540 
1541   static const TypeKlassPtr* make(ciKlass* klass);
1542   static const TypeKlassPtr *make(PTR ptr, ciKlass* klass, Offset offset);
1543 
1544 
1545   virtual const TypePtr* cast_to_ptr_type(PTR ptr) const { ShouldNotReachHere(); return NULL; }
1546 
1547   virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const { ShouldNotReachHere(); return NULL; }
1548 
1549   // corresponding pointer to instance, for a given class
1550   virtual const TypeOopPtr* as_instance_type() const { ShouldNotReachHere(); return NULL; }
1551 
1552   virtual const TypePtr *add_offset( intptr_t offset ) const { ShouldNotReachHere(); return NULL; }
1553   virtual const Type    *xmeet( const Type *t ) const { ShouldNotReachHere(); return NULL; }
1554   virtual const Type    *xdual() const { ShouldNotReachHere(); return NULL; }
1555 
1556   virtual intptr_t get_con() const;
1557 
1558   virtual const TypeKlassPtr* with_offset(intptr_t offset) const { ShouldNotReachHere(); return NULL; }
1559 };
1560 
1561 // Instance klass pointer, mirrors TypeInstPtr
1562 class TypeInstKlassPtr : public TypeKlassPtr {
1563 
1564   TypeInstKlassPtr(PTR ptr, ciKlass* klass, Offset offset, bool flatten_array)
1565     : TypeKlassPtr(InstKlassPtr, ptr, klass, offset), _flatten_array(flatten_array) {
1566   }
1567 
1568   virtual bool must_be_exact() const;
1569 
1570   const bool _flatten_array; // Type is flat in arrays
1571 
1572 public:
1573   // Instance klass ignoring any interface
1574   ciInstanceKlass* instance_klass() const { return klass()->as_instance_klass();     }
1575 
1576   virtual bool can_be_inline_type() const { return EnableValhalla && (_klass == NULL || _klass->can_be_inline_klass(klass_is_exact())); }
1577 
1578   static const TypeInstKlassPtr *make(ciKlass* k) {
1579     return make(TypePtr::Constant, k, Offset(0), false);
1580   }
1581   static const TypeInstKlassPtr *make(PTR ptr, ciKlass* k, Offset offset, bool flatten_array = false);
1582 
1583   virtual const TypePtr* cast_to_ptr_type(PTR ptr) const;
1584 
1585   virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const;
1586 
1587   // corresponding pointer to instance, for a given class
1588   virtual const TypeOopPtr* as_instance_type() const;
1589   virtual int hash() const;
1590   virtual bool eq(const Type *t) const;
1591 
1592   virtual const TypePtr *add_offset( intptr_t offset ) const;
1593   virtual const Type    *xmeet( const Type *t ) const;
1594   virtual const Type    *xdual() const;
1595   virtual const TypeKlassPtr* with_offset(intptr_t offset) const;
1596 
1597   virtual bool flatten_array() const { return _flatten_array; }
1598 
1599   // Convenience common pre-built types.
1600   static const TypeInstKlassPtr* OBJECT; // Not-null object klass or below
1601   static const TypeInstKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same
1602 
1603 #ifndef PRODUCT
1604   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1605 #endif
1606 };
1607 
1608 // Array klass pointer, mirrors TypeAryPtr
1609 class TypeAryKlassPtr : public TypeKlassPtr {
1610   const Type *_elem;
1611   const bool _not_flat;      // Array is never flattened
1612   const bool _not_null_free; // Array is never null-free
1613   const bool _null_free;
1614 
1615   TypeAryKlassPtr(PTR ptr, const Type *elem, ciKlass* klass, Offset offset, bool not_flat, int not_null_free, bool null_free)
1616     : TypeKlassPtr(AryKlassPtr, ptr, klass, offset), _elem(elem), _not_flat(not_flat), _not_null_free(not_null_free), _null_free(null_free) {
1617   }
1618 
1619   virtual bool must_be_exact() const;
1620 
1621   bool dual_null_free() const {
1622     return _null_free;
1623   }
1624 
1625   bool meet_null_free(bool other) const {
1626     return _null_free && other;
1627   }
1628 
1629 public:
1630   virtual ciKlass* klass() const;
1631 
1632   // returns base element type, an instance klass (and not interface) for object arrays
1633   const Type* base_element_type(int& dims) const;
1634 
1635   static const TypeAryKlassPtr *make(PTR ptr, ciKlass* k, Offset offset, bool not_flat, bool not_null_free, bool null_free);
1636   static const TypeAryKlassPtr *make(PTR ptr, const Type *elem, ciKlass* k, Offset offset, bool not_flat, bool not_null_free, bool null_free);
1637   static const TypeAryKlassPtr* make(ciKlass* klass, PTR ptr = Constant, Offset offset= Offset(0));
1638 
1639   const Type *elem() const { return _elem; }
1640 
1641   virtual bool eq(const Type *t) const;
1642   virtual int hash() const;             // Type specific hashing
1643 
1644   virtual const TypePtr* cast_to_ptr_type(PTR ptr) const;
1645 
1646   virtual const TypeKlassPtr *cast_to_exactness(bool klass_is_exact) const;
1647 
1648   // corresponding pointer to instance, for a given class
1649   virtual const TypeOopPtr* as_instance_type() const;
1650 
1651   virtual const TypePtr *add_offset( intptr_t offset ) const;
1652   virtual const Type    *xmeet( const Type *t ) const;
1653   virtual const Type    *xdual() const;      // Compute dual right now.
1654 
1655   virtual const TypeKlassPtr* with_offset(intptr_t offset) const;
1656 
1657   virtual bool empty(void) const {
1658     return TypeKlassPtr::empty() || _elem->empty();
1659   }
1660 
1661   virtual bool is_not_flat() const { return _not_flat; }
1662   virtual bool is_not_null_free() const { return _not_null_free; }
1663   bool null_free() const { return _null_free; }
1664 
1665 #ifndef PRODUCT
1666   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1667 #endif
1668 };
1669 
1670 class TypeNarrowPtr : public Type {
1671 protected:
1672   const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR
1673 
1674   TypeNarrowPtr(TYPES t, const TypePtr* ptrtype): Type(t),
1675                                                   _ptrtype(ptrtype) {
1676     assert(ptrtype->offset() == 0 ||
1677            ptrtype->offset() == OffsetBot ||
1678            ptrtype->offset() == OffsetTop, "no real offsets");
1679   }
1680 
1681   virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const = 0;
1682   virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const = 0;
1683   virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const = 0;
1684   virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const = 0;
1685   // Do not allow interface-vs.-noninterface joins to collapse to top.
1686   virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
1687 public:
1688   virtual bool eq( const Type *t ) const;
1689   virtual int  hash() const;             // Type specific hashing
1690   virtual bool singleton(void) const;    // TRUE if type is a singleton
1691 
1692   virtual const Type *xmeet( const Type *t ) const;
1693   virtual const Type *xdual() const;    // Compute dual right now.
1694 
1695   virtual intptr_t get_con() const;
1696 
1697   virtual bool empty(void) const;        // TRUE if type is vacuous
1698 
1699   // returns the equivalent ptr type for this compressed pointer
1700   const TypePtr *get_ptrtype() const {
1701     return _ptrtype;
1702   }
1703 
1704   bool is_known_instance() const {
1705     return _ptrtype->is_known_instance();
1706   }
1707 
1708 #ifndef PRODUCT
1709   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1710 #endif
1711 };
1712 
1713 //------------------------------TypeNarrowOop----------------------------------
1714 // A compressed reference to some kind of Oop.  This type wraps around
1715 // a preexisting TypeOopPtr and forwards most of it's operations to
1716 // the underlying type.  It's only real purpose is to track the
1717 // oopness of the compressed oop value when we expose the conversion
1718 // between the normal and the compressed form.
1719 class TypeNarrowOop : public TypeNarrowPtr {
1720 protected:
1721   TypeNarrowOop( const TypePtr* ptrtype): TypeNarrowPtr(NarrowOop, ptrtype) {
1722   }
1723 
1724   virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const {
1725     return t->isa_narrowoop();
1726   }
1727 
1728   virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const {
1729     return t->is_narrowoop();
1730   }
1731 
1732   virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const {
1733     return new TypeNarrowOop(t);
1734   }
1735 
1736   virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const {
1737     return (const TypeNarrowPtr*)((new TypeNarrowOop(t))->hashcons());
1738   }
1739 
1740 public:
1741 
1742   static const TypeNarrowOop *make( const TypePtr* type);
1743 
1744   static const TypeNarrowOop* make_from_constant(ciObject* con, bool require_constant = false) {
1745     return make(TypeOopPtr::make_from_constant(con, require_constant));
1746   }
1747 
1748   static const TypeNarrowOop *BOTTOM;
1749   static const TypeNarrowOop *NULL_PTR;
1750 
1751   virtual const Type* remove_speculative() const;
1752   virtual const Type* cleanup_speculative() const;
1753 
1754 #ifndef PRODUCT
1755   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1756 #endif
1757 };
1758 
1759 //------------------------------TypeNarrowKlass----------------------------------
1760 // A compressed reference to klass pointer.  This type wraps around a
1761 // preexisting TypeKlassPtr and forwards most of it's operations to
1762 // the underlying type.
1763 class TypeNarrowKlass : public TypeNarrowPtr {
1764 protected:
1765   TypeNarrowKlass( const TypePtr* ptrtype): TypeNarrowPtr(NarrowKlass, ptrtype) {
1766   }
1767 
1768   virtual const TypeNarrowPtr *isa_same_narrowptr(const Type *t) const {
1769     return t->isa_narrowklass();
1770   }
1771 
1772   virtual const TypeNarrowPtr *is_same_narrowptr(const Type *t) const {
1773     return t->is_narrowklass();
1774   }
1775 
1776   virtual const TypeNarrowPtr *make_same_narrowptr(const TypePtr *t) const {
1777     return new TypeNarrowKlass(t);
1778   }
1779 
1780   virtual const TypeNarrowPtr *make_hash_same_narrowptr(const TypePtr *t) const {
1781     return (const TypeNarrowPtr*)((new TypeNarrowKlass(t))->hashcons());
1782   }
1783 
1784 public:
1785   static const TypeNarrowKlass *make( const TypePtr* type);
1786 
1787   // static const TypeNarrowKlass *BOTTOM;
1788   static const TypeNarrowKlass *NULL_PTR;
1789 
1790 #ifndef PRODUCT
1791   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
1792 #endif
1793 };
1794 
1795 //------------------------------TypeFunc---------------------------------------
1796 // Class of Array Types
1797 class TypeFunc : public Type {
1798   TypeFunc(const TypeTuple *domain_sig, const TypeTuple *domain_cc, const TypeTuple *range_sig, const TypeTuple *range_cc)
1799     : Type(Function), _domain_sig(domain_sig), _domain_cc(domain_cc), _range_sig(range_sig), _range_cc(range_cc) {}
1800   virtual bool eq( const Type *t ) const;
1801   virtual int  hash() const;             // Type specific hashing
1802   virtual bool singleton(void) const;    // TRUE if type is a singleton
1803   virtual bool empty(void) const;        // TRUE if type is vacuous
1804 
1805   // Domains of inputs: inline type arguments are not passed by
1806   // reference, instead each field of the inline type is passed as an
1807   // argument. We maintain 2 views of the argument list here: one
1808   // based on the signature (with an inline type argument as a single
1809   // slot), one based on the actual calling convention (with a value
1810   // type argument as a list of its fields).
1811   const TypeTuple* const _domain_sig;
1812   const TypeTuple* const _domain_cc;
1813   // Range of results. Similar to domains: an inline type result can be
1814   // returned in registers in which case range_cc lists all fields and
1815   // is the actual calling convention.
1816   const TypeTuple* const _range_sig;
1817   const TypeTuple* const _range_cc;
1818 
1819 public:
1820   // Constants are shared among ADLC and VM
1821   enum { Control    = AdlcVMDeps::Control,
1822          I_O        = AdlcVMDeps::I_O,
1823          Memory     = AdlcVMDeps::Memory,
1824          FramePtr   = AdlcVMDeps::FramePtr,
1825          ReturnAdr  = AdlcVMDeps::ReturnAdr,
1826          Parms      = AdlcVMDeps::Parms
1827   };
1828 
1829 
1830   // Accessors:
1831   const TypeTuple* domain_sig() const { return _domain_sig; }
1832   const TypeTuple* domain_cc()  const { return _domain_cc; }
1833   const TypeTuple* range_sig()  const { return _range_sig; }
1834   const TypeTuple* range_cc()   const { return _range_cc; }
1835 
1836   static const TypeFunc* make(ciMethod* method, bool is_osr_compilation = false);
1837   static const TypeFunc *make(const TypeTuple* domain_sig, const TypeTuple* domain_cc,
1838                               const TypeTuple* range_sig, const TypeTuple* range_cc);
1839   static const TypeFunc *make(const TypeTuple* domain, const TypeTuple* range);
1840 
1841   virtual const Type *xmeet( const Type *t ) const;
1842   virtual const Type *xdual() const;    // Compute dual right now.
1843 
1844   BasicType return_type() const;
1845 
1846   bool returns_inline_type_as_fields() const { return range_sig() != range_cc(); }
1847 
1848 #ifndef PRODUCT
1849   virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping
1850 #endif
1851   // Convenience common pre-built types.
1852 };
1853 
1854 //------------------------------accessors--------------------------------------
1855 inline bool Type::is_ptr_to_narrowoop() const {
1856 #ifdef _LP64
1857   return (isa_oopptr() != NULL && is_oopptr()->is_ptr_to_narrowoop_nv());
1858 #else
1859   return false;
1860 #endif
1861 }
1862 
1863 inline bool Type::is_ptr_to_narrowklass() const {
1864 #ifdef _LP64
1865   return (isa_oopptr() != NULL && is_oopptr()->is_ptr_to_narrowklass_nv());
1866 #else
1867   return false;
1868 #endif
1869 }
1870 
1871 inline float Type::getf() const {
1872   assert( _base == FloatCon, "Not a FloatCon" );
1873   return ((TypeF*)this)->_f;
1874 }
1875 
1876 inline double Type::getd() const {
1877   assert( _base == DoubleCon, "Not a DoubleCon" );
1878   return ((TypeD*)this)->_d;
1879 }
1880 
1881 inline const TypeInteger *Type::is_integer(BasicType bt) const {
1882   assert((bt == T_INT && _base == Int) || (bt == T_LONG && _base == Long), "Not an Int");
1883   return (TypeInteger*)this;
1884 }
1885 
1886 inline const TypeInteger *Type::isa_integer(BasicType bt) const {
1887   return (((bt == T_INT && _base == Int) || (bt == T_LONG && _base == Long)) ? (TypeInteger*)this : NULL);
1888 }
1889 
1890 inline const TypeInt *Type::is_int() const {
1891   assert( _base == Int, "Not an Int" );
1892   return (TypeInt*)this;
1893 }
1894 
1895 inline const TypeInt *Type::isa_int() const {
1896   return ( _base == Int ? (TypeInt*)this : NULL);
1897 }
1898 
1899 inline const TypeLong *Type::is_long() const {
1900   assert( _base == Long, "Not a Long" );
1901   return (TypeLong*)this;
1902 }
1903 
1904 inline const TypeLong *Type::isa_long() const {
1905   return ( _base == Long ? (TypeLong*)this : NULL);
1906 }
1907 
1908 inline const TypeF *Type::isa_float() const {
1909   return ((_base == FloatTop ||
1910            _base == FloatCon ||
1911            _base == FloatBot) ? (TypeF*)this : NULL);
1912 }
1913 
1914 inline const TypeF *Type::is_float_constant() const {
1915   assert( _base == FloatCon, "Not a Float" );
1916   return (TypeF*)this;
1917 }
1918 
1919 inline const TypeF *Type::isa_float_constant() const {
1920   return ( _base == FloatCon ? (TypeF*)this : NULL);
1921 }
1922 
1923 inline const TypeD *Type::isa_double() const {
1924   return ((_base == DoubleTop ||
1925            _base == DoubleCon ||
1926            _base == DoubleBot) ? (TypeD*)this : NULL);
1927 }
1928 
1929 inline const TypeD *Type::is_double_constant() const {
1930   assert( _base == DoubleCon, "Not a Double" );
1931   return (TypeD*)this;
1932 }
1933 
1934 inline const TypeD *Type::isa_double_constant() const {
1935   return ( _base == DoubleCon ? (TypeD*)this : NULL);
1936 }
1937 
1938 inline const TypeTuple *Type::is_tuple() const {
1939   assert( _base == Tuple, "Not a Tuple" );
1940   return (TypeTuple*)this;
1941 }
1942 
1943 inline const TypeAry *Type::is_ary() const {
1944   assert( _base == Array , "Not an Array" );
1945   return (TypeAry*)this;
1946 }
1947 
1948 inline const TypeAry *Type::isa_ary() const {
1949   return ((_base == Array) ? (TypeAry*)this : NULL);
1950 }
1951 
1952 inline const TypeVectMask *Type::is_vectmask() const {
1953   assert( _base == VectorMask, "Not a Vector Mask" );
1954   return (TypeVectMask*)this;
1955 }
1956 
1957 inline const TypeVectMask *Type::isa_vectmask() const {
1958   return (_base == VectorMask) ? (TypeVectMask*)this : NULL;
1959 }
1960 
1961 inline const TypeVect *Type::is_vect() const {
1962   assert( _base >= VectorMask && _base <= VectorZ, "Not a Vector" );
1963   return (TypeVect*)this;
1964 }
1965 
1966 inline const TypeVect *Type::isa_vect() const {
1967   return (_base >= VectorMask && _base <= VectorZ) ? (TypeVect*)this : NULL;
1968 }
1969 
1970 inline const TypePtr *Type::is_ptr() const {
1971   // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between.
1972   assert(_base >= AnyPtr && _base <= AryKlassPtr, "Not a pointer");
1973   return (TypePtr*)this;
1974 }
1975 
1976 inline const TypePtr *Type::isa_ptr() const {
1977   // AnyPtr is the first Ptr and KlassPtr the last, with no non-ptrs between.
1978   return (_base >= AnyPtr && _base <= AryKlassPtr) ? (TypePtr*)this : NULL;
1979 }
1980 
1981 inline const TypeOopPtr *Type::is_oopptr() const {
1982   // OopPtr is the first and KlassPtr the last, with no non-oops between.
1983   assert(_base >= OopPtr && _base <= AryPtr, "Not a Java pointer" ) ;
1984   return (TypeOopPtr*)this;
1985 }
1986 
1987 inline const TypeOopPtr *Type::isa_oopptr() const {
1988   // OopPtr is the first and KlassPtr the last, with no non-oops between.
1989   return (_base >= OopPtr && _base <= AryPtr) ? (TypeOopPtr*)this : NULL;
1990 }
1991 
1992 inline const TypeRawPtr *Type::isa_rawptr() const {
1993   return (_base == RawPtr) ? (TypeRawPtr*)this : NULL;
1994 }
1995 
1996 inline const TypeRawPtr *Type::is_rawptr() const {
1997   assert( _base == RawPtr, "Not a raw pointer" );
1998   return (TypeRawPtr*)this;
1999 }
2000 
2001 inline const TypeInstPtr *Type::isa_instptr() const {
2002   return (_base == InstPtr) ? (TypeInstPtr*)this : NULL;
2003 }
2004 
2005 inline const TypeInstPtr *Type::is_instptr() const {
2006   assert( _base == InstPtr, "Not an object pointer" );
2007   return (TypeInstPtr*)this;
2008 }
2009 
2010 inline const TypeAryPtr *Type::isa_aryptr() const {
2011   return (_base == AryPtr) ? (TypeAryPtr*)this : NULL;
2012 }
2013 
2014 inline const TypeAryPtr *Type::is_aryptr() const {
2015   assert( _base == AryPtr, "Not an array pointer" );
2016   return (TypeAryPtr*)this;
2017 }
2018 
2019 inline const TypeInlineType* Type::isa_inlinetype() const {
2020   return (_base == InlineType) ? (TypeInlineType*)this : NULL;
2021 }
2022 
2023 inline const TypeInlineType* Type::is_inlinetype() const {
2024   assert(_base == InlineType, "Not an inline type");
2025   return (TypeInlineType*)this;
2026 }
2027 
2028 inline const TypeNarrowOop *Type::is_narrowoop() const {
2029   // OopPtr is the first and KlassPtr the last, with no non-oops between.
2030   assert(_base == NarrowOop, "Not a narrow oop" ) ;
2031   return (TypeNarrowOop*)this;
2032 }
2033 
2034 inline const TypeNarrowOop *Type::isa_narrowoop() const {
2035   // OopPtr is the first and KlassPtr the last, with no non-oops between.
2036   return (_base == NarrowOop) ? (TypeNarrowOop*)this : NULL;
2037 }
2038 
2039 inline const TypeNarrowKlass *Type::is_narrowklass() const {
2040   assert(_base == NarrowKlass, "Not a narrow oop" ) ;
2041   return (TypeNarrowKlass*)this;
2042 }
2043 
2044 inline const TypeNarrowKlass *Type::isa_narrowklass() const {
2045   return (_base == NarrowKlass) ? (TypeNarrowKlass*)this : NULL;
2046 }
2047 
2048 inline const TypeMetadataPtr *Type::is_metadataptr() const {
2049   // MetadataPtr is the first and CPCachePtr the last
2050   assert(_base == MetadataPtr, "Not a metadata pointer" ) ;
2051   return (TypeMetadataPtr*)this;
2052 }
2053 
2054 inline const TypeMetadataPtr *Type::isa_metadataptr() const {
2055   return (_base == MetadataPtr) ? (TypeMetadataPtr*)this : NULL;
2056 }
2057 
2058 inline const TypeKlassPtr *Type::isa_klassptr() const {
2059   return (_base >= KlassPtr && _base <= AryKlassPtr ) ? (TypeKlassPtr*)this : NULL;
2060 }
2061 
2062 inline const TypeKlassPtr *Type::is_klassptr() const {
2063   assert(_base >= KlassPtr && _base <= AryKlassPtr, "Not a klass pointer");
2064   return (TypeKlassPtr*)this;
2065 }
2066 
2067 inline const TypeInstKlassPtr *Type::isa_instklassptr() const {
2068   return (_base == InstKlassPtr) ? (TypeInstKlassPtr*)this : NULL;
2069 }
2070 
2071 inline const TypeInstKlassPtr *Type::is_instklassptr() const {
2072   assert(_base == InstKlassPtr, "Not a klass pointer");
2073   return (TypeInstKlassPtr*)this;
2074 }
2075 
2076 inline const TypeAryKlassPtr *Type::isa_aryklassptr() const {
2077   return (_base == AryKlassPtr) ? (TypeAryKlassPtr*)this : NULL;
2078 }
2079 
2080 inline const TypeAryKlassPtr *Type::is_aryklassptr() const {
2081   assert(_base == AryKlassPtr, "Not a klass pointer");
2082   return (TypeAryKlassPtr*)this;
2083 }
2084 
2085 inline const TypePtr* Type::make_ptr() const {
2086   return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype() :
2087                               ((_base == NarrowKlass) ? is_narrowklass()->get_ptrtype() :
2088                                                        isa_ptr());
2089 }
2090 
2091 inline const TypeOopPtr* Type::make_oopptr() const {
2092   return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype()->isa_oopptr() : isa_oopptr();
2093 }
2094 
2095 inline const TypeNarrowOop* Type::make_narrowoop() const {
2096   return (_base == NarrowOop) ? is_narrowoop() :
2097                                 (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL);
2098 }
2099 
2100 inline const TypeNarrowKlass* Type::make_narrowklass() const {
2101   return (_base == NarrowKlass) ? is_narrowklass() :
2102                                   (isa_ptr() ? TypeNarrowKlass::make(is_ptr()) : NULL);
2103 }
2104 
2105 inline bool Type::is_floatingpoint() const {
2106   if( (_base == FloatCon)  || (_base == FloatBot) ||
2107       (_base == DoubleCon) || (_base == DoubleBot) )
2108     return true;
2109   return false;
2110 }
2111 
2112 inline bool Type::is_inlinetypeptr() const {
2113   return isa_instptr() != NULL && is_instptr()->klass()->is_inlinetype();
2114 }
2115 
2116 
2117 inline ciInlineKlass* Type::inline_klass() const {
2118   assert(is_inlinetypeptr(), "must be an inline type ptr");
2119   return is_instptr()->klass()->as_inline_klass();
2120 }
2121 
2122 
2123 // ===============================================================
2124 // Things that need to be 64-bits in the 64-bit build but
2125 // 32-bits in the 32-bit build.  Done this way to get full
2126 // optimization AND strong typing.
2127 #ifdef _LP64
2128 
2129 // For type queries and asserts
2130 #define is_intptr_t  is_long
2131 #define isa_intptr_t isa_long
2132 #define find_intptr_t_type find_long_type
2133 #define find_intptr_t_con  find_long_con
2134 #define TypeX        TypeLong
2135 #define Type_X       Type::Long
2136 #define TypeX_X      TypeLong::LONG
2137 #define TypeX_ZERO   TypeLong::ZERO
2138 // For 'ideal_reg' machine registers
2139 #define Op_RegX      Op_RegL
2140 // For phase->intcon variants
2141 #define MakeConX     longcon
2142 #define ConXNode     ConLNode
2143 // For array index arithmetic
2144 #define MulXNode     MulLNode
2145 #define AndXNode     AndLNode
2146 #define OrXNode      OrLNode
2147 #define CmpXNode     CmpLNode
2148 #define CmpUXNode    CmpULNode
2149 #define SubXNode     SubLNode
2150 #define LShiftXNode  LShiftLNode
2151 // For object size computation:
2152 #define AddXNode     AddLNode
2153 #define RShiftXNode  RShiftLNode
2154 // For card marks and hashcodes
2155 #define URShiftXNode URShiftLNode
2156 // For shenandoahSupport
2157 #define LoadXNode    LoadLNode
2158 #define StoreXNode   StoreLNode
2159 // Opcodes
2160 #define Op_LShiftX   Op_LShiftL
2161 #define Op_AndX      Op_AndL
2162 #define Op_AddX      Op_AddL
2163 #define Op_SubX      Op_SubL
2164 #define Op_XorX      Op_XorL
2165 #define Op_URShiftX  Op_URShiftL
2166 #define Op_LoadX     Op_LoadL
2167 #define Op_StoreX    Op_StoreL
2168 // conversions
2169 #define ConvI2X(x)   ConvI2L(x)
2170 #define ConvL2X(x)   (x)
2171 #define ConvX2I(x)   ConvL2I(x)
2172 #define ConvX2L(x)   (x)
2173 #define ConvX2UL(x)  (x)
2174 
2175 #else
2176 
2177 // For type queries and asserts
2178 #define is_intptr_t  is_int
2179 #define isa_intptr_t isa_int
2180 #define find_intptr_t_type find_int_type
2181 #define find_intptr_t_con  find_int_con
2182 #define TypeX        TypeInt
2183 #define Type_X       Type::Int
2184 #define TypeX_X      TypeInt::INT
2185 #define TypeX_ZERO   TypeInt::ZERO
2186 // For 'ideal_reg' machine registers
2187 #define Op_RegX      Op_RegI
2188 // For phase->intcon variants
2189 #define MakeConX     intcon
2190 #define ConXNode     ConINode
2191 // For array index arithmetic
2192 #define MulXNode     MulINode
2193 #define AndXNode     AndINode
2194 #define OrXNode      OrINode
2195 #define CmpXNode     CmpINode
2196 #define CmpUXNode    CmpUNode
2197 #define SubXNode     SubINode
2198 #define LShiftXNode  LShiftINode
2199 // For object size computation:
2200 #define AddXNode     AddINode
2201 #define RShiftXNode  RShiftINode
2202 // For card marks and hashcodes
2203 #define URShiftXNode URShiftINode
2204 // For shenandoahSupport
2205 #define LoadXNode    LoadINode
2206 #define StoreXNode   StoreINode
2207 // Opcodes
2208 #define Op_LShiftX   Op_LShiftI
2209 #define Op_AndX      Op_AndI
2210 #define Op_AddX      Op_AddI
2211 #define Op_SubX      Op_SubI
2212 #define Op_XorX      Op_XorI
2213 #define Op_URShiftX  Op_URShiftI
2214 #define Op_LoadX     Op_LoadI
2215 #define Op_StoreX    Op_StoreI
2216 // conversions
2217 #define ConvI2X(x)   (x)
2218 #define ConvL2X(x)   ConvL2I(x)
2219 #define ConvX2I(x)   (x)
2220 #define ConvX2L(x)   ConvI2L(x)
2221 #define ConvX2UL(x)  ConvI2UL(x)
2222 
2223 #endif
2224 
2225 #endif // SHARE_OPTO_TYPE_HPP