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