comparison 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
comparison
equal deleted inserted replaced
8739:ca9580859cf4 8741:eac371996b44
1379 return true; 1379 return true;
1380 } 1380 }
1381 return false; 1381 return false;
1382 } 1382 }
1383 1383
1384 void Arguments::set_use_compressed_oops() {
1385 #ifndef ZERO
1386 #ifdef _LP64
1387 // MaxHeapSize is not set up properly at this point, but
1388 // the only value that can override MaxHeapSize if we are
1389 // to use UseCompressedOops is InitialHeapSize.
1390 size_t max_heap_size = MAX2(MaxHeapSize, InitialHeapSize);
1391
1392 if (max_heap_size <= max_heap_for_compressed_oops()) {
1393 #if !defined(COMPILER1) || defined(TIERED)
1394 if (FLAG_IS_DEFAULT(UseCompressedOops)) {
1395 FLAG_SET_ERGO(bool, UseCompressedOops, true);
1396 }
1397 #endif
1398 #ifdef _WIN64
1399 if (UseLargePages && UseCompressedOops) {
1400 // Cannot allocate guard pages for implicit checks in indexed addressing
1401 // mode, when large pages are specified on windows.
1402 // This flag could be switched ON if narrow oop base address is set to 0,
1403 // see code in Universe::initialize_heap().
1404 Universe::set_narrow_oop_use_implicit_null_checks(false);
1405 }
1406 #endif // _WIN64
1407 } else {
1408 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1409 warning("Max heap size too large for Compressed Oops");
1410 FLAG_SET_DEFAULT(UseCompressedOops, false);
1411 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1412 }
1413 }
1414 #endif // _LP64
1415 #endif // ZERO
1416 }
1417
1384 void Arguments::set_ergonomics_flags() { 1418 void Arguments::set_ergonomics_flags() {
1385 1419
1386 if (os::is_server_class_machine()) { 1420 if (os::is_server_class_machine()) {
1387 // If no other collector is requested explicitly, 1421 // If no other collector is requested explicitly,
1388 // let the VM select the collector based on 1422 // let the VM select the collector based on
1408 } 1442 }
1409 } 1443 }
1410 1444
1411 #ifndef ZERO 1445 #ifndef ZERO
1412 #ifdef _LP64 1446 #ifdef _LP64
1413 // Check that UseCompressedOops can be set with the max heap size allocated 1447 set_use_compressed_oops();
1414 // by ergonomics.
1415 if (MaxHeapSize <= max_heap_for_compressed_oops()) {
1416 #if !defined(COMPILER1) || defined(TIERED)
1417 if (FLAG_IS_DEFAULT(UseCompressedOops)) {
1418 FLAG_SET_ERGO(bool, UseCompressedOops, true);
1419 }
1420 #endif
1421 #ifdef _WIN64
1422 if (UseLargePages && UseCompressedOops) {
1423 // Cannot allocate guard pages for implicit checks in indexed addressing
1424 // mode, when large pages are specified on windows.
1425 // This flag could be switched ON if narrow oop base address is set to 0,
1426 // see code in Universe::initialize_heap().
1427 Universe::set_narrow_oop_use_implicit_null_checks(false);
1428 }
1429 #endif // _WIN64
1430 } else {
1431 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1432 warning("Max heap size too large for Compressed Oops");
1433 FLAG_SET_DEFAULT(UseCompressedOops, false);
1434 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1435 }
1436 }
1437 // UseCompressedOops must be on for UseCompressedKlassPointers to be on. 1448 // UseCompressedOops must be on for UseCompressedKlassPointers to be on.
1438 if (!UseCompressedOops) { 1449 if (!UseCompressedOops) {
1439 if (UseCompressedKlassPointers) { 1450 if (UseCompressedKlassPointers) {
1440 warning("UseCompressedKlassPointers requires UseCompressedOops"); 1451 warning("UseCompressedKlassPointers requires UseCompressedOops");
1441 } 1452 }