8013057: assert(_needs_gc || SafepointSynchronize::is_at_safepoint()) failed: only read at safepoint

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
This commit is contained in:
Daniel D. Daugherty 2013-06-13 11:16:38 -07:00
parent 718f3252f6
commit 72a51a0c44
18 changed files with 357 additions and 80 deletions

View file

@ -533,11 +533,13 @@ bool VirtualSpace::expand_by(size_t bytes, bool pre_touch) {
lower_high() + lower_needs <= lower_high_boundary(),
"must not expand beyond region");
if (!os::commit_memory(lower_high(), lower_needs, _executable)) {
debug_only(warning("os::commit_memory failed"));
debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT
", lower_needs=" SIZE_FORMAT ", %d) failed",
lower_high(), lower_needs, _executable);)
return false;
} else {
_lower_high += lower_needs;
}
}
}
if (middle_needs > 0) {
assert(lower_high_boundary() <= middle_high() &&
@ -545,7 +547,10 @@ bool VirtualSpace::expand_by(size_t bytes, bool pre_touch) {
"must not expand beyond region");
if (!os::commit_memory(middle_high(), middle_needs, middle_alignment(),
_executable)) {
debug_only(warning("os::commit_memory failed"));
debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT
", middle_needs=" SIZE_FORMAT ", " SIZE_FORMAT
", %d) failed", middle_high(), middle_needs,
middle_alignment(), _executable);)
return false;
}
_middle_high += middle_needs;
@ -555,7 +560,9 @@ bool VirtualSpace::expand_by(size_t bytes, bool pre_touch) {
upper_high() + upper_needs <= upper_high_boundary(),
"must not expand beyond region");
if (!os::commit_memory(upper_high(), upper_needs, _executable)) {
debug_only(warning("os::commit_memory failed"));
debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT
", upper_needs=" SIZE_FORMAT ", %d) failed",
upper_high(), upper_needs, _executable);)
return false;
} else {
_upper_high += upper_needs;