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