src/share/vm/opto/type.cpp

changeset 990
35ae4dd6c27c
parent 852
f4fe12e429a4
child 992
465813e0303a
equal deleted inserted replaced
989:78144dc3db03 990:35ae4dd6c27c
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

mercurial