1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
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 *
51 #include "memory/metaspaceShared.hpp"
52 #include "memory/oopFactory.hpp"
53 #include "memory/resourceArea.hpp"
54 #include "memory/universe.hpp"
55 #include "oops/access.inline.hpp"
56 #include "oops/instanceKlass.hpp"
57 #include "oops/objArrayOop.hpp"
58 #include "oops/oop.inline.hpp"
59 #include "oops/symbol.hpp"
60 #include "oops/typeArrayOop.inline.hpp"
61 #include "oops/verifyOopClosure.hpp"
62 #include "prims/jvm_misc.hpp"
63 #include "prims/jvmtiExport.hpp"
64 #include "prims/jvmtiThreadState.hpp"
65 #include "runtime/arguments.hpp"
66 #include "runtime/atomic.hpp"
67 #include "runtime/biasedLocking.hpp"
68 #include "runtime/fieldDescriptor.inline.hpp"
69 #include "runtime/flags/jvmFlagConstraintList.hpp"
70 #include "runtime/flags/jvmFlagRangeList.hpp"
71 #include "runtime/flags/jvmFlagWriteableList.hpp"
72 #include "runtime/deoptimization.hpp"
73 #include "runtime/frame.inline.hpp"
74 #include "runtime/handles.inline.hpp"
75 #include "runtime/handshake.hpp"
76 #include "runtime/init.hpp"
77 #include "runtime/interfaceSupport.inline.hpp"
78 #include "runtime/java.hpp"
79 #include "runtime/javaCalls.hpp"
80 #include "runtime/jniHandles.inline.hpp"
81 #include "runtime/jniPeriodicChecker.hpp"
82 #include "runtime/memprofiler.hpp"
83 #include "runtime/mutexLocker.hpp"
84 #include "runtime/objectMonitor.hpp"
85 #include "runtime/orderAccess.hpp"
86 #include "runtime/osThread.hpp"
87 #include "runtime/prefetch.inline.hpp"
88 #include "runtime/safepoint.hpp"
89 #include "runtime/safepointMechanism.inline.hpp"
90 #include "runtime/safepointVerifiers.hpp"
91 #include "runtime/serviceThread.hpp"
3800 // Parse arguments
3801 // Note: this internally calls os::init_container_support()
3802 jint parse_result = Arguments::parse(args);
3803 if (parse_result != JNI_OK) return parse_result;
3804
3805 os::init_before_ergo();
3806
3807 jint ergo_result = Arguments::apply_ergo();
3808 if (ergo_result != JNI_OK) return ergo_result;
3809
3810 // Final check of all ranges after ergonomics which may change values.
3811 if (!JVMFlagRangeList::check_ranges()) {
3812 return JNI_EINVAL;
3813 }
3814
3815 // Final check of all 'AfterErgo' constraints after ergonomics which may change values.
3816 bool constraint_result = JVMFlagConstraintList::check_constraints(JVMFlagConstraint::AfterErgo);
3817 if (!constraint_result) {
3818 return JNI_EINVAL;
3819 }
3820
3821 JVMFlagWriteableList::mark_startup();
3822
3823 if (PauseAtStartup) {
3824 os::pause();
3825 }
3826
3827 HOTSPOT_VM_INIT_BEGIN();
3828
3829 // Timing (must come after argument parsing)
3830 TraceTime timer("Create VM", TRACETIME_LOG(Info, startuptime));
3831
3832 // Initialize the os module after parsing the args
3833 jint os_init_2_result = os::init_2();
3834 if (os_init_2_result != JNI_OK) return os_init_2_result;
3835
3836 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT
3837 // Initialize assert poison page mechanism.
3838 if (ShowRegistersOnAssert) {
3839 initialize_assert_poison();
3840 }
3841 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
|
1 /*
2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
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 *
51 #include "memory/metaspaceShared.hpp"
52 #include "memory/oopFactory.hpp"
53 #include "memory/resourceArea.hpp"
54 #include "memory/universe.hpp"
55 #include "oops/access.inline.hpp"
56 #include "oops/instanceKlass.hpp"
57 #include "oops/objArrayOop.hpp"
58 #include "oops/oop.inline.hpp"
59 #include "oops/symbol.hpp"
60 #include "oops/typeArrayOop.inline.hpp"
61 #include "oops/verifyOopClosure.hpp"
62 #include "prims/jvm_misc.hpp"
63 #include "prims/jvmtiExport.hpp"
64 #include "prims/jvmtiThreadState.hpp"
65 #include "runtime/arguments.hpp"
66 #include "runtime/atomic.hpp"
67 #include "runtime/biasedLocking.hpp"
68 #include "runtime/fieldDescriptor.inline.hpp"
69 #include "runtime/flags/jvmFlagConstraintList.hpp"
70 #include "runtime/flags/jvmFlagRangeList.hpp"
71 #include "runtime/deoptimization.hpp"
72 #include "runtime/frame.inline.hpp"
73 #include "runtime/handles.inline.hpp"
74 #include "runtime/handshake.hpp"
75 #include "runtime/init.hpp"
76 #include "runtime/interfaceSupport.inline.hpp"
77 #include "runtime/java.hpp"
78 #include "runtime/javaCalls.hpp"
79 #include "runtime/jniHandles.inline.hpp"
80 #include "runtime/jniPeriodicChecker.hpp"
81 #include "runtime/memprofiler.hpp"
82 #include "runtime/mutexLocker.hpp"
83 #include "runtime/objectMonitor.hpp"
84 #include "runtime/orderAccess.hpp"
85 #include "runtime/osThread.hpp"
86 #include "runtime/prefetch.inline.hpp"
87 #include "runtime/safepoint.hpp"
88 #include "runtime/safepointMechanism.inline.hpp"
89 #include "runtime/safepointVerifiers.hpp"
90 #include "runtime/serviceThread.hpp"
3799 // Parse arguments
3800 // Note: this internally calls os::init_container_support()
3801 jint parse_result = Arguments::parse(args);
3802 if (parse_result != JNI_OK) return parse_result;
3803
3804 os::init_before_ergo();
3805
3806 jint ergo_result = Arguments::apply_ergo();
3807 if (ergo_result != JNI_OK) return ergo_result;
3808
3809 // Final check of all ranges after ergonomics which may change values.
3810 if (!JVMFlagRangeList::check_ranges()) {
3811 return JNI_EINVAL;
3812 }
3813
3814 // Final check of all 'AfterErgo' constraints after ergonomics which may change values.
3815 bool constraint_result = JVMFlagConstraintList::check_constraints(JVMFlagConstraint::AfterErgo);
3816 if (!constraint_result) {
3817 return JNI_EINVAL;
3818 }
3819
3820 if (PauseAtStartup) {
3821 os::pause();
3822 }
3823
3824 HOTSPOT_VM_INIT_BEGIN();
3825
3826 // Timing (must come after argument parsing)
3827 TraceTime timer("Create VM", TRACETIME_LOG(Info, startuptime));
3828
3829 // Initialize the os module after parsing the args
3830 jint os_init_2_result = os::init_2();
3831 if (os_init_2_result != JNI_OK) return os_init_2_result;
3832
3833 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT
3834 // Initialize assert poison page mechanism.
3835 if (ShowRegistersOnAssert) {
3836 initialize_assert_poison();
3837 }
3838 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
|