diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp index dc6b8d4919a5a02cd91c332b140285d89868bf1d..566f3c1cd4675d5283f0010fac9c381cb2ec9ae1 100644 --- a/src/os/solaris/vm/os_solaris.cpp +++ b/src/os/solaris/vm/os_solaris.cpp @@ -824,7 +824,7 @@ void os::init_system_properties_values() { // allocate new buffer and initialize info = (Dl_serinfo*)malloc(_info.dls_size); if (info == NULL) { - vm_exit_out_of_memory(_info.dls_size, + vm_exit_out_of_memory(_info.dls_size, OOM_MALLOC_ERROR, "init_system_properties_values info"); } info->dls_size = _info.dls_size; @@ -866,7 +866,7 @@ void os::init_system_properties_values() { common_path = malloc(bufsize); if (common_path == NULL) { free(info); - vm_exit_out_of_memory(bufsize, + vm_exit_out_of_memory(bufsize, OOM_MALLOC_ERROR, "init_system_properties_values common_path"); } sprintf(common_path, COMMON_DIR "/lib/%s", cpu_arch); @@ -879,7 +879,7 @@ void os::init_system_properties_values() { if (library_path == NULL) { free(info); free(common_path); - vm_exit_out_of_memory(bufsize, + vm_exit_out_of_memory(bufsize, OOM_MALLOC_ERROR, "init_system_properties_values library_path"); } library_path[0] = '\0'; @@ -1623,7 +1623,8 @@ void os::thread_local_storage_at_put(int index, void* value) { // %%% this is used only in threadLocalStorage.cpp if (thr_setspecific((thread_key_t)index, value)) { if (errno == ENOMEM) { - vm_exit_out_of_memory(SMALLINT, "thr_setspecific: out of swap space"); + vm_exit_out_of_memory(SMALLINT, OOM_MALLOC_ERROR, + "thr_setspecific: out of swap space"); } else { fatal(err_msg("os::thread_local_storage_at_put: thr_setspecific failed " "(%s)", strerror(errno))); diff --git a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp index cf8634f90cb9603a3d94f0a00dc0f8af45bda5b5..d97f0e041bfe80f115bc773f0bde82effa50830d 100644 --- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -178,7 +178,7 @@ static void current_stack_region(address* bottom, size_t* size) { // JVM needs to know exact stack location, abort if it fails if (rslt != 0) { if (rslt == ENOMEM) { - vm_exit_out_of_memory(0, "pthread_getattr_np"); + vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); } else { fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt)); } diff --git a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index 5cdab45d4cb5009a60759a01610ac606c900e9ee..4fbea466cede069c7a447a6cee97af9dad449adf 100644 --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -710,7 +710,7 @@ static void current_stack_region(address * bottom, size_t * size) { // JVM needs to know exact stack location, abort if it fails if (rslt != 0) { if (rslt == ENOMEM) { - vm_exit_out_of_memory(0, "pthread_getattr_np"); + vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); } else { fatal(err_msg("pthread_getattr_np failed with errno = %d", rslt)); } diff --git a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp index 74ec81369aebd37acdb7b486b9430502bbbdb79a..de0ba9a6ad5bf2b02e7156f5ebb176e1ebea672b 100644 --- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -313,7 +313,7 @@ static void current_stack_region(address *bottom, size_t *size) { int res = pthread_getattr_np(pthread_self(), &attr); if (res != 0) { if (res == ENOMEM) { - vm_exit_out_of_memory(0, "pthread_getattr_np"); + vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); } else { fatal(err_msg("pthread_getattr_np failed with errno = %d", res)); diff --git a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index f0db469941ad25d1b22ed315b0ad535932c7e990..78902e1b47789103f7234ef5d362506d42ee8b34 100644 --- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -591,7 +591,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, // on the thread stack, which could get a mapping error when touched. address addr = (address) info->si_addr; if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) { - vm_exit_out_of_memory(0, "Out of swap space to map in thread stack."); + vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "Out of swap space to map in thread stack."); } VMError err(t, sig, pc, info, ucVoid); diff --git a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index d954063c29676bc646013a8ec701dfd5df052cc3..51846441ecd9283c9547cac00cfe1caa4dfe7a8a 100644 --- a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -745,7 +745,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, // on the thread stack, which could get a mapping error when touched. address addr = (address) info->si_addr; if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) { - vm_exit_out_of_memory(0, "Out of swap space to map in thread stack."); + vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "Out of swap space to map in thread stack."); } VMError err(t, sig, pc, info, ucVoid); diff --git a/src/share/vm/asm/assembler.cpp b/src/share/vm/asm/assembler.cpp index d23c0f50f2e1aec9ed6941ac3a567d137d4195a5..b56e2828636652b95bad423e6afd0be4a4f3eaf0 100644 --- a/src/share/vm/asm/assembler.cpp +++ b/src/share/vm/asm/assembler.cpp @@ -44,7 +44,7 @@ AbstractAssembler::AbstractAssembler(CodeBuffer* code) { CodeSection* cs = code->insts(); cs->clear_mark(); // new assembler kills old mark if (cs->start() == NULL) { - vm_exit_out_of_memory(0, err_msg("CodeCache: no room for %s", + vm_exit_out_of_memory(0, OOM_MMAP_ERROR, err_msg("CodeCache: no room for %s", code->name())); } _code_section = cs; diff --git a/src/share/vm/code/stubs.cpp b/src/share/vm/code/stubs.cpp index 930c637fac939aa369ed61554d7dd060e9c3585b..a826a3550d359e95cf2da4a228eb0db9286acc07 100644 --- a/src/share/vm/code/stubs.cpp +++ b/src/share/vm/code/stubs.cpp @@ -67,7 +67,7 @@ StubQueue::StubQueue(StubInterface* stub_interface, int buffer_size, intptr_t size = round_to(buffer_size, 2*BytesPerWord); BufferBlob* blob = BufferBlob::create(name, size); if( blob == NULL) { - vm_exit_out_of_memory(size, err_msg("CodeCache: no room for %s", name)); + vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, err_msg("CodeCache: no room for %s", name)); } _stub_interface = stub_interface; _buffer_size = blob->content_size(); diff --git a/src/share/vm/code/vtableStubs.cpp b/src/share/vm/code/vtableStubs.cpp index df46601635ab7e1e7578f20f3d64546e63c9886e..b080714533060577abf570bf4e49420ea0584abc 100644 --- a/src/share/vm/code/vtableStubs.cpp +++ b/src/share/vm/code/vtableStubs.cpp @@ -60,7 +60,7 @@ void* VtableStub::operator new(size_t size, int code_size) { const int bytes = chunk_factor * real_size + pd_code_alignment(); BufferBlob* blob = BufferBlob::create("vtable chunks", bytes); if (blob == NULL) { - vm_exit_out_of_memory(bytes, "CodeCache: no room for vtable chunks"); + vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "CodeCache: no room for vtable chunks"); } _chunk = blob->content_begin(); _chunk_end = _chunk + bytes; diff --git a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp index 9152e7010bf2ef44e508631b8c8ed2787f91fe8e..8fe07693d777aa2e3d1df45c4c5ca0af76b35509 100644 --- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp +++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp @@ -77,7 +77,7 @@ void G1BlockOffsetSharedArray::resize(size_t new_word_size) { assert(delta > 0, "just checking"); if (!_vs.expand_by(delta)) { // Do better than this for Merlin - vm_exit_out_of_memory(delta, "offset table expansion"); + vm_exit_out_of_memory(delta, OOM_MMAP_ERROR, "offset table expansion"); } assert(_vs.high() == high + delta, "invalid expansion"); // Initialization of the contents is left to the diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 85bc31b8a53a0196d29fbe09c664874f15f6fedf..4eea2a48cd5bc27d48f04ee45a34683dbe129f99 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1831,7 +1831,7 @@ bool G1CollectedHeap::expand(size_t expand_bytes) { if (G1ExitOnExpansionFailure && _g1_storage.uncommitted_size() >= aligned_expand_bytes) { // We had head room... - vm_exit_out_of_memory(aligned_expand_bytes, "G1 heap expansion"); + vm_exit_out_of_memory(aligned_expand_bytes, OOM_MMAP_ERROR, "G1 heap expansion"); } } return successful; @@ -3614,7 +3614,7 @@ G1CollectedHeap::setup_surviving_young_words() { uint array_length = g1_policy()->young_cset_region_length(); _surviving_young_words = NEW_C_HEAP_ARRAY(size_t, (size_t) array_length, mtGC); if (_surviving_young_words == NULL) { - vm_exit_out_of_memory(sizeof(size_t) * array_length, + vm_exit_out_of_memory(sizeof(size_t) * array_length, OOM_MALLOC_ERROR, "Not enough space for young surv words summary."); } memset(_surviving_young_words, 0, (size_t) array_length * sizeof(size_t)); @@ -4397,7 +4397,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num) PADDING_ELEM_NUM; _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC); if (_surviving_young_words_base == NULL) - vm_exit_out_of_memory(array_length * sizeof(size_t), + vm_exit_out_of_memory(array_length * sizeof(size_t), OOM_MALLOC_ERROR, "Not enough space for young surv histo."); _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM; memset(_surviving_young_words, 0, (size_t) real_length * sizeof(size_t)); diff --git a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp index 56e94051c3abb3c2a27b2dda855e7bd88af3fbe7..aeaeea3986602f595571eda1bb2dcb29014bfef6 100644 --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @@ -285,7 +285,7 @@ OtherRegionsTable::OtherRegionsTable(HeapRegion* hr) : _fine_grain_regions = new PerRegionTablePtr[_max_fine_entries]; if (_fine_grain_regions == NULL) { - vm_exit_out_of_memory(sizeof(void*)*_max_fine_entries, + vm_exit_out_of_memory(sizeof(void*)*_max_fine_entries, OOM_MALLOC_ERROR, "Failed to allocate _fine_grain_entries."); } diff --git a/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp b/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp index 83d3edffc3483fa3b9fc0d76b8bff6069b9ea775..b2134f10e92e9bd913111bc8880996338a3230d8 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp @@ -567,7 +567,7 @@ bool CardTableExtension::resize_commit_uncommit(int changed_region, MemRegion(new_start_aligned, new_end_for_commit); if (!os::commit_memory((char*)new_committed.start(), new_committed.byte_size())) { - vm_exit_out_of_memory(new_committed.byte_size(), + vm_exit_out_of_memory(new_committed.byte_size(), OOM_MMAP_ERROR, "card table expansion"); } } diff --git a/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp index 2ea89a59eb8e935c0f90341c8c4c2e52c55ad56e..234d5981a244da25ba30f1f665d3f02009485c5e 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp @@ -43,7 +43,7 @@ GCTaskThread::GCTaskThread(GCTaskManager* manager, _time_stamp_index(0) { if (!os::create_thread(this, os::pgc_thread)) - vm_exit_out_of_memory(0, "Cannot create GC thread. Out of system resources."); + vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GC thread. Out of system resources."); if (PrintGCTaskTimeStamps) { _time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC); diff --git a/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp b/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp index 06b3daa7da1fbf00e39663bede1b24f74f79f1ac..a7713b4dcfaa6588f8d1f1e1457f73404b021dbe 100644 --- a/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp +++ b/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.cpp @@ -99,7 +99,7 @@ void ObjectStartArray::set_covered_region(MemRegion mr) { // Expand size_t expand_by = requested_blocks_size_in_bytes - current_blocks_size_in_bytes; if (!_virtual_space.expand_by(expand_by)) { - vm_exit_out_of_memory(expand_by, "object start array expansion"); + vm_exit_out_of_memory(expand_by, OOM_MMAP_ERROR, "object start array expansion"); } // Clear *only* the newly allocated region memset(_blocks_region.end(), clean_block, expand_by); diff --git a/src/share/vm/interpreter/interpreterRuntime.cpp b/src/share/vm/interpreter/interpreterRuntime.cpp index 66d7e03bace50e6bafbd732f57a1b7ff83762d9d..f5f9d39bcec27ea576a0ff0f5c02ac4c4226b46a 100644 --- a/src/share/vm/interpreter/interpreterRuntime.cpp +++ b/src/share/vm/interpreter/interpreterRuntime.cpp @@ -1052,7 +1052,7 @@ void SignatureHandlerLibrary::initialize() { return; } if (set_handler_blob() == NULL) { - vm_exit_out_of_memory(blob_size, "native signature handlers"); + vm_exit_out_of_memory(blob_size, OOM_MALLOC_ERROR, "native signature handlers"); } BufferBlob* bb = BufferBlob::create("Signature Handler Temp Buffer", diff --git a/src/share/vm/memory/allocation.cpp b/src/share/vm/memory/allocation.cpp index f83eada8192eaeacec163f78079edf401e48c05e..1c1bf7ab468360e8986c1a38d44b435a092c972d 100644 --- a/src/share/vm/memory/allocation.cpp +++ b/src/share/vm/memory/allocation.cpp @@ -259,7 +259,7 @@ class ChunkPool: public CHeapObj { } if (p == NULL) p = os::malloc(bytes, mtChunk, CURRENT_PC); if (p == NULL) - vm_exit_out_of_memory(bytes, "ChunkPool::allocate"); + vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "ChunkPool::allocate"); return p; } @@ -371,7 +371,7 @@ void* Chunk::operator new(size_t requested_size, size_t length) { default: { void *p = os::malloc(bytes, mtChunk, CALLER_PC); if (p == NULL) - vm_exit_out_of_memory(bytes, "Chunk::new"); + vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "Chunk::new"); return p; } } @@ -531,7 +531,7 @@ size_t Arena::used() const { } void Arena::signal_out_of_memory(size_t sz, const char* whence) const { - vm_exit_out_of_memory(sz, whence); + vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, whence); } // Grow a new Chunk diff --git a/src/share/vm/memory/allocation.inline.hpp b/src/share/vm/memory/allocation.inline.hpp index 79bd774e358049832cb9a5284bff0d388f4c2142..c77e578dca658b8b06630fc8e9459999f470c164 100644 --- a/src/share/vm/memory/allocation.inline.hpp +++ b/src/share/vm/memory/allocation.inline.hpp @@ -58,7 +58,9 @@ inline char* AllocateHeap(size_t size, MEMFLAGS flags, address pc = 0, #ifdef ASSERT if (PrintMallocFree) trace_heap_malloc(size, "AllocateHeap", p); #endif - if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) vm_exit_out_of_memory(size, "AllocateHeap"); + if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) { + vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "AllocateHeap"); + } return p; } @@ -68,7 +70,9 @@ inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flags, #ifdef ASSERT if (PrintMallocFree) trace_heap_malloc(size, "ReallocateHeap", p); #endif - if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) vm_exit_out_of_memory(size, "ReallocateHeap"); + if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) { + vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "ReallocateHeap"); + } return p; } @@ -130,12 +134,12 @@ E* ArrayAllocator::allocate(size_t length) { _addr = os::reserve_memory(_size, NULL, alignment); if (_addr == NULL) { - vm_exit_out_of_memory(_size, "Allocator (reserve)"); + vm_exit_out_of_memory(_size, OOM_MMAP_ERROR, "Allocator (reserve)"); } bool success = os::commit_memory(_addr, _size, false /* executable */); if (!success) { - vm_exit_out_of_memory(_size, "Allocator (commit)"); + vm_exit_out_of_memory(_size, OOM_MMAP_ERROR, "Allocator (commit)"); } return (E*)_addr; diff --git a/src/share/vm/memory/blockOffsetTable.cpp b/src/share/vm/memory/blockOffsetTable.cpp index c083ec5098e83f0ad7bbc385b0f14975703822f2..841794a0164750d248dbc884a01897022e8f38dd 100644 --- a/src/share/vm/memory/blockOffsetTable.cpp +++ b/src/share/vm/memory/blockOffsetTable.cpp @@ -80,7 +80,7 @@ void BlockOffsetSharedArray::resize(size_t new_word_size) { assert(delta > 0, "just checking"); if (!_vs.expand_by(delta)) { // Do better than this for Merlin - vm_exit_out_of_memory(delta, "offset table expansion"); + vm_exit_out_of_memory(delta, OOM_MMAP_ERROR, "offset table expansion"); } assert(_vs.high() == high + delta, "invalid expansion"); } else { diff --git a/src/share/vm/memory/cardTableModRefBS.cpp b/src/share/vm/memory/cardTableModRefBS.cpp index 3c65d29a5f272ab93ece768ef9e8d170259a4570..cbe3654cc65fedc927d9722a92efdf69ed2ca1c8 100644 --- a/src/share/vm/memory/cardTableModRefBS.cpp +++ b/src/share/vm/memory/cardTableModRefBS.cpp @@ -116,7 +116,7 @@ CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap, _guard_region = MemRegion((HeapWord*)guard_page, _page_size); if (!os::commit_memory((char*)guard_page, _page_size, _page_size)) { // Do better than this for Merlin - vm_exit_out_of_memory(_page_size, "card table last card"); + vm_exit_out_of_memory(_page_size, OOM_MMAP_ERROR, "card table last card"); } *guard_card = last_card; @@ -292,7 +292,7 @@ void CardTableModRefBS::resize_covered_region(MemRegion new_region) { if (!os::commit_memory((char*)new_committed.start(), new_committed.byte_size(), _page_size)) { // Do better than this for Merlin - vm_exit_out_of_memory(new_committed.byte_size(), + vm_exit_out_of_memory(new_committed.byte_size(), OOM_MMAP_ERROR, "card table expansion"); } // Use new_end_aligned (as opposed to new_end_for_commit) because diff --git a/src/share/vm/oops/oop.cpp b/src/share/vm/oops/oop.cpp index cedbbb6ac84e01b19bfec1021727393b5f474f5c..aed29da67966f17cda1a6b8f43cb7453ef4fcfd8 100644 --- a/src/share/vm/oops/oop.cpp +++ b/src/share/vm/oops/oop.cpp @@ -111,7 +111,7 @@ unsigned int oopDesc::new_hash(jint seed) { // Use alternate hashing algorithm on the string return AltHashing::murmur3_32(seed, chars, length); } else { - vm_exit_out_of_memory(length, "unable to create Unicode strings for String table rehash"); + vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "unable to create Unicode strings for String table rehash"); return 0; } } diff --git a/src/share/vm/prims/jvmtiTagMap.cpp b/src/share/vm/prims/jvmtiTagMap.cpp index 5d72029d264cb0f17b00e48c35efd4a242bbe367..99e4af5aa37a7ff5e20cc0bca25f7a98c589ae2e 100644 --- a/src/share/vm/prims/jvmtiTagMap.cpp +++ b/src/share/vm/prims/jvmtiTagMap.cpp @@ -153,7 +153,8 @@ class JvmtiTagHashmap : public CHeapObj { size_t s = initial_size * sizeof(JvmtiTagHashmapEntry*); _table = (JvmtiTagHashmapEntry**)os::malloc(s, mtInternal); if (_table == NULL) { - vm_exit_out_of_memory(s, "unable to allocate initial hashtable for jvmti object tags"); + vm_exit_out_of_memory(s, OOM_MALLOC_ERROR, + "unable to allocate initial hashtable for jvmti object tags"); } for (int i=0; iprint("# Native memory allocation (malloc) failed to allocate "); + st->print("# Native memory allocation "); + st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : + "(mmap) failed to map "); jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); st->print(buf); st->print(" bytes"); @@ -386,7 +389,7 @@ void VMError::report(outputStream* st) { return; // that's enough for the screen } break; - case internal_error: + case INTERNAL_ERROR: default: break; } diff --git a/src/share/vm/utilities/vmError.hpp b/src/share/vm/utilities/vmError.hpp index 5e33b1177f618ddb6f49682a7cfdf14053b1aa42..f298c1edbf57f181fbb61dbd0f48a3e1e58bee79 100644 --- a/src/share/vm/utilities/vmError.hpp +++ b/src/share/vm/utilities/vmError.hpp @@ -34,10 +34,6 @@ class VMError : public StackObj { friend class VM_ReportJavaOutOfMemory; friend class Decoder; - enum ErrorType { - internal_error = 0xe0000000, - oom_error = 0xe0000001 - }; int _id; // Solaris/Linux signals: 0 - SIGRTMAX // Windows exceptions: 0xCxxxxxxx system errors // 0x8xxxxxxx system warnings @@ -96,9 +92,12 @@ class VMError : public StackObj { // accessor const char* message() const { return _message; } const char* detail_msg() const { return _detail_msg; } - bool should_report_bug(unsigned int id) { return id != oom_error; } + bool should_report_bug(unsigned int id) { + return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR); + } public: + // Constructor for crashes VMError(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context); @@ -108,7 +107,7 @@ public: // Constructor for VM OOM errors VMError(Thread* thread, const char* filename, int lineno, size_t size, - const char* message); + VMErrorType vm_err_type, const char* message); // Constructor for non-fatal errors VMError(const char* message); diff --git a/src/share/vm/utilities/workgroup.cpp b/src/share/vm/utilities/workgroup.cpp index 3225ccacbb82f8b5b70b1e8771f492253e93387d..5db6344fd7282bb68cf47284a47dcdaf0ff969ba 100644 --- a/src/share/vm/utilities/workgroup.cpp +++ b/src/share/vm/utilities/workgroup.cpp @@ -79,7 +79,7 @@ bool WorkGang::initialize_workers() { } _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, total_workers(), mtInternal); if (gang_workers() == NULL) { - vm_exit_out_of_memory(0, "Cannot create GangWorker array."); + vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array."); return false; } os::ThreadType worker_type; @@ -93,7 +93,8 @@ bool WorkGang::initialize_workers() { assert(new_worker != NULL, "Failed to allocate GangWorker"); _gang_workers[worker] = new_worker; if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) { - vm_exit_out_of_memory(0, "Cannot create worker GC thread. Out of system resources."); + vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, + "Cannot create worker GC thread. Out of system resources."); return false; } if (!DisableStartThread) {