7014526: "java -version" crash on sparc with some values of HeapBaseMinAddress

Make default HeapBaseMinAddress the minimum that can be specified.

Reviewed-by: minqi, kvn, tschatzl, dholmes
This commit is contained in:
Coleen Phillimore 2014-02-19 02:58:13 +00:00
parent db6974faf7
commit a9868648e6
2 changed files with 55 additions and 22 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1657,6 +1657,9 @@ julong Arguments::limit_by_allocatable_memory(julong limit) {
return result;
}
// Use static initialization to get the default before parsing
static const uintx DefaultHeapBaseMinAddress = HeapBaseMinAddress;
void Arguments::set_heap_size() {
if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) {
// Deprecated flag
@ -1688,6 +1691,23 @@ void Arguments::set_heap_size() {
if (UseCompressedOops) {
// Limit the heap size to the maximum possible when using compressed oops
julong max_coop_heap = (julong)max_heap_for_compressed_oops();
// HeapBaseMinAddress can be greater than default but not less than.
if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
if (PrintMiscellaneous && Verbose) { // matches compressed oops printing flags
jio_fprintf(defaultStream::error_stream(),
"HeapBaseMinAddress must be at least " UINTX_FORMAT
" (" UINTX_FORMAT "G) which is greater than value given "
UINTX_FORMAT "\n",
DefaultHeapBaseMinAddress,
DefaultHeapBaseMinAddress/G,
HeapBaseMinAddress);
}
FLAG_SET_ERGO(uintx, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
}
}
if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) {
// Heap should be above HeapBaseMinAddress to get zero based compressed oops
// but it should be not less than default MaxHeapSize.