1055 RedefineVerifyMark rvm(&the_class, &scratch_class, state); 1056 Verifier::verify( 1057 scratch_class, Verifier::ThrowException, true, THREAD); 1058 } 1059 1060 if (HAS_PENDING_EXCEPTION) { 1061 Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); 1062 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark 1063 RC_TRACE_WITH_THREAD(0x00000002, THREAD, 1064 ("verify_byte_codes exception: '%s'", ex_name->as_C_string())); 1065 CLEAR_PENDING_EXCEPTION; 1066 if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { 1067 return JVMTI_ERROR_OUT_OF_MEMORY; 1068 } else { 1069 // tell the caller the bytecodes are bad 1070 return JVMTI_ERROR_FAILS_VERIFICATION; 1071 } 1072 } 1073 1074 res = merge_cp_and_rewrite(the_class, scratch_class, THREAD); 1075 if (res != JVMTI_ERROR_NONE) { 1076 return res; 1077 } 1078 1079 if (VerifyMergedCPBytecodes) { 1080 // verify what we have done during constant pool merging 1081 { 1082 RedefineVerifyMark rvm(&the_class, &scratch_class, state); 1083 Verifier::verify(scratch_class, Verifier::ThrowException, true, THREAD); 1084 } 1085 1086 if (HAS_PENDING_EXCEPTION) { 1087 Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); 1088 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark 1089 RC_TRACE_WITH_THREAD(0x00000002, THREAD, 1090 ("verify_byte_codes post merge-CP exception: '%s'", 1091 ex_name->as_C_string())); 1092 CLEAR_PENDING_EXCEPTION; 1093 if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { 1094 return JVMTI_ERROR_OUT_OF_MEMORY; 1095 } else { 1096 // tell the caller that constant pool merging screwed up 1097 return JVMTI_ERROR_INTERNAL; 1098 } 1099 } 1100 } 1101 1102 Rewriter::rewrite(scratch_class, THREAD); 1103 if (!HAS_PENDING_EXCEPTION) { 1104 scratch_class->link_methods(THREAD); 1105 } 1106 if (HAS_PENDING_EXCEPTION) { 1107 Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); 1108 CLEAR_PENDING_EXCEPTION; 1109 if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { 1110 return JVMTI_ERROR_OUT_OF_MEMORY; 1111 } else { 1112 return JVMTI_ERROR_INTERNAL; 1113 } 1114 } 1115 1116 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark 1117 RC_TRACE_WITH_THREAD(0x00000001, THREAD, 1118 ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", 1119 the_class->external_name(), os::available_memory() >> 10)); 1120 } 1121 1122 return JVMTI_ERROR_NONE; 1123 } 1124 1125 1126 // Map old_index to new_index as needed. scratch_cp is only needed 1127 // for RC_TRACE() calls. | 1055 RedefineVerifyMark rvm(&the_class, &scratch_class, state); 1056 Verifier::verify( 1057 scratch_class, Verifier::ThrowException, true, THREAD); 1058 } 1059 1060 if (HAS_PENDING_EXCEPTION) { 1061 Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); 1062 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark 1063 RC_TRACE_WITH_THREAD(0x00000002, THREAD, 1064 ("verify_byte_codes exception: '%s'", ex_name->as_C_string())); 1065 CLEAR_PENDING_EXCEPTION; 1066 if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { 1067 return JVMTI_ERROR_OUT_OF_MEMORY; 1068 } else { 1069 // tell the caller the bytecodes are bad 1070 return JVMTI_ERROR_FAILS_VERIFICATION; 1071 } 1072 } 1073 1074 res = merge_cp_and_rewrite(the_class, scratch_class, THREAD); 1075 if (HAS_PENDING_EXCEPTION) { 1076 Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); 1077 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark 1078 RC_TRACE_WITH_THREAD(0x00000002, THREAD, 1079 ("merge_cp_and_rewrite exception: '%s'", ex_name->as_C_string())); 1080 CLEAR_PENDING_EXCEPTION; 1081 if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { 1082 return JVMTI_ERROR_OUT_OF_MEMORY; 1083 } else { 1084 return JVMTI_ERROR_INTERNAL; 1085 } 1086 } 1087 1088 if (VerifyMergedCPBytecodes) { 1089 // verify what we have done during constant pool merging 1090 { 1091 RedefineVerifyMark rvm(&the_class, &scratch_class, state); 1092 Verifier::verify(scratch_class, Verifier::ThrowException, true, THREAD); 1093 } 1094 1095 if (HAS_PENDING_EXCEPTION) { 1096 Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); 1097 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark 1098 RC_TRACE_WITH_THREAD(0x00000002, THREAD, 1099 ("verify_byte_codes post merge-CP exception: '%s'", 1100 ex_name->as_C_string())); 1101 CLEAR_PENDING_EXCEPTION; 1102 if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { 1103 return JVMTI_ERROR_OUT_OF_MEMORY; 1104 } else { 1105 // tell the caller that constant pool merging screwed up 1106 return JVMTI_ERROR_INTERNAL; 1107 } 1108 } 1109 } 1110 1111 Rewriter::rewrite(scratch_class, THREAD); 1112 if (!HAS_PENDING_EXCEPTION) { 1113 scratch_class->link_methods(THREAD); 1114 } 1115 if (HAS_PENDING_EXCEPTION) { 1116 Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); 1117 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark 1118 RC_TRACE_WITH_THREAD(0x00000002, THREAD, 1119 ("Rewriter::rewrite or link_methods exception: '%s'", ex_name->as_C_string())); 1120 CLEAR_PENDING_EXCEPTION; 1121 if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { 1122 return JVMTI_ERROR_OUT_OF_MEMORY; 1123 } else { 1124 return JVMTI_ERROR_INTERNAL; 1125 } 1126 } 1127 1128 // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark 1129 RC_TRACE_WITH_THREAD(0x00000001, THREAD, 1130 ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", 1131 the_class->external_name(), os::available_memory() >> 10)); 1132 } 1133 1134 return JVMTI_ERROR_NONE; 1135 } 1136 1137 1138 // Map old_index to new_index as needed. scratch_cp is only needed 1139 // for RC_TRACE() calls. |