190 fdStream out(defaultStream::output_fd()); 191 out.print_raw_cr("# To suppress the following error report, specify this argument"); 192 out.print_raw ("# after -XX: or in .hotspotrc: SuppressErrorAt="); 193 out.print_raw (base_name); 194 char buf[16]; 195 jio_snprintf(buf, sizeof(buf), ":%d", line_no); 196 out.print_raw_cr(buf); 197 } 198 return false; 199 } 200 201 #undef is_token_break 202 203 #else 204 205 // Place-holder for non-existent suppression check: 206 #define error_is_suppressed(file_name, line_no) (false) 207 208 #endif // !PRODUCT 209 210 void report_vm_error(const char* file, int line, const char* error_msg, 211 const char* detail_msg) 212 { 213 if (Debugging || error_is_suppressed(file, line)) return; 214 Thread* const thread = ThreadLocalStorage::get_thread_slow(); 215 VMError err(thread, file, line, error_msg, detail_msg); 216 err.report_and_die(); 217 } 218 219 void report_fatal(const char* file, int line, const char* message) 220 { 221 report_vm_error(file, line, "fatal error", message); 222 } 223 224 void report_vm_out_of_memory(const char* file, int line, size_t size, 225 VMErrorType vm_err_type, const char* message) { 226 if (Debugging) return; 227 228 Thread* thread = ThreadLocalStorage::get_thread_slow(); 229 VMError(thread, file, line, size, vm_err_type, message).report_and_die(); 230 231 // The UseOSErrorReporting option in report_and_die() may allow a return 232 // to here. If so then we'll have to figure out how to handle it. 233 guarantee(false, "report_and_die() should not return here"); 234 } 235 236 void report_should_not_call(const char* file, int line) { 237 report_vm_error(file, line, "ShouldNotCall()"); 238 } 239 240 void report_should_not_reach_here(const char* file, int line) { 241 report_vm_error(file, line, "ShouldNotReachHere()"); 242 } 243 244 void report_unimplemented(const char* file, int line) { 245 report_vm_error(file, line, "Unimplemented()"); 246 } 247 248 void report_untested(const char* file, int line, const char* message) { 249 #ifndef PRODUCT 250 warning("Untested: %s in %s: %d\n", message, file, line); 251 #endif // !PRODUCT 252 } 253 254 void report_out_of_shared_space(SharedSpaceType shared_space) { 255 static const char* name[] = { 256 "shared read only space", 257 "shared read write space", 258 "shared miscellaneous data space", 259 "shared miscellaneous code space" 260 }; 261 static const char* flag[] = { | 190 fdStream out(defaultStream::output_fd()); 191 out.print_raw_cr("# To suppress the following error report, specify this argument"); 192 out.print_raw ("# after -XX: or in .hotspotrc: SuppressErrorAt="); 193 out.print_raw (base_name); 194 char buf[16]; 195 jio_snprintf(buf, sizeof(buf), ":%d", line_no); 196 out.print_raw_cr(buf); 197 } 198 return false; 199 } 200 201 #undef is_token_break 202 203 #else 204 205 // Place-holder for non-existent suppression check: 206 #define error_is_suppressed(file_name, line_no) (false) 207 208 #endif // !PRODUCT 209 210 // A function that never returns. Tells the compilers 211 // that the control flow stops at the call of this function. 212 ATTRIBUTE_NORETURN static void noreturn_function() { 213 while (true) { 214 os::naked_short_sleep(10); 215 } 216 } 217 218 void report_vm_error(const char* file, int line, const char* error_msg, 219 const char* detail_msg) 220 { 221 if (!Debugging && !error_is_suppressed(file, line)) { 222 Thread* const thread = ThreadLocalStorage::get_thread_slow(); 223 VMError err(thread, file, line, error_msg, detail_msg); 224 err.report_and_die(); 225 } 226 BREAKPOINT; 227 } 228 229 void report_vm_out_of_memory(const char* file, int line, size_t size, 230 VMErrorType vm_err_type, const char* message) { 231 if (!Debugging) { 232 Thread* const thread = ThreadLocalStorage::get_thread_slow(); 233 VMError err(thread, file, line, size, vm_err_type, message); 234 err.report_and_die(); 235 } 236 BREAKPOINT; 237 noreturn_function(); 238 } 239 240 void report_vm_error_noreturn(const char* file, int line, const char* error_msg, 241 const char* detail_msg) 242 { 243 report_vm_error(file, line, error_msg, detail_msg); 244 noreturn_function(); 245 } 246 247 void report_fatal(const char* file, int line, const char* message) 248 { 249 report_vm_error_noreturn(file, line, "fatal error", message); 250 } 251 252 253 void report_should_not_call(const char* file, int line) { 254 report_vm_error_noreturn(file, line, "ShouldNotCall()"); 255 } 256 257 void report_should_not_reach_here(const char* file, int line) { 258 report_vm_error_noreturn(file, line, "ShouldNotReachHere()"); 259 } 260 261 void report_unimplemented(const char* file, int line) { 262 report_vm_error(file, line, "Unimplemented()"); 263 } 264 265 void report_untested(const char* file, int line, const char* message) { 266 #ifndef PRODUCT 267 warning("Untested: %s in %s: %d\n", message, file, line); 268 #endif // !PRODUCT 269 } 270 271 void report_out_of_shared_space(SharedSpaceType shared_space) { 272 static const char* name[] = { 273 "shared read only space", 274 "shared read write space", 275 "shared miscellaneous data space", 276 "shared miscellaneous code space" 277 }; 278 static const char* flag[] = { |