628 TypeAryPtr::LONGS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeLong::LONG ,TypeInt::POS), ciTypeArrayKlass::make(T_LONG), true, Offset::bottom);
629 TypeAryPtr::FLOATS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::FLOAT ,TypeInt::POS), ciTypeArrayKlass::make(T_FLOAT), true, Offset::bottom);
630 TypeAryPtr::DOUBLES = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::DOUBLE ,TypeInt::POS), ciTypeArrayKlass::make(T_DOUBLE), true, Offset::bottom);
631
632 // Nobody should ask _array_body_type[T_NARROWOOP]. Use NULL as assert.
633 TypeAryPtr::_array_body_type[T_NARROWOOP] = NULL;
634 TypeAryPtr::_array_body_type[T_OBJECT] = TypeAryPtr::OOPS;
635 TypeAryPtr::_array_body_type[T_ARRAY] = TypeAryPtr::OOPS; // arrays are stored in oop arrays
636 TypeAryPtr::_array_body_type[T_VALUETYPE] = TypeAryPtr::OOPS;
637 TypeAryPtr::_array_body_type[T_BYTE] = TypeAryPtr::BYTES;
638 TypeAryPtr::_array_body_type[T_BOOLEAN] = TypeAryPtr::BYTES; // boolean[] is a byte array
639 TypeAryPtr::_array_body_type[T_SHORT] = TypeAryPtr::SHORTS;
640 TypeAryPtr::_array_body_type[T_CHAR] = TypeAryPtr::CHARS;
641 TypeAryPtr::_array_body_type[T_INT] = TypeAryPtr::INTS;
642 TypeAryPtr::_array_body_type[T_LONG] = TypeAryPtr::LONGS;
643 TypeAryPtr::_array_body_type[T_FLOAT] = TypeAryPtr::FLOATS;
644 TypeAryPtr::_array_body_type[T_DOUBLE] = TypeAryPtr::DOUBLES;
645
646 TypeKlassPtr::OBJECT = TypeKlassPtr::make(TypePtr::NotNull, current->env()->Object_klass(), Offset(0) );
647 TypeKlassPtr::OBJECT_OR_NULL = TypeKlassPtr::make(TypePtr::BotPTR, current->env()->Object_klass(), Offset(0) );
648
649 const Type **fi2c = TypeTuple::fields(2);
650 fi2c[TypeFunc::Parms+0] = TypeInstPtr::BOTTOM; // Method*
651 fi2c[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // argument pointer
652 TypeTuple::START_I2C = TypeTuple::make(TypeFunc::Parms+2, fi2c);
653
654 const Type **intpair = TypeTuple::fields(2);
655 intpair[0] = TypeInt::INT;
656 intpair[1] = TypeInt::INT;
657 TypeTuple::INT_PAIR = TypeTuple::make(2, intpair);
658
659 const Type **longpair = TypeTuple::fields(2);
660 longpair[0] = TypeLong::LONG;
661 longpair[1] = TypeLong::LONG;
662 TypeTuple::LONG_PAIR = TypeTuple::make(2, longpair);
663
664 const Type **intccpair = TypeTuple::fields(2);
665 intccpair[0] = TypeInt::INT;
666 intccpair[1] = TypeInt::CC;
667 TypeTuple::INT_CC_PAIR = TypeTuple::make(2, intccpair);
5231 return make(Constant, m, Offset(0));
5232 }
5233 const TypeMetadataPtr* TypeMetadataPtr::make(ciMethodData* m) {
5234 return make(Constant, m, Offset(0));
5235 }
5236
5237 //------------------------------make-------------------------------------------
5238 // Create a meta data constant
5239 const TypeMetadataPtr* TypeMetadataPtr::make(PTR ptr, ciMetadata* m, Offset offset) {
5240 assert(m == NULL || !m->is_klass(), "wrong type");
5241 return (TypeMetadataPtr*)(new TypeMetadataPtr(ptr, m, offset))->hashcons();
5242 }
5243
5244
5245 //=============================================================================
5246 // Convenience common pre-built types.
5247
5248 // Not-null object klass or below
5249 const TypeKlassPtr *TypeKlassPtr::OBJECT;
5250 const TypeKlassPtr *TypeKlassPtr::OBJECT_OR_NULL;
5251
5252 //------------------------------TypeKlassPtr-----------------------------------
5253 TypeKlassPtr::TypeKlassPtr( PTR ptr, ciKlass* klass, Offset offset )
5254 : TypePtr(KlassPtr, ptr, offset), _klass(klass), _klass_is_exact(ptr == Constant) {
5255 }
5256
5257 //------------------------------make-------------------------------------------
5258 // ptr to klass 'k', if Constant, or possibly to a sub-klass if not a Constant
5259 const TypeKlassPtr* TypeKlassPtr::make(PTR ptr, ciKlass* k, Offset offset) {
5260 assert( k != NULL, "Expect a non-NULL klass");
5261 assert(k->is_instance_klass() || k->is_array_klass(), "Incorrect type of klass oop");
5262 TypeKlassPtr *r =
5263 (TypeKlassPtr*)(new TypeKlassPtr(ptr, k, offset))->hashcons();
5264
5265 return r;
5266 }
5267
5268 //------------------------------eq---------------------------------------------
5269 // Structural equality check for Type representations
5270 bool TypeKlassPtr::eq( const Type *t ) const {
5271 const TypeKlassPtr *p = t->is_klassptr();
5272 return
5273 klass()->equals(p->klass()) &&
5274 TypePtr::eq(p);
5275 }
5276
5277 //------------------------------hash-------------------------------------------
5278 // Type-specific hashing function.
5279 int TypeKlassPtr::hash(void) const {
5280 return java_add(klass()->hash(), TypePtr::hash());
5281 }
5282
5283 //------------------------------singleton--------------------------------------
5284 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple
5285 // constants
5286 bool TypeKlassPtr::singleton(void) const {
5287 // detune optimizer to not generate constant klass + constant offset as a constant!
5288 // TopPTR, Null, AnyNull, Constant are all singletons
5289 return (offset() == 0) && !below_centerline(_ptr);
5290 }
5291
5292 // Do not allow interface-vs.-noninterface joins to collapse to top.
5293 const Type *TypeKlassPtr::filter_helper(const Type *kills, bool include_speculative) const {
5294 // logic here mirrors the one from TypeOopPtr::filter. See comments
5295 // there.
5296 const Type* ft = join_helper(kills, include_speculative);
5297 const TypeKlassPtr* ftkp = ft->isa_klassptr();
5298 const TypeKlassPtr* ktkp = kills->isa_klassptr();
5299
5300 if (ft->empty()) {
5301 if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
5302 return kills; // Uplift to interface
5303
5304 return Type::TOP; // Canonical empty value
5305 }
5306
5307 // Interface klass type could be exact in opposite to interface type,
5308 // return it here instead of incorrect Constant ptr J/L/Object (6894807).
5309 if (ftkp != NULL && ktkp != NULL &&
5310 ftkp->is_loaded() && ftkp->klass()->is_interface() &&
5311 !ftkp->klass_is_exact() && // Keep exact interface klass
5312 ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
5313 return ktkp->cast_to_ptr_type(ftkp->ptr());
5314 }
5315
5316 return ft;
5317 }
5318
5319 //----------------------compute_klass------------------------------------------
5320 // Compute the defining klass for this class
5321 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
5415 const Type *TypeKlassPtr::cast_to_ptr_type(PTR ptr) const {
5416 assert(_base == KlassPtr, "subclass must override cast_to_ptr_type");
5417 if( ptr == _ptr ) return this;
5418 return make(ptr, _klass, _offset);
5419 }
5420
5421
5422 //-----------------------------cast_to_exactness-------------------------------
5423 const Type *TypeKlassPtr::cast_to_exactness(bool klass_is_exact) const {
5424 if( klass_is_exact == _klass_is_exact ) return this;
5425 if (!UseExactTypes) return this;
5426 return make(klass_is_exact ? Constant : NotNull, _klass, _offset);
5427 }
5428
5429
5430 //-----------------------------as_instance_type--------------------------------
5431 // Corresponding type for an instance of the given class.
5432 // It will be NotNull, and exact if and only if the klass type is exact.
5433 const TypeOopPtr* TypeKlassPtr::as_instance_type() const {
5434 ciKlass* k = klass();
5435 bool xk = klass_is_exact();
5436 //return TypeInstPtr::make(TypePtr::NotNull, k, xk, NULL, 0);
5437 const TypeOopPtr* toop = TypeOopPtr::make_from_klass_raw(k);
5438 guarantee(toop != NULL, "need type for given klass");
5439 toop = toop->cast_to_ptr_type(TypePtr::NotNull)->is_oopptr();
5440 return toop->cast_to_exactness(xk)->is_oopptr();
5441 }
5442
5443
5444 //------------------------------xmeet------------------------------------------
5445 // Compute the MEET of two types, return a new Type object.
5446 const Type *TypeKlassPtr::xmeet( const Type *t ) const {
5447 // Perform a fast test for common case; meeting the same types together.
5448 if( this == t ) return this; // Meeting same type-rep?
5449
5450 // Current "this->_base" is Pointer
5451 switch (t->base()) { // switch on original type
5452
5453 case Int: // Mixing ints & oops happens when javac
5454 case Long: // reuses local variables
5499 // A-top }
5500 // / | \ } Tops
5501 // B-top A-any C-top }
5502 // | / | \ | } Any-nulls
5503 // B-any | C-any }
5504 // | | |
5505 // B-con A-con C-con } constants; not comparable across classes
5506 // | | |
5507 // B-not | C-not }
5508 // | \ | / | } not-nulls
5509 // B-bot A-not C-bot }
5510 // \ | / } Bottoms
5511 // A-bot }
5512 //
5513
5514 case KlassPtr: { // Meet two KlassPtr types
5515 const TypeKlassPtr *tkls = t->is_klassptr();
5516 Offset off = meet_offset(tkls->offset());
5517 PTR ptr = meet_ptr(tkls->ptr());
5518
5519 // Check for easy case; klasses are equal (and perhaps not loaded!)
5520 // If we have constants, then we created oops so classes are loaded
5521 // and we can handle the constants further down. This case handles
5522 // not-loaded classes
5523 if( ptr != Constant && tkls->klass()->equals(klass()) ) {
5524 return make( ptr, klass(), off );
5525 }
5526
5527 // Classes require inspection in the Java klass hierarchy. Must be loaded.
5528 ciKlass* tkls_klass = tkls->klass();
5529 ciKlass* this_klass = this->klass();
5530 assert( tkls_klass->is_loaded(), "This class should have been loaded.");
5531 assert( this_klass->is_loaded(), "This class should have been loaded.");
5532
5533 // If 'this' type is above the centerline and is a superclass of the
5534 // other, we can treat 'this' as having the same type as the other.
5535 if ((above_centerline(this->ptr())) &&
5536 tkls_klass->is_subtype_of(this_klass)) {
5537 this_klass = tkls_klass;
5538 }
5589 // to a handle at compile time. This handle is embedded in the generated
5590 // code and dereferenced at the time the nmethod is made. Until that time,
5591 // it is not reasonable to do arithmetic with the addresses of oops (we don't
5592 // have access to the addresses!). This does not seem to currently happen,
5593 // but this assertion here is to help prevent its occurence.
5594 tty->print_cr("Found oop constant with non-zero offset");
5595 ShouldNotReachHere();
5596 }
5597
5598 return (intptr_t)klass()->constant_encoding();
5599 }
5600 //------------------------------dump2------------------------------------------
5601 // Dump Klass Type
5602 #ifndef PRODUCT
5603 void TypeKlassPtr::dump2( Dict & d, uint depth, outputStream *st ) const {
5604 switch( _ptr ) {
5605 case Constant:
5606 st->print("precise ");
5607 case NotNull:
5608 {
5609 const char *name = klass()->name()->as_utf8();
5610 if( name ) {
5611 st->print("klass %s: " INTPTR_FORMAT, name, p2i(klass()));
5612 } else {
5613 ShouldNotReachHere();
5614 }
5615 }
5616 case BotPTR:
5617 if( !WizardMode && !Verbose && !_klass_is_exact ) break;
5618 case TopPTR:
5619 case AnyNull:
5620 st->print(":%s", ptr_msg[_ptr]);
5621 if( _klass_is_exact ) st->print(":exact");
5622 break;
5623 }
5624
5625 _offset.dump2(st);
5626
5627 st->print(" *");
5628 }
5629 #endif
5630
5631
5632
5633 //=============================================================================
|
628 TypeAryPtr::LONGS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeLong::LONG ,TypeInt::POS), ciTypeArrayKlass::make(T_LONG), true, Offset::bottom);
629 TypeAryPtr::FLOATS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::FLOAT ,TypeInt::POS), ciTypeArrayKlass::make(T_FLOAT), true, Offset::bottom);
630 TypeAryPtr::DOUBLES = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(Type::DOUBLE ,TypeInt::POS), ciTypeArrayKlass::make(T_DOUBLE), true, Offset::bottom);
631
632 // Nobody should ask _array_body_type[T_NARROWOOP]. Use NULL as assert.
633 TypeAryPtr::_array_body_type[T_NARROWOOP] = NULL;
634 TypeAryPtr::_array_body_type[T_OBJECT] = TypeAryPtr::OOPS;
635 TypeAryPtr::_array_body_type[T_ARRAY] = TypeAryPtr::OOPS; // arrays are stored in oop arrays
636 TypeAryPtr::_array_body_type[T_VALUETYPE] = TypeAryPtr::OOPS;
637 TypeAryPtr::_array_body_type[T_BYTE] = TypeAryPtr::BYTES;
638 TypeAryPtr::_array_body_type[T_BOOLEAN] = TypeAryPtr::BYTES; // boolean[] is a byte array
639 TypeAryPtr::_array_body_type[T_SHORT] = TypeAryPtr::SHORTS;
640 TypeAryPtr::_array_body_type[T_CHAR] = TypeAryPtr::CHARS;
641 TypeAryPtr::_array_body_type[T_INT] = TypeAryPtr::INTS;
642 TypeAryPtr::_array_body_type[T_LONG] = TypeAryPtr::LONGS;
643 TypeAryPtr::_array_body_type[T_FLOAT] = TypeAryPtr::FLOATS;
644 TypeAryPtr::_array_body_type[T_DOUBLE] = TypeAryPtr::DOUBLES;
645
646 TypeKlassPtr::OBJECT = TypeKlassPtr::make(TypePtr::NotNull, current->env()->Object_klass(), Offset(0) );
647 TypeKlassPtr::OBJECT_OR_NULL = TypeKlassPtr::make(TypePtr::BotPTR, current->env()->Object_klass(), Offset(0) );
648 TypeKlassPtr::BOTTOM = (EnableValhalla | EnableMVT) ? TypeKlassPtr::make(TypePtr::BotPTR, NULL, Offset(0)) : TypeKlassPtr::OBJECT_OR_NULL;
649
650 const Type **fi2c = TypeTuple::fields(2);
651 fi2c[TypeFunc::Parms+0] = TypeInstPtr::BOTTOM; // Method*
652 fi2c[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // argument pointer
653 TypeTuple::START_I2C = TypeTuple::make(TypeFunc::Parms+2, fi2c);
654
655 const Type **intpair = TypeTuple::fields(2);
656 intpair[0] = TypeInt::INT;
657 intpair[1] = TypeInt::INT;
658 TypeTuple::INT_PAIR = TypeTuple::make(2, intpair);
659
660 const Type **longpair = TypeTuple::fields(2);
661 longpair[0] = TypeLong::LONG;
662 longpair[1] = TypeLong::LONG;
663 TypeTuple::LONG_PAIR = TypeTuple::make(2, longpair);
664
665 const Type **intccpair = TypeTuple::fields(2);
666 intccpair[0] = TypeInt::INT;
667 intccpair[1] = TypeInt::CC;
668 TypeTuple::INT_CC_PAIR = TypeTuple::make(2, intccpair);
5232 return make(Constant, m, Offset(0));
5233 }
5234 const TypeMetadataPtr* TypeMetadataPtr::make(ciMethodData* m) {
5235 return make(Constant, m, Offset(0));
5236 }
5237
5238 //------------------------------make-------------------------------------------
5239 // Create a meta data constant
5240 const TypeMetadataPtr* TypeMetadataPtr::make(PTR ptr, ciMetadata* m, Offset offset) {
5241 assert(m == NULL || !m->is_klass(), "wrong type");
5242 return (TypeMetadataPtr*)(new TypeMetadataPtr(ptr, m, offset))->hashcons();
5243 }
5244
5245
5246 //=============================================================================
5247 // Convenience common pre-built types.
5248
5249 // Not-null object klass or below
5250 const TypeKlassPtr *TypeKlassPtr::OBJECT;
5251 const TypeKlassPtr *TypeKlassPtr::OBJECT_OR_NULL;
5252 const TypeKlassPtr* TypeKlassPtr::BOTTOM;
5253
5254 //------------------------------TypeKlassPtr-----------------------------------
5255 TypeKlassPtr::TypeKlassPtr( PTR ptr, ciKlass* klass, Offset offset )
5256 : TypePtr(KlassPtr, ptr, offset), _klass(klass), _klass_is_exact(ptr == Constant) {
5257 }
5258
5259 //------------------------------make-------------------------------------------
5260 // ptr to klass 'k', if Constant, or possibly to a sub-klass if not a Constant
5261 const TypeKlassPtr* TypeKlassPtr::make(PTR ptr, ciKlass* k, Offset offset) {
5262 assert(k == NULL || k->is_instance_klass() || k->is_array_klass(), "Incorrect type of klass oop");
5263 return (TypeKlassPtr*)(new TypeKlassPtr(ptr, k, offset))->hashcons();
5264 }
5265
5266 //------------------------------eq---------------------------------------------
5267 // Structural equality check for Type representations
5268 bool TypeKlassPtr::eq( const Type *t ) const {
5269 const TypeKlassPtr *p = t->is_klassptr();
5270 return klass() == p->klass() && TypePtr::eq(p);
5271 }
5272
5273 //------------------------------hash-------------------------------------------
5274 // Type-specific hashing function.
5275 int TypeKlassPtr::hash(void) const {
5276 return java_add(klass() != NULL ? klass()->hash() : 0, TypePtr::hash());
5277 }
5278
5279 //------------------------------singleton--------------------------------------
5280 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple
5281 // constants
5282 bool TypeKlassPtr::singleton(void) const {
5283 // detune optimizer to not generate constant klass + constant offset as a constant!
5284 // TopPTR, Null, AnyNull, Constant are all singletons
5285 return (offset() == 0) && !below_centerline(_ptr);
5286 }
5287
5288 // Do not allow interface-vs.-noninterface joins to collapse to top.
5289 const Type *TypeKlassPtr::filter_helper(const Type *kills, bool include_speculative) const {
5290 // logic here mirrors the one from TypeOopPtr::filter. See comments
5291 // there.
5292 const Type* ft = join_helper(kills, include_speculative);
5293 const TypeKlassPtr* ftkp = ft->isa_klassptr();
5294 const TypeKlassPtr* ktkp = kills->isa_klassptr();
5295
5296 if (ft->empty()) {
5297 if (!empty() && ktkp != NULL && ktkp->is_loaded() && ktkp->klass()->is_interface())
5298 return kills; // Uplift to interface
5299
5300 return Type::TOP; // Canonical empty value
5301 }
5302
5303 // Interface klass type could be exact in opposite to interface type,
5304 // return it here instead of incorrect Constant ptr J/L/Object (6894807).
5305 if (ftkp != NULL && ktkp != NULL &&
5306 ftkp->is_loaded() && ftkp->klass()->is_interface() &&
5307 !ftkp->klass_is_exact() && // Keep exact interface klass
5308 ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
5309 return ktkp->cast_to_ptr_type(ftkp->ptr());
5310 }
5311
5312 return ft;
5313 }
5314
5315 //----------------------compute_klass------------------------------------------
5316 // Compute the defining klass for this class
5317 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
5411 const Type *TypeKlassPtr::cast_to_ptr_type(PTR ptr) const {
5412 assert(_base == KlassPtr, "subclass must override cast_to_ptr_type");
5413 if( ptr == _ptr ) return this;
5414 return make(ptr, _klass, _offset);
5415 }
5416
5417
5418 //-----------------------------cast_to_exactness-------------------------------
5419 const Type *TypeKlassPtr::cast_to_exactness(bool klass_is_exact) const {
5420 if( klass_is_exact == _klass_is_exact ) return this;
5421 if (!UseExactTypes) return this;
5422 return make(klass_is_exact ? Constant : NotNull, _klass, _offset);
5423 }
5424
5425
5426 //-----------------------------as_instance_type--------------------------------
5427 // Corresponding type for an instance of the given class.
5428 // It will be NotNull, and exact if and only if the klass type is exact.
5429 const TypeOopPtr* TypeKlassPtr::as_instance_type() const {
5430 ciKlass* k = klass();
5431 assert(k != NULL, "klass should not be NULL");
5432 bool xk = klass_is_exact();
5433 //return TypeInstPtr::make(TypePtr::NotNull, k, xk, NULL, 0);
5434 const TypeOopPtr* toop = TypeOopPtr::make_from_klass_raw(k);
5435 guarantee(toop != NULL, "need type for given klass");
5436 toop = toop->cast_to_ptr_type(TypePtr::NotNull)->is_oopptr();
5437 return toop->cast_to_exactness(xk)->is_oopptr();
5438 }
5439
5440
5441 //------------------------------xmeet------------------------------------------
5442 // Compute the MEET of two types, return a new Type object.
5443 const Type *TypeKlassPtr::xmeet( const Type *t ) const {
5444 // Perform a fast test for common case; meeting the same types together.
5445 if( this == t ) return this; // Meeting same type-rep?
5446
5447 // Current "this->_base" is Pointer
5448 switch (t->base()) { // switch on original type
5449
5450 case Int: // Mixing ints & oops happens when javac
5451 case Long: // reuses local variables
5496 // A-top }
5497 // / | \ } Tops
5498 // B-top A-any C-top }
5499 // | / | \ | } Any-nulls
5500 // B-any | C-any }
5501 // | | |
5502 // B-con A-con C-con } constants; not comparable across classes
5503 // | | |
5504 // B-not | C-not }
5505 // | \ | / | } not-nulls
5506 // B-bot A-not C-bot }
5507 // \ | / } Bottoms
5508 // A-bot }
5509 //
5510
5511 case KlassPtr: { // Meet two KlassPtr types
5512 const TypeKlassPtr *tkls = t->is_klassptr();
5513 Offset off = meet_offset(tkls->offset());
5514 PTR ptr = meet_ptr(tkls->ptr());
5515
5516 if (klass() == NULL || tkls->klass() == NULL) {
5517 ciKlass* k = NULL;
5518 if (ptr == Constant) {
5519 k = (klass() == NULL) ? tkls->klass() : klass();
5520 }
5521 return make(ptr, k, off);
5522 }
5523
5524 // Check for easy case; klasses are equal (and perhaps not loaded!)
5525 // If we have constants, then we created oops so classes are loaded
5526 // and we can handle the constants further down. This case handles
5527 // not-loaded classes
5528 if( ptr != Constant && tkls->klass()->equals(klass()) ) {
5529 return make( ptr, klass(), off );
5530 }
5531
5532 // Classes require inspection in the Java klass hierarchy. Must be loaded.
5533 ciKlass* tkls_klass = tkls->klass();
5534 ciKlass* this_klass = this->klass();
5535 assert( tkls_klass->is_loaded(), "This class should have been loaded.");
5536 assert( this_klass->is_loaded(), "This class should have been loaded.");
5537
5538 // If 'this' type is above the centerline and is a superclass of the
5539 // other, we can treat 'this' as having the same type as the other.
5540 if ((above_centerline(this->ptr())) &&
5541 tkls_klass->is_subtype_of(this_klass)) {
5542 this_klass = tkls_klass;
5543 }
5594 // to a handle at compile time. This handle is embedded in the generated
5595 // code and dereferenced at the time the nmethod is made. Until that time,
5596 // it is not reasonable to do arithmetic with the addresses of oops (we don't
5597 // have access to the addresses!). This does not seem to currently happen,
5598 // but this assertion here is to help prevent its occurence.
5599 tty->print_cr("Found oop constant with non-zero offset");
5600 ShouldNotReachHere();
5601 }
5602
5603 return (intptr_t)klass()->constant_encoding();
5604 }
5605 //------------------------------dump2------------------------------------------
5606 // Dump Klass Type
5607 #ifndef PRODUCT
5608 void TypeKlassPtr::dump2( Dict & d, uint depth, outputStream *st ) const {
5609 switch( _ptr ) {
5610 case Constant:
5611 st->print("precise ");
5612 case NotNull:
5613 {
5614 if (klass() != NULL) {
5615 const char* name = klass()->name()->as_utf8();
5616 st->print("klass %s: " INTPTR_FORMAT, name, p2i(klass()));
5617 } else {
5618 st->print("klass BOTTOM");
5619 }
5620 }
5621 case BotPTR:
5622 if( !WizardMode && !Verbose && !_klass_is_exact ) break;
5623 case TopPTR:
5624 case AnyNull:
5625 st->print(":%s", ptr_msg[_ptr]);
5626 if( _klass_is_exact ) st->print(":exact");
5627 break;
5628 }
5629
5630 _offset.dump2(st);
5631
5632 st->print(" *");
5633 }
5634 #endif
5635
5636
5637
5638 //=============================================================================
|