comparison src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp @ 10969:a837fa3d3f86

8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint Summary: Detect mmap() commit failures in Linux and Solaris os::commit_memory() impls and call vm_exit_out_of_memory(). Add os::commit_memory_or_exit(). Also tidy up some NMT accounting and some mmap() return value checking. Reviewed-by: zgu, stefank, dholmes, dsamersoff
author dcubed
date Thu, 13 Jun 2013 11:16:38 -0700
parents f08d439fab8c
children bdd155477289
comparison
equal deleted inserted replaced
10405:f2110083203d 10969:a837fa3d3f86
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
99 if (uncommitted_size() < bytes) { 99 if (uncommitted_size() < bytes) {
100 return false; 100 return false;
101 } 101 }
102 102
103 char* const base_addr = committed_high_addr(); 103 char* const base_addr = committed_high_addr();
104 bool result = special() || os::commit_memory(base_addr, bytes, alignment()); 104 bool result = special() ||
105 os::commit_memory(base_addr, bytes, alignment(), !ExecMem);
105 if (result) { 106 if (result) {
106 _committed_high_addr += bytes; 107 _committed_high_addr += bytes;
107 } 108 }
108 109
109 return result; 110 return result;
152 // Next take from the uncommitted region in the other space, and commit it. 153 // Next take from the uncommitted region in the other space, and commit it.
153 tmp_bytes = MIN2(other_space->uncommitted_size(), bytes_needed); 154 tmp_bytes = MIN2(other_space->uncommitted_size(), bytes_needed);
154 if (tmp_bytes > 0) { 155 if (tmp_bytes > 0) {
155 char* const commit_base = committed_high_addr(); 156 char* const commit_base = committed_high_addr();
156 if (other_space->special() || 157 if (other_space->special() ||
157 os::commit_memory(commit_base, tmp_bytes, alignment())) { 158 os::commit_memory(commit_base, tmp_bytes, alignment(), !ExecMem)) {
158 // Reduce the reserved region in the other space. 159 // Reduce the reserved region in the other space.
159 other_space->set_reserved(other_space->reserved_low_addr() + tmp_bytes, 160 other_space->set_reserved(other_space->reserved_low_addr() + tmp_bytes,
160 other_space->reserved_high_addr(), 161 other_space->reserved_high_addr(),
161 other_space->special()); 162 other_space->special());
162 163
267 if (uncommitted_size() < bytes) { 268 if (uncommitted_size() < bytes) {
268 return false; 269 return false;
269 } 270 }
270 271
271 char* const base_addr = committed_low_addr() - bytes; 272 char* const base_addr = committed_low_addr() - bytes;
272 bool result = special() || os::commit_memory(base_addr, bytes, alignment()); 273 bool result = special() ||
274 os::commit_memory(base_addr, bytes, alignment(), !ExecMem);
273 if (result) { 275 if (result) {
274 _committed_low_addr -= bytes; 276 _committed_low_addr -= bytes;
275 } 277 }
276 278
277 return result; 279 return result;
320 // Next take from the uncommitted region in the other space, and commit it. 322 // Next take from the uncommitted region in the other space, and commit it.
321 tmp_bytes = MIN2(other_space->uncommitted_size(), bytes_needed); 323 tmp_bytes = MIN2(other_space->uncommitted_size(), bytes_needed);
322 if (tmp_bytes > 0) { 324 if (tmp_bytes > 0) {
323 char* const commit_base = committed_low_addr() - tmp_bytes; 325 char* const commit_base = committed_low_addr() - tmp_bytes;
324 if (other_space->special() || 326 if (other_space->special() ||
325 os::commit_memory(commit_base, tmp_bytes, alignment())) { 327 os::commit_memory(commit_base, tmp_bytes, alignment(), !ExecMem)) {
326 // Reduce the reserved region in the other space. 328 // Reduce the reserved region in the other space.
327 other_space->set_reserved(other_space->reserved_low_addr(), 329 other_space->set_reserved(other_space->reserved_low_addr(),
328 other_space->reserved_high_addr() - tmp_bytes, 330 other_space->reserved_high_addr() - tmp_bytes,
329 other_space->special()); 331 other_space->special());
330 332