570 if (treat_throw_as_hot
571 && (!StackTraceInThrowable || OmitStackTraceInFastThrow)) {
572 // If the throw is local, we use a pre-existing instance and
573 // punt on the backtrace. This would lead to a missing backtrace
574 // (a repeat of 4292742) if the backtrace object is ever asked
575 // for its backtrace.
576 // Fixing this remaining case of 4292742 requires some flavor of
577 // escape analysis. Leave that for the future.
578 ciInstance* ex_obj = NULL;
579 switch (reason) {
580 case Deoptimization::Reason_null_check:
581 ex_obj = env()->NullPointerException_instance();
582 break;
583 case Deoptimization::Reason_div0_check:
584 ex_obj = env()->ArithmeticException_instance();
585 break;
586 case Deoptimization::Reason_range_check:
587 ex_obj = env()->ArrayIndexOutOfBoundsException_instance();
588 break;
589 case Deoptimization::Reason_class_check:
590 if (java_bc() == Bytecodes::_aastore || java_bc() == Bytecodes::_vastore) {
591 ex_obj = env()->ArrayStoreException_instance();
592 } else {
593 ex_obj = env()->ClassCastException_instance();
594 }
595 break;
596 default:
597 break;
598 }
599 if (failing()) { stop(); return; } // exception allocation might fail
600 if (ex_obj != NULL) {
601 // Cheat with a preallocated exception object.
602 if (C->log() != NULL)
603 C->log()->elem("hot_throw preallocated='1' reason='%s'",
604 Deoptimization::trap_reason_name(reason));
605 const TypeInstPtr* ex_con = TypeInstPtr::make(ex_obj);
606 Node* ex_node = _gvn.transform(ConNode::make(ex_con));
607
608 // Clear the detail message of the preallocated exception object.
609 // Weblogic sometimes mutates the detail message of exceptions
610 // using reflection.
1069 ciSignature* declared_signature = NULL;
1070 ciMethod* ignored_callee = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
1071 assert(declared_signature != NULL, "cannot be null");
1072 inputs = declared_signature->arg_size_for_bc(code);
1073 int size = declared_signature->return_type()->size();
1074 depth = size - inputs;
1075 }
1076 break;
1077
1078 case Bytecodes::_multianewarray:
1079 {
1080 ciBytecodeStream iter(method());
1081 iter.reset_to_bci(bci());
1082 iter.next();
1083 inputs = iter.get_dimensions();
1084 assert(rsize == 1, "");
1085 depth = rsize - inputs;
1086 }
1087 break;
1088
1089 case Bytecodes::_vwithfield: {
1090 bool ignored_will_link;
1091 ciField* field = method()->get_field_at_bci(bci(), ignored_will_link);
1092 int size = field->type()->size();
1093 inputs = size+1;
1094 depth = rsize - inputs;
1095 break;
1096 }
1097
1098 case Bytecodes::_ireturn:
1099 case Bytecodes::_lreturn:
1100 case Bytecodes::_freturn:
1101 case Bytecodes::_dreturn:
1102 case Bytecodes::_areturn:
1103 case Bytecodes::_vreturn:
1104 assert(rsize == -depth, "");
1105 inputs = rsize;
1106 break;
1107
1108 case Bytecodes::_jsr:
1109 case Bytecodes::_jsr_w:
1110 inputs = 0;
1111 depth = 1; // S.B. depth=1, not zero
1112 break;
1113
1114 default:
1115 // bytecode produces a typed result
1116 inputs = rsize - depth;
1117 assert(inputs >= 0, "");
1118 break;
1119 }
1120
1121 #ifdef ASSERT
1122 // spot check
1123 int outputs = depth + inputs;
|
570 if (treat_throw_as_hot
571 && (!StackTraceInThrowable || OmitStackTraceInFastThrow)) {
572 // If the throw is local, we use a pre-existing instance and
573 // punt on the backtrace. This would lead to a missing backtrace
574 // (a repeat of 4292742) if the backtrace object is ever asked
575 // for its backtrace.
576 // Fixing this remaining case of 4292742 requires some flavor of
577 // escape analysis. Leave that for the future.
578 ciInstance* ex_obj = NULL;
579 switch (reason) {
580 case Deoptimization::Reason_null_check:
581 ex_obj = env()->NullPointerException_instance();
582 break;
583 case Deoptimization::Reason_div0_check:
584 ex_obj = env()->ArithmeticException_instance();
585 break;
586 case Deoptimization::Reason_range_check:
587 ex_obj = env()->ArrayIndexOutOfBoundsException_instance();
588 break;
589 case Deoptimization::Reason_class_check:
590 if (java_bc() == Bytecodes::_aastore) {
591 ex_obj = env()->ArrayStoreException_instance();
592 } else {
593 ex_obj = env()->ClassCastException_instance();
594 }
595 break;
596 default:
597 break;
598 }
599 if (failing()) { stop(); return; } // exception allocation might fail
600 if (ex_obj != NULL) {
601 // Cheat with a preallocated exception object.
602 if (C->log() != NULL)
603 C->log()->elem("hot_throw preallocated='1' reason='%s'",
604 Deoptimization::trap_reason_name(reason));
605 const TypeInstPtr* ex_con = TypeInstPtr::make(ex_obj);
606 Node* ex_node = _gvn.transform(ConNode::make(ex_con));
607
608 // Clear the detail message of the preallocated exception object.
609 // Weblogic sometimes mutates the detail message of exceptions
610 // using reflection.
1069 ciSignature* declared_signature = NULL;
1070 ciMethod* ignored_callee = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
1071 assert(declared_signature != NULL, "cannot be null");
1072 inputs = declared_signature->arg_size_for_bc(code);
1073 int size = declared_signature->return_type()->size();
1074 depth = size - inputs;
1075 }
1076 break;
1077
1078 case Bytecodes::_multianewarray:
1079 {
1080 ciBytecodeStream iter(method());
1081 iter.reset_to_bci(bci());
1082 iter.next();
1083 inputs = iter.get_dimensions();
1084 assert(rsize == 1, "");
1085 depth = rsize - inputs;
1086 }
1087 break;
1088
1089 case Bytecodes::_withfield: {
1090 bool ignored_will_link;
1091 ciField* field = method()->get_field_at_bci(bci(), ignored_will_link);
1092 int size = field->type()->size();
1093 inputs = size+1;
1094 depth = rsize - inputs;
1095 break;
1096 }
1097
1098 case Bytecodes::_ireturn:
1099 case Bytecodes::_lreturn:
1100 case Bytecodes::_freturn:
1101 case Bytecodes::_dreturn:
1102 case Bytecodes::_areturn:
1103 assert(rsize == -depth, "");
1104 inputs = rsize;
1105 break;
1106
1107 case Bytecodes::_jsr:
1108 case Bytecodes::_jsr_w:
1109 inputs = 0;
1110 depth = 1; // S.B. depth=1, not zero
1111 break;
1112
1113 default:
1114 // bytecode produces a typed result
1115 inputs = rsize - depth;
1116 assert(inputs >= 0, "");
1117 break;
1118 }
1119
1120 #ifdef ASSERT
1121 // spot check
1122 int outputs = depth + inputs;
|