comparison src/share/vm/memory/universe.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6 78bbf4d43a14
children 7848fc12602b
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
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.
76 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 76 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
77 #include "gc_implementation/g1/g1CollectorPolicy.hpp" 77 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
78 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" 78 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
79 #endif // INCLUDE_ALL_GCS 79 #endif // INCLUDE_ALL_GCS
80 80
81 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
82
81 // Known objects 83 // Known objects
82 Klass* Universe::_boolArrayKlassObj = NULL; 84 Klass* Universe::_boolArrayKlassObj = NULL;
83 Klass* Universe::_byteArrayKlassObj = NULL; 85 Klass* Universe::_byteArrayKlassObj = NULL;
84 Klass* Universe::_charArrayKlassObj = NULL; 86 Klass* Universe::_charArrayKlassObj = NULL;
85 Klass* Universe::_intArrayKlassObj = NULL; 87 Klass* Universe::_intArrayKlassObj = NULL;
630 "LogHeapWordSize is incorrect."); 632 "LogHeapWordSize is incorrect.");
631 guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?"); 633 guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
632 guarantee(sizeof(oop) % sizeof(HeapWord) == 0, 634 guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
633 "oop size is not not a multiple of HeapWord size"); 635 "oop size is not not a multiple of HeapWord size");
634 TraceTime timer("Genesis", TraceStartupTime); 636 TraceTime timer("Genesis", TraceStartupTime);
635 GC_locker::lock(); // do not allow gc during bootstrapping
636 JavaClasses::compute_hard_coded_offsets(); 637 JavaClasses::compute_hard_coded_offsets();
637 638
638 jint status = Universe::initialize_heap(); 639 jint status = Universe::initialize_heap();
639 if (status != JNI_OK) { 640 if (status != JNI_OK) {
640 return status; 641 return status;
757 } else { 758 } else {
758 // Set to a non-NULL value so the ReservedSpace ctor computes 759 // Set to a non-NULL value so the ReservedSpace ctor computes
759 // the correct no-access prefix. 760 // the correct no-access prefix.
760 // The final value will be set in initialize_heap() below. 761 // The final value will be set in initialize_heap() below.
761 Universe::set_narrow_oop_base((address)UnscaledOopHeapMax); 762 Universe::set_narrow_oop_base((address)UnscaledOopHeapMax);
762 #ifdef _WIN64 763 #if defined(_WIN64) || defined(AIX)
763 if (UseLargePages) { 764 if (UseLargePages) {
764 // Cannot allocate guard pages for implicit checks in indexed 765 // Cannot allocate guard pages for implicit checks in indexed
765 // addressing mode when large pages are specified on windows. 766 // addressing mode when large pages are specified on windows.
766 Universe::set_narrow_oop_use_implicit_null_checks(false); 767 Universe::set_narrow_oop_use_implicit_null_checks(false);
767 } 768 }
814 gc_policy->initialize_all(); 815 gc_policy->initialize_all();
815 816
816 Universe::_collectedHeap = new GenCollectedHeap(gc_policy); 817 Universe::_collectedHeap = new GenCollectedHeap(gc_policy);
817 } 818 }
818 819
820 ThreadLocalAllocBuffer::set_max_size(Universe::heap()->max_tlab_size());
821
819 jint status = Universe::heap()->initialize(); 822 jint status = Universe::heap()->initialize();
820 if (status != JNI_OK) { 823 if (status != JNI_OK) {
821 return status; 824 return status;
822 } 825 }
823 826
837 } 840 }
838 if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax)) { 841 if (((uint64_t)Universe::heap()->reserved_region().end() > OopEncodingHeapMax)) {
839 // Can't reserve heap below 32Gb. 842 // Can't reserve heap below 32Gb.
840 // keep the Universe::narrow_oop_base() set in Universe::reserve_heap() 843 // keep the Universe::narrow_oop_base() set in Universe::reserve_heap()
841 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); 844 Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
845 #ifdef AIX
846 // There is no protected page before the heap. This assures all oops
847 // are decoded so that NULL is preserved, so this page will not be accessed.
848 Universe::set_narrow_oop_use_implicit_null_checks(false);
849 #endif
842 if (verbose) { 850 if (verbose) {
843 tty->print(", %s: "PTR_FORMAT, 851 tty->print(", %s: "PTR_FORMAT,
844 narrow_oop_mode_to_string(HeapBasedNarrowOop), 852 narrow_oop_mode_to_string(HeapBasedNarrowOop),
845 Universe::narrow_oop_base()); 853 Universe::narrow_oop_base());
846 } 854 }
1155 MetaspaceCounters::initialize_performance_counters(); 1163 MetaspaceCounters::initialize_performance_counters();
1156 CompressedClassSpaceCounters::initialize_performance_counters(); 1164 CompressedClassSpaceCounters::initialize_performance_counters();
1157 1165
1158 MemoryService::add_metaspace_memory_pools(); 1166 MemoryService::add_metaspace_memory_pools();
1159 1167
1160 GC_locker::unlock(); // allow gc after bootstrapping
1161
1162 MemoryService::set_universe_heap(Universe::_collectedHeap); 1168 MemoryService::set_universe_heap(Universe::_collectedHeap);
1163 return true; 1169 return true;
1164 } 1170 }
1165 1171
1166 1172
1342 1348
1343 ResourceMark rm; 1349 ResourceMark rm;
1344 HandleMark hm; // Handles created during verification can be zapped 1350 HandleMark hm; // Handles created during verification can be zapped
1345 _verify_count++; 1351 _verify_count++;
1346 1352
1347 if (!silent) gclog_or_tty->print(prefix); 1353 if (!silent) gclog_or_tty->print("%s", prefix);
1348 if (!silent) gclog_or_tty->print("[Verifying "); 1354 if (!silent) gclog_or_tty->print("[Verifying ");
1349 if (!silent) gclog_or_tty->print("threads "); 1355 if (!silent) gclog_or_tty->print("threads ");
1350 Threads::verify(); 1356 Threads::verify();
1351 if (!silent) gclog_or_tty->print("heap "); 1357 if (!silent) gclog_or_tty->print("heap ");
1352 heap()->verify(silent, option); 1358 heap()->verify(silent, option);