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