comparison src/share/vm/runtime/arguments.cpp @ 14474:de7f1b016d55

7014526: "java -version" crash on sparc with some values of HeapBaseMinAddress Summary: Make default HeapBaseMinAddress the minimum that can be specified. Reviewed-by: minqi, kvn, tschatzl, dholmes
author coleenp
date Wed, 19 Feb 2014 02:58:13 +0000
parents 5e1086b5b726
children bb9356ec5967
comparison
equal deleted inserted replaced
14382:805784307dca 14474:de7f1b016d55
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, 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.
1655 result = MIN2(result, max_allocatable / MaxVirtMemFraction); 1655 result = MIN2(result, max_allocatable / MaxVirtMemFraction);
1656 } 1656 }
1657 return result; 1657 return result;
1658 } 1658 }
1659 1659
1660 // Use static initialization to get the default before parsing
1661 static const uintx DefaultHeapBaseMinAddress = HeapBaseMinAddress;
1662
1660 void Arguments::set_heap_size() { 1663 void Arguments::set_heap_size() {
1661 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { 1664 if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) {
1662 // Deprecated flag 1665 // Deprecated flag
1663 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction); 1666 FLAG_SET_CMDLINE(uintx, MaxRAMFraction, DefaultMaxRAMFraction);
1664 } 1667 }
1686 reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit); 1689 reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit);
1687 } 1690 }
1688 if (UseCompressedOops) { 1691 if (UseCompressedOops) {
1689 // Limit the heap size to the maximum possible when using compressed oops 1692 // Limit the heap size to the maximum possible when using compressed oops
1690 julong max_coop_heap = (julong)max_heap_for_compressed_oops(); 1693 julong max_coop_heap = (julong)max_heap_for_compressed_oops();
1694
1695 // HeapBaseMinAddress can be greater than default but not less than.
1696 if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) {
1697 if (HeapBaseMinAddress < DefaultHeapBaseMinAddress) {
1698 if (PrintMiscellaneous && Verbose) { // matches compressed oops printing flags
1699 jio_fprintf(defaultStream::error_stream(),
1700 "HeapBaseMinAddress must be at least " UINTX_FORMAT
1701 " (" UINTX_FORMAT "G) which is greater than value given "
1702 UINTX_FORMAT "\n",
1703 DefaultHeapBaseMinAddress,
1704 DefaultHeapBaseMinAddress/G,
1705 HeapBaseMinAddress);
1706 }
1707 FLAG_SET_ERGO(uintx, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
1708 }
1709 }
1710
1691 if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) { 1711 if (HeapBaseMinAddress + MaxHeapSize < max_coop_heap) {
1692 // Heap should be above HeapBaseMinAddress to get zero based compressed oops 1712 // Heap should be above HeapBaseMinAddress to get zero based compressed oops
1693 // but it should be not less than default MaxHeapSize. 1713 // but it should be not less than default MaxHeapSize.
1694 max_coop_heap -= HeapBaseMinAddress; 1714 max_coop_heap -= HeapBaseMinAddress;
1695 } 1715 }