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