1 /*
2 * Copyright (c) 1997, 2017, 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 *
2074
2075 bool SystemDictionary::initialize_wk_klass(WKID id, int init_opt, TRAPS) {
2076 assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
2077 int info = wk_init_info[id - FIRST_WKID];
2078 int sid = (info >> CEIL_LG_OPTION_LIMIT);
2079 Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
2080 InstanceKlass** klassp = &_well_known_klasses[id];
2081
2082 bool must_load;
2083 #if INCLUDE_JVMCI
2084 if (EnableJVMCI) {
2085 // If JVMCI is enabled we require its classes to be found.
2086 must_load = (init_opt < SystemDictionary::Opt) || (init_opt == SystemDictionary::Jvmci);
2087 } else
2088 #endif
2089 {
2090 must_load = (init_opt < SystemDictionary::Opt);
2091 }
2092
2093 if (init_opt == SystemDictionary::ValhallaClasses) {
2094 if (EnableValhalla || EnableMVT) {
2095 must_load = true;
2096 } else {
2097 return false;
2098 }
2099 } else if (init_opt == SystemDictionary::MVTClasses) {
2100 if (EnableMVT) {
2101 must_load = true;
2102 } else {
2103 return false;
2104 }
2105 }
2106
2107 if ((*klassp) == NULL) {
2108 Klass* k;
2109 if (must_load) {
2110 k = resolve_or_fail(symbol, true, CHECK_0); // load required class
2111 } else {
2112 k = resolve_or_null(symbol, CHECK_0); // load optional klass
2113 }
2114 (*klassp) = (k == NULL) ? NULL : InstanceKlass::cast(k);
2115 }
2116 return ((*klassp) != NULL);
2117 }
2118
2119 void SystemDictionary::initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS) {
2120 assert((int)start_id <= (int)limit_id, "IDs are out of order!");
|
1 /*
2 * Copyright (c) 1997, 2018, 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 *
2074
2075 bool SystemDictionary::initialize_wk_klass(WKID id, int init_opt, TRAPS) {
2076 assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
2077 int info = wk_init_info[id - FIRST_WKID];
2078 int sid = (info >> CEIL_LG_OPTION_LIMIT);
2079 Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
2080 InstanceKlass** klassp = &_well_known_klasses[id];
2081
2082 bool must_load;
2083 #if INCLUDE_JVMCI
2084 if (EnableJVMCI) {
2085 // If JVMCI is enabled we require its classes to be found.
2086 must_load = (init_opt < SystemDictionary::Opt) || (init_opt == SystemDictionary::Jvmci);
2087 } else
2088 #endif
2089 {
2090 must_load = (init_opt < SystemDictionary::Opt);
2091 }
2092
2093 if (init_opt == SystemDictionary::ValhallaClasses) {
2094 if (EnableValhalla) {
2095 must_load = true;
2096 } else {
2097 return false;
2098 }
2099 }
2100
2101 if ((*klassp) == NULL) {
2102 Klass* k;
2103 if (must_load) {
2104 k = resolve_or_fail(symbol, true, CHECK_0); // load required class
2105 } else {
2106 k = resolve_or_null(symbol, CHECK_0); // load optional klass
2107 }
2108 (*klassp) = (k == NULL) ? NULL : InstanceKlass::cast(k);
2109 }
2110 return ((*klassp) != NULL);
2111 }
2112
2113 void SystemDictionary::initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS) {
2114 assert((int)start_id <= (int)limit_id, "IDs are out of order!");
|