Mercurial > hg > truffle
diff src/share/vm/runtime/arguments.cpp @ 8741:eac371996b44
8001049: VM crashes when running with large -Xms and not specifying ObjectAlignmentInBytes
Summary: Take the initial heap size into account when checking the heap size for compressed oops
Reviewed-by: jmasa, kvn, hseigel, ctornqvi
author | brutisso |
---|---|
date | Tue, 12 Mar 2013 08:33:57 +0100 |
parents | 209f8ba5020b |
children | 15401203db6b |
line wrap: on
line diff
--- a/src/share/vm/runtime/arguments.cpp Mon Mar 11 02:24:01 2013 -0700 +++ b/src/share/vm/runtime/arguments.cpp Tue Mar 12 08:33:57 2013 +0100 @@ -1381,6 +1381,40 @@ return false; } +void Arguments::set_use_compressed_oops() { +#ifndef ZERO +#ifdef _LP64 + // MaxHeapSize is not set up properly at this point, but + // the only value that can override MaxHeapSize if we are + // to use UseCompressedOops is InitialHeapSize. + size_t max_heap_size = MAX2(MaxHeapSize, InitialHeapSize); + + if (max_heap_size <= max_heap_for_compressed_oops()) { +#if !defined(COMPILER1) || defined(TIERED) + if (FLAG_IS_DEFAULT(UseCompressedOops)) { + FLAG_SET_ERGO(bool, UseCompressedOops, true); + } +#endif +#ifdef _WIN64 + if (UseLargePages && UseCompressedOops) { + // Cannot allocate guard pages for implicit checks in indexed addressing + // mode, when large pages are specified on windows. + // This flag could be switched ON if narrow oop base address is set to 0, + // see code in Universe::initialize_heap(). + Universe::set_narrow_oop_use_implicit_null_checks(false); + } +#endif // _WIN64 + } else { + if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { + warning("Max heap size too large for Compressed Oops"); + FLAG_SET_DEFAULT(UseCompressedOops, false); + FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); + } + } +#endif // _LP64 +#endif // ZERO +} + void Arguments::set_ergonomics_flags() { if (os::is_server_class_machine()) { @@ -1410,30 +1444,7 @@ #ifndef ZERO #ifdef _LP64 - // Check that UseCompressedOops can be set with the max heap size allocated - // by ergonomics. - if (MaxHeapSize <= max_heap_for_compressed_oops()) { -#if !defined(COMPILER1) || defined(TIERED) - if (FLAG_IS_DEFAULT(UseCompressedOops)) { - FLAG_SET_ERGO(bool, UseCompressedOops, true); - } -#endif -#ifdef _WIN64 - if (UseLargePages && UseCompressedOops) { - // Cannot allocate guard pages for implicit checks in indexed addressing - // mode, when large pages are specified on windows. - // This flag could be switched ON if narrow oop base address is set to 0, - // see code in Universe::initialize_heap(). - Universe::set_narrow_oop_use_implicit_null_checks(false); - } -#endif // _WIN64 - } else { - if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { - warning("Max heap size too large for Compressed Oops"); - FLAG_SET_DEFAULT(UseCompressedOops, false); - FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); - } - } + set_use_compressed_oops(); // UseCompressedOops must be on for UseCompressedKlassPointers to be on. if (!UseCompressedOops) { if (UseCompressedKlassPointers) {