Mercurial > hg > truffle
comparison src/share/vm/opto/type.cpp @ 570:dca06e7f503d
Merge
author | kvn |
---|---|
date | Tue, 17 Feb 2009 14:30:24 -0800 |
parents | 465813e0303a |
children | 0fbdb4381b99 98cb887364d3 |
comparison
equal
deleted
inserted
replaced
549:fe3d7c11b4b7 | 570:dca06e7f503d |
---|---|
2469 const Type *TypeOopPtr::filter( const Type *kills ) const { | 2469 const Type *TypeOopPtr::filter( const Type *kills ) const { |
2470 | 2470 |
2471 const Type* ft = join(kills); | 2471 const Type* ft = join(kills); |
2472 const TypeInstPtr* ftip = ft->isa_instptr(); | 2472 const TypeInstPtr* ftip = ft->isa_instptr(); |
2473 const TypeInstPtr* ktip = kills->isa_instptr(); | 2473 const TypeInstPtr* ktip = kills->isa_instptr(); |
2474 const TypeKlassPtr* ftkp = ft->isa_klassptr(); | |
2475 const TypeKlassPtr* ktkp = kills->isa_klassptr(); | |
2474 | 2476 |
2475 if (ft->empty()) { | 2477 if (ft->empty()) { |
2476 // Check for evil case of 'this' being a class and 'kills' expecting an | 2478 // Check for evil case of 'this' being a class and 'kills' expecting an |
2477 // interface. This can happen because the bytecodes do not contain | 2479 // interface. This can happen because the bytecodes do not contain |
2478 // enough type info to distinguish a Java-level interface variable | 2480 // enough type info to distinguish a Java-level interface variable |
2482 // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows | 2484 // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows |
2483 // into a Phi which "knows" it's an Interface type we'll have to | 2485 // into a Phi which "knows" it's an Interface type we'll have to |
2484 // uplift the type. | 2486 // uplift the type. |
2485 if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) | 2487 if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) |
2486 return kills; // Uplift to interface | 2488 return kills; // Uplift to interface |
2489 if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) | |
2490 return kills; // Uplift to interface | |
2487 | 2491 |
2488 return Type::TOP; // Canonical empty value | 2492 return Type::TOP; // Canonical empty value |
2489 } | 2493 } |
2490 | 2494 |
2491 // If we have an interface-typed Phi or cast and we narrow to a class type, | 2495 // If we have an interface-typed Phi or cast and we narrow to a class type, |
2496 if (ftip != NULL && ktip != NULL && | 2500 if (ftip != NULL && ktip != NULL && |
2497 ftip->is_loaded() && ftip->klass()->is_interface() && | 2501 ftip->is_loaded() && ftip->klass()->is_interface() && |
2498 ktip->is_loaded() && !ktip->klass()->is_interface()) { | 2502 ktip->is_loaded() && !ktip->klass()->is_interface()) { |
2499 // Happens in a CTW of rt.jar, 320-341, no extra flags | 2503 // Happens in a CTW of rt.jar, 320-341, no extra flags |
2500 return ktip->cast_to_ptr_type(ftip->ptr()); | 2504 return ktip->cast_to_ptr_type(ftip->ptr()); |
2505 } | |
2506 if (ftkp != NULL && ktkp != NULL && | |
2507 ftkp->is_loaded() && ftkp->klass()->is_interface() && | |
2508 ktkp->is_loaded() && !ktkp->klass()->is_interface()) { | |
2509 // Happens in a CTW of rt.jar, 320-341, no extra flags | |
2510 return ktkp->cast_to_ptr_type(ftkp->ptr()); | |
2501 } | 2511 } |
2502 | 2512 |
2503 return ft; | 2513 return ft; |
2504 } | 2514 } |
2505 | 2515 |
3655 return make( _ptr, klass(), xadd_offset(offset) ); | 3665 return make( _ptr, klass(), xadd_offset(offset) ); |
3656 } | 3666 } |
3657 | 3667 |
3658 //------------------------------cast_to_ptr_type------------------------------- | 3668 //------------------------------cast_to_ptr_type------------------------------- |
3659 const Type *TypeKlassPtr::cast_to_ptr_type(PTR ptr) const { | 3669 const Type *TypeKlassPtr::cast_to_ptr_type(PTR ptr) const { |
3660 assert(_base == OopPtr, "subclass must override cast_to_ptr_type"); | 3670 assert(_base == KlassPtr, "subclass must override cast_to_ptr_type"); |
3661 if( ptr == _ptr ) return this; | 3671 if( ptr == _ptr ) return this; |
3662 return make(ptr, _klass, _offset); | 3672 return make(ptr, _klass, _offset); |
3663 } | 3673 } |
3664 | 3674 |
3665 | 3675 |