< prev index next >

src/hotspot/share/opto/doCall.cpp

Print this page

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

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