1 /*
2 * Copyright (c) 1997, 2012, 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 *
118
119 // return true if class_name contains no '.' (internal format is '/')
120 bool SystemDictionary::is_internal_format(Symbol* class_name) {
121 if (class_name != NULL) {
122 ResourceMark rm;
123 char* name = class_name->as_C_string();
124 return strchr(name, '.') == NULL;
125 } else {
126 return true;
127 }
128 }
129
130 #endif
131
132 // ----------------------------------------------------------------------------
133 // Parallel class loading check
134
135 bool SystemDictionary::is_parallelCapable(Handle class_loader) {
136 if (UnsyncloadClass || class_loader.is_null()) return true;
137 if (AlwaysLockClassLoader) return false;
138 return java_lang_ClassLoader::parallelCapable(class_loader());
139 }
140 // ----------------------------------------------------------------------------
141 // ParallelDefineClass flag does not apply to bootclass loader
142 bool SystemDictionary::is_parallelDefine(Handle class_loader) {
143 if (class_loader.is_null()) return false;
144 if (AllowParallelDefineClass && java_lang_ClassLoader::parallelCapable(class_loader())) {
145 return true;
146 }
147 return false;
148 }
149 // ----------------------------------------------------------------------------
150 // Resolving of classes
151
152 // Forwards to resolve_or_null
153
154 Klass* SystemDictionary::resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS) {
155 Klass* klass = resolve_or_null(class_name, class_loader, protection_domain, THREAD);
156 if (HAS_PENDING_EXCEPTION || klass == NULL) {
157 KlassHandle k_h(THREAD, klass);
158 // can return a null klass
159 klass = handle_resolution_exception(class_name, class_loader, protection_domain, throw_error, k_h, THREAD);
160 }
161 return klass;
162 }
163
164 Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS) {
|
1 /*
2 * Copyright (c) 1997, 2013, 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 *
118
119 // return true if class_name contains no '.' (internal format is '/')
120 bool SystemDictionary::is_internal_format(Symbol* class_name) {
121 if (class_name != NULL) {
122 ResourceMark rm;
123 char* name = class_name->as_C_string();
124 return strchr(name, '.') == NULL;
125 } else {
126 return true;
127 }
128 }
129
130 #endif
131
132 // ----------------------------------------------------------------------------
133 // Parallel class loading check
134
135 bool SystemDictionary::is_parallelCapable(Handle class_loader) {
136 if (UnsyncloadClass || class_loader.is_null()) return true;
137 if (AlwaysLockClassLoader) return false;
138 // fullyConcurrent subsumes the parallelCapable test
139 return java_lang_ClassLoader::fullyConcurrent(class_loader()) ||
140 java_lang_ClassLoader::parallelCapable(class_loader());
141 }
142 // ----------------------------------------------------------------------------
143 // ParallelDefineClass flag does not apply to bootclass loader
144 bool SystemDictionary::is_parallelDefine(Handle class_loader) {
145 if (class_loader.is_null()) return false;
146 if (java_lang_ClassLoader::fullyConcurrent(class_loader()) ||
147 AllowParallelDefineClass && java_lang_ClassLoader::parallelCapable(class_loader())) {
148 if (TraceClassLoading)
149 tty->print_cr("Parallel define permitted for loader: " PTR_FORMAT, class_loader());
150 return true;
151 }
152 return false;
153 }
154 // ----------------------------------------------------------------------------
155 // Resolving of classes
156
157 // Forwards to resolve_or_null
158
159 Klass* SystemDictionary::resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS) {
160 Klass* klass = resolve_or_null(class_name, class_loader, protection_domain, THREAD);
161 if (HAS_PENDING_EXCEPTION || klass == NULL) {
162 KlassHandle k_h(THREAD, klass);
163 // can return a null klass
164 klass = handle_resolution_exception(class_name, class_loader, protection_domain, throw_error, k_h, THREAD);
165 }
166 return klass;
167 }
168
169 Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS) {
|