6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classLoader.hpp"
27 #include "classfile/classLoaderData.hpp"
28 #include "classfile/javaClasses.hpp"
29 #include "classfile/stringTable.hpp"
30 #include "classfile/systemDictionary.hpp"
31 #include "classfile/vmSymbols.hpp"
32 #include "code/codeCache.hpp"
33 #include "code/dependencies.hpp"
34 #include "gc/shared/cardTableModRefBS.hpp"
35 #include "gc/shared/collectedHeap.inline.hpp"
36 #include "gc/shared/gcLocker.inline.hpp"
37 #include "gc/shared/genCollectedHeap.hpp"
38 #include "gc/shared/generation.hpp"
39 #include "gc/shared/gcTraceTime.inline.hpp"
40 #include "gc/shared/space.hpp"
41 #include "interpreter/interpreter.hpp"
42 #include "logging/log.hpp"
43 #include "memory/filemap.hpp"
44 #include "memory/metadataFactory.hpp"
45 #include "memory/metaspaceShared.hpp"
654
655 jint universe_init() {
656 assert(!Universe::_fully_initialized, "called after initialize_vtables");
657 guarantee(1 << LogHeapWordSize == sizeof(HeapWord),
658 "LogHeapWordSize is incorrect.");
659 guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
660 guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
661 "oop size is not not a multiple of HeapWord size");
662
663 TraceTime timer("Genesis", TRACETIME_LOG(Info, startuptime));
664
665 JavaClasses::compute_hard_coded_offsets();
666
667 jint status = Universe::initialize_heap();
668 if (status != JNI_OK) {
669 return status;
670 }
671
672 Metaspace::global_initialize();
673
674 // Checks 'AfterMemoryInit' constraints.
675 if (!CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::AfterMemoryInit)) {
676 return JNI_EINVAL;
677 }
678
679 // Create memory for metadata. Must be after initializing heap for
680 // DumpSharedSpaces.
681 ClassLoaderData::init_null_class_loader_data();
682
683 // We have a heap so create the Method* caches before
684 // Metaspace::initialize_shared_spaces() tries to populate them.
685 Universe::_finalizer_register_cache = new LatestMethodCache();
686 Universe::_loader_addClass_cache = new LatestMethodCache();
687 Universe::_pd_implies_cache = new LatestMethodCache();
688 Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
689 Universe::_do_stack_walk_cache = new LatestMethodCache();
690
691 if (UseSharedSpaces) {
692 // Read the data structures supporting the shared spaces (shared
693 // system dictionary, symbol table, etc.). After that, access to
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classLoader.hpp"
28 #include "classfile/classLoaderData.hpp"
29 #include "classfile/javaClasses.hpp"
30 #include "classfile/stringTable.hpp"
31 #include "classfile/systemDictionary.hpp"
32 #include "classfile/vmSymbols.hpp"
33 #include "code/codeCache.hpp"
34 #include "code/dependencies.hpp"
35 #include "gc/shared/cardTableModRefBS.hpp"
36 #include "gc/shared/collectedHeap.inline.hpp"
37 #include "gc/shared/gcLocker.inline.hpp"
38 #include "gc/shared/genCollectedHeap.hpp"
39 #include "gc/shared/generation.hpp"
40 #include "gc/shared/gcTraceTime.inline.hpp"
41 #include "gc/shared/space.hpp"
42 #include "interpreter/interpreter.hpp"
43 #include "logging/log.hpp"
44 #include "memory/filemap.hpp"
45 #include "memory/metadataFactory.hpp"
46 #include "memory/metaspaceShared.hpp"
655
656 jint universe_init() {
657 assert(!Universe::_fully_initialized, "called after initialize_vtables");
658 guarantee(1 << LogHeapWordSize == sizeof(HeapWord),
659 "LogHeapWordSize is incorrect.");
660 guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
661 guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
662 "oop size is not not a multiple of HeapWord size");
663
664 TraceTime timer("Genesis", TRACETIME_LOG(Info, startuptime));
665
666 JavaClasses::compute_hard_coded_offsets();
667
668 jint status = Universe::initialize_heap();
669 if (status != JNI_OK) {
670 return status;
671 }
672
673 Metaspace::global_initialize();
674
675 AOTLoader::universe_init();
676
677 // Checks 'AfterMemoryInit' constraints.
678 if (!CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::AfterMemoryInit)) {
679 return JNI_EINVAL;
680 }
681
682 // Create memory for metadata. Must be after initializing heap for
683 // DumpSharedSpaces.
684 ClassLoaderData::init_null_class_loader_data();
685
686 // We have a heap so create the Method* caches before
687 // Metaspace::initialize_shared_spaces() tries to populate them.
688 Universe::_finalizer_register_cache = new LatestMethodCache();
689 Universe::_loader_addClass_cache = new LatestMethodCache();
690 Universe::_pd_implies_cache = new LatestMethodCache();
691 Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
692 Universe::_do_stack_walk_cache = new LatestMethodCache();
693
694 if (UseSharedSpaces) {
695 // Read the data structures supporting the shared spaces (shared
696 // system dictionary, symbol table, etc.). After that, access to
|