comparison src/share/vm/utilities/vmError.cpp @ 10161:746b070f5022

8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap" Reviewed-by: coleenp, zgu, hseigel
author ccheung
date Tue, 30 Apr 2013 11:56:52 -0700
parents 7b835924c31c
children 9ce110b1d14a
comparison
equal deleted inserted replaced
10160:ed5a590835a4 10161:746b070f5022
98 // Constructor for internal errors 98 // Constructor for internal errors
99 VMError::VMError(Thread* thread, const char* filename, int lineno, 99 VMError::VMError(Thread* thread, const char* filename, int lineno,
100 const char* message, const char * detail_msg) 100 const char* message, const char * detail_msg)
101 { 101 {
102 _thread = thread; 102 _thread = thread;
103 _id = internal_error; // Value that's not an OS exception/signal 103 _id = INTERNAL_ERROR; // Value that's not an OS exception/signal
104 _filename = filename; 104 _filename = filename;
105 _lineno = lineno; 105 _lineno = lineno;
106 _message = message; 106 _message = message;
107 _detail_msg = detail_msg; 107 _detail_msg = detail_msg;
108 108
117 _size = 0; 117 _size = 0;
118 } 118 }
119 119
120 // Constructor for OOM errors 120 // Constructor for OOM errors
121 VMError::VMError(Thread* thread, const char* filename, int lineno, size_t size, 121 VMError::VMError(Thread* thread, const char* filename, int lineno, size_t size,
122 const char* message) { 122 VMErrorType vm_err_type, const char* message) {
123 _thread = thread; 123 _thread = thread;
124 _id = oom_error; // Value that's not an OS exception/signal 124 _id = vm_err_type; // Value that's not an OS exception/signal
125 _filename = filename; 125 _filename = filename;
126 _lineno = lineno; 126 _lineno = lineno;
127 _message = message; 127 _message = message;
128 _detail_msg = NULL; 128 _detail_msg = NULL;
129 129
140 140
141 141
142 // Constructor for non-fatal errors 142 // Constructor for non-fatal errors
143 VMError::VMError(const char* message) { 143 VMError::VMError(const char* message) {
144 _thread = NULL; 144 _thread = NULL;
145 _id = internal_error; // Value that's not an OS exception/signal 145 _id = INTERNAL_ERROR; // Value that's not an OS exception/signal
146 _filename = NULL; 146 _filename = NULL;
147 _lineno = 0; 147 _lineno = 0;
148 _message = message; 148 _message = message;
149 _detail_msg = NULL; 149 _detail_msg = NULL;
150 150
349 } 349 }
350 350
351 STEP(15, "(printing type of error)") 351 STEP(15, "(printing type of error)")
352 352
353 switch(_id) { 353 switch(_id) {
354 case oom_error: 354 case OOM_MALLOC_ERROR:
355 case OOM_MMAP_ERROR:
355 if (_size) { 356 if (_size) {
356 st->print("# Native memory allocation (malloc) failed to allocate "); 357 st->print("# Native memory allocation ");
358 st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " :
359 "(mmap) failed to map ");
357 jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); 360 jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size);
358 st->print(buf); 361 st->print(buf);
359 st->print(" bytes"); 362 st->print(" bytes");
360 if (_message != NULL) { 363 if (_message != NULL) {
361 st->print(" for "); 364 st->print(" for ");
384 st->print_cr("# This output file may be truncated or incomplete."); 387 st->print_cr("# This output file may be truncated or incomplete.");
385 } else { 388 } else {
386 return; // that's enough for the screen 389 return; // that's enough for the screen
387 } 390 }
388 break; 391 break;
389 case internal_error: 392 case INTERNAL_ERROR:
390 default: 393 default:
391 break; 394 break;
392 } 395 }
393 396
394 STEP(20, "(printing exception/signal name)") 397 STEP(20, "(printing exception/signal name)")