< prev index next >

src/hotspot/share/opto/doCall.cpp

Print this page

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

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