Mercurial > hg > graal-compiler
comparison src/share/vm/opto/type.cpp @ 6848:8e47bac5643a
7054512: Compress class pointers after perm gen removal
Summary: support of compress class pointers in the compilers.
Reviewed-by: kvn, twisti
author | roland |
---|---|
date | Tue, 09 Oct 2012 10:11:38 +0200 |
parents | aed758eda82a |
children | aaeb9add1ab3 |
comparison
equal
deleted
inserted
replaced
6847:65d07d9ee446 | 6848:8e47bac5643a |
---|---|
55 { Bottom, T_VOID, "top", false, 0, relocInfo::none }, // Top | 55 { Bottom, T_VOID, "top", false, 0, relocInfo::none }, // Top |
56 { Bad, T_INT, "int:", false, Op_RegI, relocInfo::none }, // Int | 56 { Bad, T_INT, "int:", false, Op_RegI, relocInfo::none }, // Int |
57 { Bad, T_LONG, "long:", false, Op_RegL, relocInfo::none }, // Long | 57 { Bad, T_LONG, "long:", false, Op_RegL, relocInfo::none }, // Long |
58 { Half, T_VOID, "half", false, 0, relocInfo::none }, // Half | 58 { Half, T_VOID, "half", false, 0, relocInfo::none }, // Half |
59 { Bad, T_NARROWOOP, "narrowoop:", false, Op_RegN, relocInfo::none }, // NarrowOop | 59 { Bad, T_NARROWOOP, "narrowoop:", false, Op_RegN, relocInfo::none }, // NarrowOop |
60 { Bad, T_NARROWKLASS,"narrowklass:", false, Op_RegN, relocInfo::none }, // NarrowKlass | |
60 { Bad, T_ILLEGAL, "tuple:", false, Node::NotAMachineReg, relocInfo::none }, // Tuple | 61 { Bad, T_ILLEGAL, "tuple:", false, Node::NotAMachineReg, relocInfo::none }, // Tuple |
61 { Bad, T_ARRAY, "array:", false, Node::NotAMachineReg, relocInfo::none }, // Array | 62 { Bad, T_ARRAY, "array:", false, Node::NotAMachineReg, relocInfo::none }, // Array |
62 | 63 |
63 #if defined(IA32) || defined(AMD64) | 64 #if defined(IA32) || defined(AMD64) |
64 { Bad, T_ILLEGAL, "vectors:", false, Op_VecS, relocInfo::none }, // VectorS | 65 { Bad, T_ILLEGAL, "vectors:", false, Op_VecS, relocInfo::none }, // VectorS |
330 TypeMetadataPtr::BOTTOM = TypeMetadataPtr::make(TypePtr::BotPTR, NULL, OffsetBot); | 331 TypeMetadataPtr::BOTTOM = TypeMetadataPtr::make(TypePtr::BotPTR, NULL, OffsetBot); |
331 | 332 |
332 TypeNarrowOop::NULL_PTR = TypeNarrowOop::make( TypePtr::NULL_PTR ); | 333 TypeNarrowOop::NULL_PTR = TypeNarrowOop::make( TypePtr::NULL_PTR ); |
333 TypeNarrowOop::BOTTOM = TypeNarrowOop::make( TypeInstPtr::BOTTOM ); | 334 TypeNarrowOop::BOTTOM = TypeNarrowOop::make( TypeInstPtr::BOTTOM ); |
334 | 335 |
336 TypeNarrowKlass::NULL_PTR = TypeNarrowKlass::make( TypePtr::NULL_PTR ); | |
337 | |
335 mreg2type[Op_Node] = Type::BOTTOM; | 338 mreg2type[Op_Node] = Type::BOTTOM; |
336 mreg2type[Op_Set ] = 0; | 339 mreg2type[Op_Set ] = 0; |
337 mreg2type[Op_RegN] = TypeNarrowOop::BOTTOM; | 340 mreg2type[Op_RegN] = TypeNarrowOop::BOTTOM; |
338 mreg2type[Op_RegI] = TypeInt::INT; | 341 mreg2type[Op_RegI] = TypeInt::INT; |
339 mreg2type[Op_RegP] = TypePtr::BOTTOM; | 342 mreg2type[Op_RegP] = TypePtr::BOTTOM; |
393 const Type **longpair = TypeTuple::fields(2); | 396 const Type **longpair = TypeTuple::fields(2); |
394 longpair[0] = TypeLong::LONG; | 397 longpair[0] = TypeLong::LONG; |
395 longpair[1] = TypeLong::LONG; | 398 longpair[1] = TypeLong::LONG; |
396 TypeTuple::LONG_PAIR = TypeTuple::make(2, longpair); | 399 TypeTuple::LONG_PAIR = TypeTuple::make(2, longpair); |
397 | 400 |
398 _const_basic_type[T_NARROWOOP] = TypeNarrowOop::BOTTOM; | 401 _const_basic_type[T_NARROWOOP] = TypeNarrowOop::BOTTOM; |
399 _const_basic_type[T_BOOLEAN] = TypeInt::BOOL; | 402 _const_basic_type[T_NARROWKLASS] = Type::BOTTOM; |
400 _const_basic_type[T_CHAR] = TypeInt::CHAR; | 403 _const_basic_type[T_BOOLEAN] = TypeInt::BOOL; |
401 _const_basic_type[T_BYTE] = TypeInt::BYTE; | 404 _const_basic_type[T_CHAR] = TypeInt::CHAR; |
402 _const_basic_type[T_SHORT] = TypeInt::SHORT; | 405 _const_basic_type[T_BYTE] = TypeInt::BYTE; |
403 _const_basic_type[T_INT] = TypeInt::INT; | 406 _const_basic_type[T_SHORT] = TypeInt::SHORT; |
404 _const_basic_type[T_LONG] = TypeLong::LONG; | 407 _const_basic_type[T_INT] = TypeInt::INT; |
405 _const_basic_type[T_FLOAT] = Type::FLOAT; | 408 _const_basic_type[T_LONG] = TypeLong::LONG; |
406 _const_basic_type[T_DOUBLE] = Type::DOUBLE; | 409 _const_basic_type[T_FLOAT] = Type::FLOAT; |
407 _const_basic_type[T_OBJECT] = TypeInstPtr::BOTTOM; | 410 _const_basic_type[T_DOUBLE] = Type::DOUBLE; |
408 _const_basic_type[T_ARRAY] = TypeInstPtr::BOTTOM; // there is no separate bottom for arrays | 411 _const_basic_type[T_OBJECT] = TypeInstPtr::BOTTOM; |
409 _const_basic_type[T_VOID] = TypePtr::NULL_PTR; // reflection represents void this way | 412 _const_basic_type[T_ARRAY] = TypeInstPtr::BOTTOM; // there is no separate bottom for arrays |
410 _const_basic_type[T_ADDRESS] = TypeRawPtr::BOTTOM; // both interpreter return addresses & random raw ptrs | 413 _const_basic_type[T_VOID] = TypePtr::NULL_PTR; // reflection represents void this way |
411 _const_basic_type[T_CONFLICT]= Type::BOTTOM; // why not? | 414 _const_basic_type[T_ADDRESS] = TypeRawPtr::BOTTOM; // both interpreter return addresses & random raw ptrs |
412 | 415 _const_basic_type[T_CONFLICT] = Type::BOTTOM; // why not? |
413 _zero_type[T_NARROWOOP] = TypeNarrowOop::NULL_PTR; | 416 |
414 _zero_type[T_BOOLEAN] = TypeInt::ZERO; // false == 0 | 417 _zero_type[T_NARROWOOP] = TypeNarrowOop::NULL_PTR; |
415 _zero_type[T_CHAR] = TypeInt::ZERO; // '\0' == 0 | 418 _zero_type[T_NARROWKLASS] = TypeNarrowKlass::NULL_PTR; |
416 _zero_type[T_BYTE] = TypeInt::ZERO; // 0x00 == 0 | 419 _zero_type[T_BOOLEAN] = TypeInt::ZERO; // false == 0 |
417 _zero_type[T_SHORT] = TypeInt::ZERO; // 0x0000 == 0 | 420 _zero_type[T_CHAR] = TypeInt::ZERO; // '\0' == 0 |
418 _zero_type[T_INT] = TypeInt::ZERO; | 421 _zero_type[T_BYTE] = TypeInt::ZERO; // 0x00 == 0 |
419 _zero_type[T_LONG] = TypeLong::ZERO; | 422 _zero_type[T_SHORT] = TypeInt::ZERO; // 0x0000 == 0 |
420 _zero_type[T_FLOAT] = TypeF::ZERO; | 423 _zero_type[T_INT] = TypeInt::ZERO; |
421 _zero_type[T_DOUBLE] = TypeD::ZERO; | 424 _zero_type[T_LONG] = TypeLong::ZERO; |
422 _zero_type[T_OBJECT] = TypePtr::NULL_PTR; | 425 _zero_type[T_FLOAT] = TypeF::ZERO; |
423 _zero_type[T_ARRAY] = TypePtr::NULL_PTR; // null array is null oop | 426 _zero_type[T_DOUBLE] = TypeD::ZERO; |
424 _zero_type[T_ADDRESS] = TypePtr::NULL_PTR; // raw pointers use the same null | 427 _zero_type[T_OBJECT] = TypePtr::NULL_PTR; |
425 _zero_type[T_VOID] = Type::TOP; // the only void value is no value at all | 428 _zero_type[T_ARRAY] = TypePtr::NULL_PTR; // null array is null oop |
429 _zero_type[T_ADDRESS] = TypePtr::NULL_PTR; // raw pointers use the same null | |
430 _zero_type[T_VOID] = Type::TOP; // the only void value is no value at all | |
426 | 431 |
427 // get_zero_type() should not happen for T_CONFLICT | 432 // get_zero_type() should not happen for T_CONFLICT |
428 _zero_type[T_CONFLICT]= NULL; | 433 _zero_type[T_CONFLICT]= NULL; |
429 | 434 |
430 // Vector predefined types, it needs initialized _const_basic_type[]. | 435 // Vector predefined types, it needs initialized _const_basic_type[]. |
561 const Type *Type::meet( const Type *t ) const { | 566 const Type *Type::meet( const Type *t ) const { |
562 if (isa_narrowoop() && t->isa_narrowoop()) { | 567 if (isa_narrowoop() && t->isa_narrowoop()) { |
563 const Type* result = make_ptr()->meet(t->make_ptr()); | 568 const Type* result = make_ptr()->meet(t->make_ptr()); |
564 return result->make_narrowoop(); | 569 return result->make_narrowoop(); |
565 } | 570 } |
571 if (isa_narrowklass() && t->isa_narrowklass()) { | |
572 const Type* result = make_ptr()->meet(t->make_ptr()); | |
573 return result->make_narrowklass(); | |
574 } | |
566 | 575 |
567 const Type *mt = xmeet(t); | 576 const Type *mt = xmeet(t); |
568 if (isa_narrowoop() || t->isa_narrowoop()) return mt; | 577 if (isa_narrowoop() || t->isa_narrowoop()) return mt; |
578 if (isa_narrowklass() || t->isa_narrowklass()) return mt; | |
569 #ifdef ASSERT | 579 #ifdef ASSERT |
570 assert( mt == t->xmeet(this), "meet not commutative" ); | 580 assert( mt == t->xmeet(this), "meet not commutative" ); |
571 const Type* dual_join = mt->_dual; | 581 const Type* dual_join = mt->_dual; |
572 const Type *t2t = dual_join->xmeet(t->_dual); | 582 const Type *t2t = dual_join->xmeet(t->_dual); |
573 const Type *t2this = dual_join->xmeet( _dual); | 583 const Type *t2this = dual_join->xmeet( _dual); |
631 | 641 |
632 case AryPtr: | 642 case AryPtr: |
633 return t->xmeet(this); | 643 return t->xmeet(this); |
634 | 644 |
635 case NarrowOop: | 645 case NarrowOop: |
646 return t->xmeet(this); | |
647 | |
648 case NarrowKlass: | |
636 return t->xmeet(this); | 649 return t->xmeet(this); |
637 | 650 |
638 case Bad: // Type check | 651 case Bad: // Type check |
639 default: // Bogus type not in lattice | 652 default: // Bogus type not in lattice |
640 typerr(t); | 653 typerr(t); |
691 Bottom, // Top | 704 Bottom, // Top |
692 Bad, // Int - handled in v-call | 705 Bad, // Int - handled in v-call |
693 Bad, // Long - handled in v-call | 706 Bad, // Long - handled in v-call |
694 Half, // Half | 707 Half, // Half |
695 Bad, // NarrowOop - handled in v-call | 708 Bad, // NarrowOop - handled in v-call |
709 Bad, // NarrowKlass - handled in v-call | |
696 | 710 |
697 Bad, // Tuple - handled in v-call | 711 Bad, // Tuple - handled in v-call |
698 Bad, // Array - handled in v-call | 712 Bad, // Array - handled in v-call |
699 Bad, // VectorS - handled in v-call | 713 Bad, // VectorS - handled in v-call |
700 Bad, // VectorD - handled in v-call | 714 Bad, // VectorD - handled in v-call |
754 ResourceMark rm; | 768 ResourceMark rm; |
755 Dict d(cmpkey,hashkey); // Stop recursive type dumping | 769 Dict d(cmpkey,hashkey); // Stop recursive type dumping |
756 dump2(d,1, st); | 770 dump2(d,1, st); |
757 if (is_ptr_to_narrowoop()) { | 771 if (is_ptr_to_narrowoop()) { |
758 st->print(" [narrow]"); | 772 st->print(" [narrow]"); |
773 } else if (is_ptr_to_narrowklass()) { | |
774 st->print(" [narrowklass]"); | |
759 } | 775 } |
760 } | 776 } |
761 #endif | 777 #endif |
762 | 778 |
763 //------------------------------singleton-------------------------------------- | 779 //------------------------------singleton-------------------------------------- |
836 case InstPtr: | 852 case InstPtr: |
837 case AryPtr: | 853 case AryPtr: |
838 case MetadataPtr: | 854 case MetadataPtr: |
839 case KlassPtr: | 855 case KlassPtr: |
840 case NarrowOop: | 856 case NarrowOop: |
857 case NarrowKlass: | |
841 case Int: | 858 case Int: |
842 case Long: | 859 case Long: |
843 case DoubleTop: | 860 case DoubleTop: |
844 case DoubleCon: | 861 case DoubleCon: |
845 case DoubleBot: | 862 case DoubleBot: |
953 case InstPtr: | 970 case InstPtr: |
954 case AryPtr: | 971 case AryPtr: |
955 case MetadataPtr: | 972 case MetadataPtr: |
956 case KlassPtr: | 973 case KlassPtr: |
957 case NarrowOop: | 974 case NarrowOop: |
975 case NarrowKlass: | |
958 case Int: | 976 case Int: |
959 case Long: | 977 case Long: |
960 case FloatTop: | 978 case FloatTop: |
961 case FloatCon: | 979 case FloatCon: |
962 case FloatBot: | 980 case FloatBot: |
1107 case InstPtr: | 1125 case InstPtr: |
1108 case AryPtr: | 1126 case AryPtr: |
1109 case MetadataPtr: | 1127 case MetadataPtr: |
1110 case KlassPtr: | 1128 case KlassPtr: |
1111 case NarrowOop: | 1129 case NarrowOop: |
1130 case NarrowKlass: | |
1112 case Long: | 1131 case Long: |
1113 case FloatTop: | 1132 case FloatTop: |
1114 case FloatCon: | 1133 case FloatCon: |
1115 case FloatBot: | 1134 case FloatBot: |
1116 case DoubleTop: | 1135 case DoubleTop: |
1364 case InstPtr: | 1383 case InstPtr: |
1365 case AryPtr: | 1384 case AryPtr: |
1366 case MetadataPtr: | 1385 case MetadataPtr: |
1367 case KlassPtr: | 1386 case KlassPtr: |
1368 case NarrowOop: | 1387 case NarrowOop: |
1388 case NarrowKlass: | |
1369 case Int: | 1389 case Int: |
1370 case FloatTop: | 1390 case FloatTop: |
1371 case FloatCon: | 1391 case FloatCon: |
1372 case FloatBot: | 1392 case FloatBot: |
1373 case DoubleTop: | 1393 case DoubleTop: |
2094 case FloatBot: | 2114 case FloatBot: |
2095 case DoubleTop: | 2115 case DoubleTop: |
2096 case DoubleCon: | 2116 case DoubleCon: |
2097 case DoubleBot: | 2117 case DoubleBot: |
2098 case NarrowOop: | 2118 case NarrowOop: |
2119 case NarrowKlass: | |
2099 case Bottom: // Ye Olde Default | 2120 case Bottom: // Ye Olde Default |
2100 return Type::BOTTOM; | 2121 return Type::BOTTOM; |
2101 case Top: | 2122 case Top: |
2102 return this; | 2123 return this; |
2103 | 2124 |
2348 TypeOopPtr::TypeOopPtr( TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id ) | 2369 TypeOopPtr::TypeOopPtr( TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id ) |
2349 : TypePtr(t, ptr, offset), | 2370 : TypePtr(t, ptr, offset), |
2350 _const_oop(o), _klass(k), | 2371 _const_oop(o), _klass(k), |
2351 _klass_is_exact(xk), | 2372 _klass_is_exact(xk), |
2352 _is_ptr_to_narrowoop(false), | 2373 _is_ptr_to_narrowoop(false), |
2374 _is_ptr_to_narrowklass(false), | |
2353 _instance_id(instance_id) { | 2375 _instance_id(instance_id) { |
2354 #ifdef _LP64 | 2376 #ifdef _LP64 |
2355 if (UseCompressedOops && _offset != 0) { | 2377 if (_offset != 0) { |
2356 if (_offset == oopDesc::klass_offset_in_bytes()) { | 2378 if (_offset == oopDesc::klass_offset_in_bytes()) { |
2357 _is_ptr_to_narrowoop = UseCompressedKlassPointers; | 2379 _is_ptr_to_narrowklass = UseCompressedKlassPointers; |
2358 } else if (klass() == NULL) { | 2380 } else if (klass() == NULL) { |
2359 // Array with unknown body type | 2381 // Array with unknown body type |
2360 assert(this->isa_aryptr(), "only arrays without klass"); | 2382 assert(this->isa_aryptr(), "only arrays without klass"); |
2361 _is_ptr_to_narrowoop = true; | 2383 _is_ptr_to_narrowoop = UseCompressedOops; |
2362 } else if (this->isa_aryptr()) { | 2384 } else if (this->isa_aryptr()) { |
2363 _is_ptr_to_narrowoop = (klass()->is_obj_array_klass() && | 2385 _is_ptr_to_narrowoop = (UseCompressedOops && klass()->is_obj_array_klass() && |
2364 _offset != arrayOopDesc::length_offset_in_bytes()); | 2386 _offset != arrayOopDesc::length_offset_in_bytes()); |
2365 } else if (klass()->is_instance_klass()) { | 2387 } else if (klass()->is_instance_klass()) { |
2366 ciInstanceKlass* ik = klass()->as_instance_klass(); | 2388 ciInstanceKlass* ik = klass()->as_instance_klass(); |
2367 ciField* field = NULL; | 2389 ciField* field = NULL; |
2368 if (this->isa_klassptr()) { | 2390 if (this->isa_klassptr()) { |
2369 // Perm objects don't use compressed references | 2391 // Perm objects don't use compressed references |
2370 } else if (_offset == OffsetBot || _offset == OffsetTop) { | 2392 } else if (_offset == OffsetBot || _offset == OffsetTop) { |
2371 // unsafe access | 2393 // unsafe access |
2372 _is_ptr_to_narrowoop = true; | 2394 _is_ptr_to_narrowoop = UseCompressedOops; |
2373 } else { // exclude unsafe ops | 2395 } else { // exclude unsafe ops |
2374 assert(this->isa_instptr(), "must be an instance ptr."); | 2396 assert(this->isa_instptr(), "must be an instance ptr."); |
2375 | 2397 |
2376 if (klass() == ciEnv::current()->Class_klass() && | 2398 if (klass() == ciEnv::current()->Class_klass() && |
2377 (_offset == java_lang_Class::klass_offset_in_bytes() || | 2399 (_offset == java_lang_Class::klass_offset_in_bytes() || |
2385 assert(o != NULL, "must be constant"); | 2407 assert(o != NULL, "must be constant"); |
2386 ciInstanceKlass* k = o->as_instance()->java_lang_Class_klass()->as_instance_klass(); | 2408 ciInstanceKlass* k = o->as_instance()->java_lang_Class_klass()->as_instance_klass(); |
2387 ciField* field = k->get_field_by_offset(_offset, true); | 2409 ciField* field = k->get_field_by_offset(_offset, true); |
2388 assert(field != NULL, "missing field"); | 2410 assert(field != NULL, "missing field"); |
2389 BasicType basic_elem_type = field->layout_type(); | 2411 BasicType basic_elem_type = field->layout_type(); |
2390 _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT || | 2412 _is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT || |
2391 basic_elem_type == T_ARRAY); | 2413 basic_elem_type == T_ARRAY); |
2392 } else { | 2414 } else { |
2393 // Instance fields which contains a compressed oop references. | 2415 // Instance fields which contains a compressed oop references. |
2394 field = ik->get_field_by_offset(_offset, false); | 2416 field = ik->get_field_by_offset(_offset, false); |
2395 if (field != NULL) { | 2417 if (field != NULL) { |
2396 BasicType basic_elem_type = field->layout_type(); | 2418 BasicType basic_elem_type = field->layout_type(); |
2397 _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT || | 2419 _is_ptr_to_narrowoop = UseCompressedOops && (basic_elem_type == T_OBJECT || |
2398 basic_elem_type == T_ARRAY); | 2420 basic_elem_type == T_ARRAY); |
2399 } else if (klass()->equals(ciEnv::current()->Object_klass())) { | 2421 } else if (klass()->equals(ciEnv::current()->Object_klass())) { |
2400 // Compile::find_alias_type() cast exactness on all types to verify | 2422 // Compile::find_alias_type() cast exactness on all types to verify |
2401 // that it does not affect alias type. | 2423 // that it does not affect alias type. |
2402 _is_ptr_to_narrowoop = true; | 2424 _is_ptr_to_narrowoop = UseCompressedOops; |
2403 } else { | 2425 } else { |
2404 // Type for the copy start in LibraryCallKit::inline_native_clone(). | 2426 // Type for the copy start in LibraryCallKit::inline_native_clone(). |
2405 _is_ptr_to_narrowoop = true; | 2427 _is_ptr_to_narrowoop = UseCompressedOops; |
2406 } | 2428 } |
2407 } | 2429 } |
2408 } | 2430 } |
2409 } | 2431 } |
2410 } | 2432 } |
2473 case FloatBot: | 2495 case FloatBot: |
2474 case DoubleTop: | 2496 case DoubleTop: |
2475 case DoubleCon: | 2497 case DoubleCon: |
2476 case DoubleBot: | 2498 case DoubleBot: |
2477 case NarrowOop: | 2499 case NarrowOop: |
2500 case NarrowKlass: | |
2478 case Bottom: // Ye Olde Default | 2501 case Bottom: // Ye Olde Default |
2479 return Type::BOTTOM; | 2502 return Type::BOTTOM; |
2480 case Top: | 2503 case Top: |
2481 return this; | 2504 return this; |
2482 | 2505 |
2923 case FloatBot: | 2946 case FloatBot: |
2924 case DoubleTop: | 2947 case DoubleTop: |
2925 case DoubleCon: | 2948 case DoubleCon: |
2926 case DoubleBot: | 2949 case DoubleBot: |
2927 case NarrowOop: | 2950 case NarrowOop: |
2951 case NarrowKlass: | |
2928 case Bottom: // Ye Olde Default | 2952 case Bottom: // Ye Olde Default |
2929 return Type::BOTTOM; | 2953 return Type::BOTTOM; |
2930 case Top: | 2954 case Top: |
2931 return this; | 2955 return this; |
2932 | 2956 |
3351 if (res == 0) { | 3375 if (res == 0) { |
3352 switch (etype) { | 3376 switch (etype) { |
3353 case T_NARROWOOP: | 3377 case T_NARROWOOP: |
3354 etype = T_OBJECT; | 3378 etype = T_OBJECT; |
3355 break; | 3379 break; |
3380 case T_NARROWKLASS: | |
3356 case T_CONFLICT: | 3381 case T_CONFLICT: |
3357 case T_ILLEGAL: | 3382 case T_ILLEGAL: |
3358 case T_VOID: | 3383 case T_VOID: |
3359 etype = T_BYTE; // will produce conservatively high value | 3384 etype = T_BYTE; // will produce conservatively high value |
3360 } | 3385 } |
3423 case FloatBot: | 3448 case FloatBot: |
3424 case DoubleTop: | 3449 case DoubleTop: |
3425 case DoubleCon: | 3450 case DoubleCon: |
3426 case DoubleBot: | 3451 case DoubleBot: |
3427 case NarrowOop: | 3452 case NarrowOop: |
3453 case NarrowKlass: | |
3428 case Bottom: // Ye Olde Default | 3454 case Bottom: // Ye Olde Default |
3429 return Type::BOTTOM; | 3455 return Type::BOTTOM; |
3430 case Top: | 3456 case Top: |
3431 return this; | 3457 return this; |
3432 | 3458 |
3669 return make( _ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id ); | 3695 return make( _ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id ); |
3670 } | 3696 } |
3671 | 3697 |
3672 | 3698 |
3673 //============================================================================= | 3699 //============================================================================= |
3674 const TypeNarrowOop *TypeNarrowOop::BOTTOM; | |
3675 const TypeNarrowOop *TypeNarrowOop::NULL_PTR; | |
3676 | |
3677 | |
3678 const TypeNarrowOop* TypeNarrowOop::make(const TypePtr* type) { | |
3679 return (const TypeNarrowOop*)(new TypeNarrowOop(type))->hashcons(); | |
3680 } | |
3681 | 3700 |
3682 //------------------------------hash------------------------------------------- | 3701 //------------------------------hash------------------------------------------- |
3683 // Type-specific hashing function. | 3702 // Type-specific hashing function. |
3684 int TypeNarrowOop::hash(void) const { | 3703 int TypeNarrowPtr::hash(void) const { |
3685 return _ptrtype->hash() + 7; | 3704 return _ptrtype->hash() + 7; |
3686 } | 3705 } |
3687 | 3706 |
3688 | 3707 bool TypeNarrowPtr::singleton(void) const { // TRUE if type is a singleton |
3689 bool TypeNarrowOop::eq( const Type *t ) const { | 3708 return _ptrtype->singleton(); |
3690 const TypeNarrowOop* tc = t->isa_narrowoop(); | 3709 } |
3710 | |
3711 bool TypeNarrowPtr::empty(void) const { | |
3712 return _ptrtype->empty(); | |
3713 } | |
3714 | |
3715 intptr_t TypeNarrowPtr::get_con() const { | |
3716 return _ptrtype->get_con(); | |
3717 } | |
3718 | |
3719 bool TypeNarrowPtr::eq( const Type *t ) const { | |
3720 const TypeNarrowPtr* tc = isa_same_narrowptr(t); | |
3691 if (tc != NULL) { | 3721 if (tc != NULL) { |
3692 if (_ptrtype->base() != tc->_ptrtype->base()) { | 3722 if (_ptrtype->base() != tc->_ptrtype->base()) { |
3693 return false; | 3723 return false; |
3694 } | 3724 } |
3695 return tc->_ptrtype->eq(_ptrtype); | 3725 return tc->_ptrtype->eq(_ptrtype); |
3696 } | 3726 } |
3697 return false; | 3727 return false; |
3698 } | 3728 } |
3699 | 3729 |
3700 bool TypeNarrowOop::singleton(void) const { // TRUE if type is a singleton | 3730 const Type *TypeNarrowPtr::xdual() const { // Compute dual right now. |
3701 return _ptrtype->singleton(); | 3731 const TypePtr* odual = _ptrtype->dual()->is_ptr(); |
3702 } | 3732 return make_same_narrowptr(odual); |
3703 | 3733 } |
3704 bool TypeNarrowOop::empty(void) const { | 3734 |
3705 return _ptrtype->empty(); | 3735 |
3736 const Type *TypeNarrowPtr::filter( const Type *kills ) const { | |
3737 if (isa_same_narrowptr(kills)) { | |
3738 const Type* ft =_ptrtype->filter(is_same_narrowptr(kills)->_ptrtype); | |
3739 if (ft->empty()) | |
3740 return Type::TOP; // Canonical empty value | |
3741 if (ft->isa_ptr()) { | |
3742 return make_hash_same_narrowptr(ft->isa_ptr()); | |
3743 } | |
3744 return ft; | |
3745 } else if (kills->isa_ptr()) { | |
3746 const Type* ft = _ptrtype->join(kills); | |
3747 if (ft->empty()) | |
3748 return Type::TOP; // Canonical empty value | |
3749 return ft; | |
3750 } else { | |
3751 return Type::TOP; | |
3752 } | |
3706 } | 3753 } |
3707 | 3754 |
3708 //------------------------------xmeet------------------------------------------ | 3755 //------------------------------xmeet------------------------------------------ |
3709 // Compute the MEET of two types. It returns a new Type object. | 3756 // Compute the MEET of two types. It returns a new Type object. |
3710 const Type *TypeNarrowOop::xmeet( const Type *t ) const { | 3757 const Type *TypeNarrowPtr::xmeet( const Type *t ) const { |
3711 // Perform a fast test for common case; meeting the same types together. | 3758 // Perform a fast test for common case; meeting the same types together. |
3712 if( this == t ) return this; // Meeting same type-rep? | 3759 if( this == t ) return this; // Meeting same type-rep? |
3713 | 3760 |
3714 | 3761 if (t->base() == base()) { |
3715 // Current "this->_base" is OopPtr | 3762 const Type* result = _ptrtype->xmeet(t->make_ptr()); |
3763 if (result->isa_ptr()) { | |
3764 return make_hash_same_narrowptr(result->is_ptr()); | |
3765 } | |
3766 return result; | |
3767 } | |
3768 | |
3769 // Current "this->_base" is NarrowKlass or NarrowOop | |
3716 switch (t->base()) { // switch on original type | 3770 switch (t->base()) { // switch on original type |
3717 | 3771 |
3718 case Int: // Mixing ints & oops happens when javac | 3772 case Int: // Mixing ints & oops happens when javac |
3719 case Long: // reuses local variables | 3773 case Long: // reuses local variables |
3720 case FloatTop: | 3774 case FloatTop: |
3728 case OopPtr: | 3782 case OopPtr: |
3729 case InstPtr: | 3783 case InstPtr: |
3730 case AryPtr: | 3784 case AryPtr: |
3731 case MetadataPtr: | 3785 case MetadataPtr: |
3732 case KlassPtr: | 3786 case KlassPtr: |
3787 case NarrowOop: | |
3788 case NarrowKlass: | |
3733 | 3789 |
3734 case Bottom: // Ye Olde Default | 3790 case Bottom: // Ye Olde Default |
3735 return Type::BOTTOM; | 3791 return Type::BOTTOM; |
3736 case Top: | 3792 case Top: |
3737 return this; | 3793 return this; |
3738 | 3794 |
3739 case NarrowOop: { | |
3740 const Type* result = _ptrtype->xmeet(t->make_ptr()); | |
3741 if (result->isa_ptr()) { | |
3742 return TypeNarrowOop::make(result->is_ptr()); | |
3743 } | |
3744 return result; | |
3745 } | |
3746 | |
3747 default: // All else is a mistake | 3795 default: // All else is a mistake |
3748 typerr(t); | 3796 typerr(t); |
3749 | 3797 |
3750 } // End of switch | 3798 } // End of switch |
3751 | 3799 |
3752 return this; | 3800 return this; |
3753 } | 3801 } |
3754 | 3802 |
3755 const Type *TypeNarrowOop::xdual() const { // Compute dual right now. | 3803 #ifndef PRODUCT |
3756 const TypePtr* odual = _ptrtype->dual()->is_ptr(); | 3804 void TypeNarrowPtr::dump2( Dict & d, uint depth, outputStream *st ) const { |
3757 return new TypeNarrowOop(odual); | 3805 _ptrtype->dump2(d, depth, st); |
3758 } | 3806 } |
3759 | 3807 #endif |
3760 const Type *TypeNarrowOop::filter( const Type *kills ) const { | 3808 |
3761 if (kills->isa_narrowoop()) { | 3809 const TypeNarrowOop *TypeNarrowOop::BOTTOM; |
3762 const Type* ft =_ptrtype->filter(kills->is_narrowoop()->_ptrtype); | 3810 const TypeNarrowOop *TypeNarrowOop::NULL_PTR; |
3763 if (ft->empty()) | 3811 |
3764 return Type::TOP; // Canonical empty value | 3812 |
3765 if (ft->isa_ptr()) { | 3813 const TypeNarrowOop* TypeNarrowOop::make(const TypePtr* type) { |
3766 return make(ft->isa_ptr()); | 3814 return (const TypeNarrowOop*)(new TypeNarrowOop(type))->hashcons(); |
3767 } | 3815 } |
3768 return ft; | 3816 |
3769 } else if (kills->isa_ptr()) { | |
3770 const Type* ft = _ptrtype->join(kills); | |
3771 if (ft->empty()) | |
3772 return Type::TOP; // Canonical empty value | |
3773 return ft; | |
3774 } else { | |
3775 return Type::TOP; | |
3776 } | |
3777 } | |
3778 | |
3779 | |
3780 intptr_t TypeNarrowOop::get_con() const { | |
3781 return _ptrtype->get_con(); | |
3782 } | |
3783 | 3817 |
3784 #ifndef PRODUCT | 3818 #ifndef PRODUCT |
3785 void TypeNarrowOop::dump2( Dict & d, uint depth, outputStream *st ) const { | 3819 void TypeNarrowOop::dump2( Dict & d, uint depth, outputStream *st ) const { |
3786 st->print("narrowoop: "); | 3820 st->print("narrowoop: "); |
3787 _ptrtype->dump2(d, depth, st); | 3821 TypeNarrowPtr::dump2(d, depth, st); |
3788 } | 3822 } |
3789 #endif | 3823 #endif |
3790 | 3824 |
3825 const TypeNarrowKlass *TypeNarrowKlass::NULL_PTR; | |
3826 | |
3827 const TypeNarrowKlass* TypeNarrowKlass::make(const TypePtr* type) { | |
3828 return (const TypeNarrowKlass*)(new TypeNarrowKlass(type))->hashcons(); | |
3829 } | |
3830 | |
3831 #ifndef PRODUCT | |
3832 void TypeNarrowKlass::dump2( Dict & d, uint depth, outputStream *st ) const { | |
3833 st->print("narrowklass: "); | |
3834 TypeNarrowPtr::dump2(d, depth, st); | |
3835 } | |
3836 #endif | |
3791 | 3837 |
3792 | 3838 |
3793 //------------------------------eq--------------------------------------------- | 3839 //------------------------------eq--------------------------------------------- |
3794 // Structural equality check for Type representations | 3840 // Structural equality check for Type representations |
3795 bool TypeMetadataPtr::eq( const Type *t ) const { | 3841 bool TypeMetadataPtr::eq( const Type *t ) const { |
3876 case FloatBot: | 3922 case FloatBot: |
3877 case DoubleTop: | 3923 case DoubleTop: |
3878 case DoubleCon: | 3924 case DoubleCon: |
3879 case DoubleBot: | 3925 case DoubleBot: |
3880 case NarrowOop: | 3926 case NarrowOop: |
3927 case NarrowKlass: | |
3881 case Bottom: // Ye Olde Default | 3928 case Bottom: // Ye Olde Default |
3882 return Type::BOTTOM; | 3929 return Type::BOTTOM; |
3883 case Top: | 3930 case Top: |
3884 return this; | 3931 return this; |
3885 | 3932 |
4167 case FloatBot: | 4214 case FloatBot: |
4168 case DoubleTop: | 4215 case DoubleTop: |
4169 case DoubleCon: | 4216 case DoubleCon: |
4170 case DoubleBot: | 4217 case DoubleBot: |
4171 case NarrowOop: | 4218 case NarrowOop: |
4219 case NarrowKlass: | |
4172 case Bottom: // Ye Olde Default | 4220 case Bottom: // Ye Olde Default |
4173 return Type::BOTTOM; | 4221 return Type::BOTTOM; |
4174 case Top: | 4222 case Top: |
4175 return this; | 4223 return this; |
4176 | 4224 |