< prev index next >

src/hotspot/share/opto/doCall.cpp

Print this page

 925     // No action needed.
 926     return;
 927   }
 928   const TypeInstPtr* ex_type = _gvn.type(ex_node)->isa_instptr();
 929   NOT_PRODUCT(if (ex_type==nullptr) tty->print_cr("*** Exception not InstPtr"));
 930   if (ex_type == nullptr)
 931     ex_type = TypeOopPtr::make_from_klass(env()->Throwable_klass())->is_instptr();
 932 
 933   // determine potential exception handlers
 934   ciExceptionHandlerStream handlers(method(), bci(),
 935                                     ex_type->instance_klass(),
 936                                     ex_type->klass_is_exact());
 937 
 938   // Start executing from the given throw state.  (Keep its stack, for now.)
 939   // Get the exception oop as known at compile time.
 940   ex_node = use_exception_state(ex_map);
 941 
 942   // Get the exception oop klass from its header
 943   Node* ex_klass_node = nullptr;
 944   if (has_exception_handler() && !ex_type->klass_is_exact()) {
 945     Node* p = basic_plus_adr( ex_node, ex_node, oopDesc::klass_offset_in_bytes());
 946     ex_klass_node = _gvn.transform(LoadKlassNode::make(_gvn, nullptr, immutable_memory(), p, TypeInstPtr::KLASS, TypeInstKlassPtr::OBJECT));
 947 
 948     // Compute the exception klass a little more cleverly.
 949     // Obvious solution is to simple do a LoadKlass from the 'ex_node'.
 950     // However, if the ex_node is a PhiNode, I'm going to do a LoadKlass for
 951     // each arm of the Phi.  If I know something clever about the exceptions
 952     // I'm loading the class from, I can replace the LoadKlass with the
 953     // klass constant for the exception oop.
 954     if (ex_node->is_Phi()) {
 955       ex_klass_node = new PhiNode(ex_node->in(0), TypeInstKlassPtr::OBJECT);
 956       for (uint i = 1; i < ex_node->req(); i++) {
 957         Node* ex_in = ex_node->in(i);
 958         if (ex_in == top() || ex_in == nullptr) {
 959           // This path was not taken.
 960           ex_klass_node->init_req(i, top());
 961           continue;
 962         }
 963         Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes());
 964         Node* k = _gvn.transform( LoadKlassNode::make(_gvn, nullptr, immutable_memory(), p, TypeInstPtr::KLASS, TypeInstKlassPtr::OBJECT));
 965         ex_klass_node->init_req( i, k );
 966       }
 967       ex_klass_node = _gvn.transform(ex_klass_node);
 968     }
 969   }
 970 
 971   // Scan the exception table for applicable handlers.
 972   // If none, we can call rethrow() and be done!
 973   // If precise (loaded with no subklasses), insert a D.S. style
 974   // pointer compare to the correct handler and loop back.
 975   // If imprecise, switch to the Rethrow VM-call style handling.
 976 
 977   int remaining = handlers.count_remaining();
 978 
 979   // iterate through all entries sequentially
 980   for (;!handlers.is_done(); handlers.next()) {
 981     ciExceptionHandler* handler = handlers.handler();
 982 
 983     if (handler->is_rethrow()) {

 925     // No action needed.
 926     return;
 927   }
 928   const TypeInstPtr* ex_type = _gvn.type(ex_node)->isa_instptr();
 929   NOT_PRODUCT(if (ex_type==nullptr) tty->print_cr("*** Exception not InstPtr"));
 930   if (ex_type == nullptr)
 931     ex_type = TypeOopPtr::make_from_klass(env()->Throwable_klass())->is_instptr();
 932 
 933   // determine potential exception handlers
 934   ciExceptionHandlerStream handlers(method(), bci(),
 935                                     ex_type->instance_klass(),
 936                                     ex_type->klass_is_exact());
 937 
 938   // Start executing from the given throw state.  (Keep its stack, for now.)
 939   // Get the exception oop as known at compile time.
 940   ex_node = use_exception_state(ex_map);
 941 
 942   // Get the exception oop klass from its header
 943   Node* ex_klass_node = nullptr;
 944   if (has_exception_handler() && !ex_type->klass_is_exact()) {
 945     Node* p = basic_plus_adr( ex_node, ex_node, Type::klass_offset());
 946     ex_klass_node = _gvn.transform(LoadKlassNode::make(_gvn, nullptr, immutable_memory(), p, TypeInstPtr::KLASS, TypeInstKlassPtr::OBJECT));
 947 
 948     // Compute the exception klass a little more cleverly.
 949     // Obvious solution is to simple do a LoadKlass from the 'ex_node'.
 950     // However, if the ex_node is a PhiNode, I'm going to do a LoadKlass for
 951     // each arm of the Phi.  If I know something clever about the exceptions
 952     // I'm loading the class from, I can replace the LoadKlass with the
 953     // klass constant for the exception oop.
 954     if (ex_node->is_Phi()) {
 955       ex_klass_node = new PhiNode(ex_node->in(0), TypeInstKlassPtr::OBJECT);
 956       for (uint i = 1; i < ex_node->req(); i++) {
 957         Node* ex_in = ex_node->in(i);
 958         if (ex_in == top() || ex_in == nullptr) {
 959           // This path was not taken.
 960           ex_klass_node->init_req(i, top());
 961           continue;
 962         }
 963         Node* p = basic_plus_adr(ex_in, ex_in, Type::klass_offset());
 964         Node* k = _gvn.transform( LoadKlassNode::make(_gvn, nullptr, immutable_memory(), p, TypeInstPtr::KLASS, TypeInstKlassPtr::OBJECT));
 965         ex_klass_node->init_req( i, k );
 966       }
 967       ex_klass_node = _gvn.transform(ex_klass_node);
 968     }
 969   }
 970 
 971   // Scan the exception table for applicable handlers.
 972   // If none, we can call rethrow() and be done!
 973   // If precise (loaded with no subklasses), insert a D.S. style
 974   // pointer compare to the correct handler and loop back.
 975   // If imprecise, switch to the Rethrow VM-call style handling.
 976 
 977   int remaining = handlers.count_remaining();
 978 
 979   // iterate through all entries sequentially
 980   for (;!handlers.is_done(); handlers.next()) {
 981     ciExceptionHandler* handler = handlers.handler();
 982 
 983     if (handler->is_rethrow()) {
< prev index next >