382 // thread can report error, so large buffers are statically allocated in data 383 // segment. 384 385 int VMError::_current_step; 386 const char* VMError::_current_step_info; 387 388 volatile jlong VMError::_reporting_start_time = -1; 389 volatile bool VMError::_reporting_did_timeout = false; 390 volatile jlong VMError::_step_start_time = -1; 391 volatile bool VMError::_step_did_timeout = false; 392 393 // Helper, return current timestamp for timeout handling. 394 jlong VMError::get_current_timestamp() { 395 return os::javaTimeNanos(); 396 } 397 // Factor to translate the timestamp to seconds. 398 #define TIMESTAMP_TO_SECONDS_FACTOR (1000 * 1000 * 1000) 399 400 void VMError::record_reporting_start_time() { 401 const jlong now = get_current_timestamp(); 402 Atomic::store(now, &_reporting_start_time); 403 } 404 405 jlong VMError::get_reporting_start_time() { 406 return Atomic::load(&_reporting_start_time); 407 } 408 409 void VMError::record_step_start_time() { 410 const jlong now = get_current_timestamp(); 411 Atomic::store(now, &_step_start_time); 412 } 413 414 jlong VMError::get_step_start_time() { 415 return Atomic::load(&_step_start_time); 416 } 417 418 void VMError::clear_step_start_time() { 419 return Atomic::store((jlong)0, &_step_start_time); 420 } 421 422 void VMError::report(outputStream* st, bool _verbose) { 423 424 # define BEGIN if (_current_step == 0) { _current_step = __LINE__; 425 # define STEP(s) } if (_current_step < __LINE__) { _current_step = __LINE__; _current_step_info = s; \ 426 record_step_start_time(); _step_did_timeout = false; 427 # define END clear_step_start_time(); } 428 429 // don't allocate large buffer on stack 430 static char buf[O_BUFLEN]; 431 432 BEGIN 433 434 STEP("printing fatal error message") 435 436 st->print_cr("#"); 437 if (should_report_bug(_id)) { 438 st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); 439 } else { | 382 // thread can report error, so large buffers are statically allocated in data 383 // segment. 384 385 int VMError::_current_step; 386 const char* VMError::_current_step_info; 387 388 volatile jlong VMError::_reporting_start_time = -1; 389 volatile bool VMError::_reporting_did_timeout = false; 390 volatile jlong VMError::_step_start_time = -1; 391 volatile bool VMError::_step_did_timeout = false; 392 393 // Helper, return current timestamp for timeout handling. 394 jlong VMError::get_current_timestamp() { 395 return os::javaTimeNanos(); 396 } 397 // Factor to translate the timestamp to seconds. 398 #define TIMESTAMP_TO_SECONDS_FACTOR (1000 * 1000 * 1000) 399 400 void VMError::record_reporting_start_time() { 401 const jlong now = get_current_timestamp(); 402 Atomic::store(&_reporting_start_time, now); 403 } 404 405 jlong VMError::get_reporting_start_time() { 406 return Atomic::load(&_reporting_start_time); 407 } 408 409 void VMError::record_step_start_time() { 410 const jlong now = get_current_timestamp(); 411 Atomic::store(&_step_start_time, now); 412 } 413 414 jlong VMError::get_step_start_time() { 415 return Atomic::load(&_step_start_time); 416 } 417 418 void VMError::clear_step_start_time() { 419 return Atomic::store(&_step_start_time, (jlong)0); 420 } 421 422 void VMError::report(outputStream* st, bool _verbose) { 423 424 # define BEGIN if (_current_step == 0) { _current_step = __LINE__; 425 # define STEP(s) } if (_current_step < __LINE__) { _current_step = __LINE__; _current_step_info = s; \ 426 record_step_start_time(); _step_did_timeout = false; 427 # define END clear_step_start_time(); } 428 429 // don't allocate large buffer on stack 430 static char buf[O_BUFLEN]; 431 432 BEGIN 433 434 STEP("printing fatal error message") 435 436 st->print_cr("#"); 437 if (should_report_bug(_id)) { 438 st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); 439 } else { |