463 if (_verbose && TestSafeFetchInErrorHandler) {
464 st->print_cr("Will test SafeFetch...");
465 if (CanUseSafeFetch32()) {
466 int* const invalid_pointer = (int*) get_segfault_address();
467 const int x = 0x76543210;
468 int i1 = SafeFetch32(invalid_pointer, x);
469 int i2 = SafeFetch32(invalid_pointer, x);
470 if (i1 == x && i2 == x) {
471 st->print_cr("SafeFetch OK."); // Correctly deflected and returned default pattern
472 } else {
473 st->print_cr("??");
474 }
475 } else {
476 st->print_cr("not possible; skipped.");
477 }
478 }
479 #endif // PRODUCT
480
481 STEP("printing type of error")
482
483 switch(_id) {
484 case OOM_MALLOC_ERROR:
485 case OOM_MMAP_ERROR:
486 if (_size) {
487 st->print("# Native memory allocation ");
488 st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " :
489 "(mmap) failed to map ");
490 jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size);
491 st->print("%s", buf);
492 st->print(" bytes");
493 if (strlen(_detail_msg) > 0) {
494 st->print(" for ");
495 st->print("%s", _detail_msg);
496 }
497 st->cr();
498 } else {
499 if (strlen(_detail_msg) > 0) {
500 st->print("# ");
501 st->print_cr("%s", _detail_msg);
502 }
503 }
|
463 if (_verbose && TestSafeFetchInErrorHandler) {
464 st->print_cr("Will test SafeFetch...");
465 if (CanUseSafeFetch32()) {
466 int* const invalid_pointer = (int*) get_segfault_address();
467 const int x = 0x76543210;
468 int i1 = SafeFetch32(invalid_pointer, x);
469 int i2 = SafeFetch32(invalid_pointer, x);
470 if (i1 == x && i2 == x) {
471 st->print_cr("SafeFetch OK."); // Correctly deflected and returned default pattern
472 } else {
473 st->print_cr("??");
474 }
475 } else {
476 st->print_cr("not possible; skipped.");
477 }
478 }
479 #endif // PRODUCT
480
481 STEP("printing type of error")
482
483 switch(static_cast<unsigned int>(_id)) {
484 case OOM_MALLOC_ERROR:
485 case OOM_MMAP_ERROR:
486 if (_size) {
487 st->print("# Native memory allocation ");
488 st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " :
489 "(mmap) failed to map ");
490 jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size);
491 st->print("%s", buf);
492 st->print(" bytes");
493 if (strlen(_detail_msg) > 0) {
494 st->print(" for ");
495 st->print("%s", _detail_msg);
496 }
497 st->cr();
498 } else {
499 if (strlen(_detail_msg) > 0) {
500 st->print("# ");
501 st->print_cr("%s", _detail_msg);
502 }
503 }
|