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 *
212 }
213 return (Klass*)klass_h();
214 }
215
216
217 Klass* SystemDictionary::resolve_or_fail(Symbol* class_name,
218 bool throw_error, TRAPS)
219 {
220 return resolve_or_fail(class_name, Handle(), Handle(), throw_error, THREAD);
221 }
222
223
224 // Forwards to resolve_instance_class_or_null
225
226 Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS) {
227 assert(!THREAD->is_Compiler_thread(),
228 err_msg("can not load classes with compiler thread: class=%s, classloader=%s",
229 class_name->as_C_string(),
230 class_loader.is_null() ? "null" : class_loader->klass()->name()->as_C_string()));
231 if (FieldType::is_array(class_name)) {
232 return resolve_array_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
233 } else if (FieldType::is_obj(class_name)) {
234 ResourceMark rm(THREAD);
235 // Ignore wrapping L and ;.
236 TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1,
237 class_name->utf8_length() - 2, CHECK_NULL);
238 return resolve_instance_class_or_null(name, class_loader, protection_domain, CHECK_NULL);
239 } else {
240 return resolve_instance_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
241 }
242 }
243
244 Klass* SystemDictionary::resolve_or_null(Symbol* class_name, TRAPS) {
245 return resolve_or_null(class_name, Handle(), Handle(), THREAD);
246 }
247
248 // Forwards to resolve_instance_class_or_null
249
250 Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
251 Handle class_loader,
252 Handle protection_domain,
253 TRAPS) {
254 assert(FieldType::is_array(class_name), "must be array");
255 Klass* k = NULL;
256 FieldArrayInfo fd;
257 // dimension and object_key in FieldArrayInfo are assigned as a side-effect
258 // of this call
259 BasicType t = FieldType::get_array_info(class_name, fd, CHECK_NULL);
260 if (t == T_OBJECT) {
|
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 *
212 }
213 return (Klass*)klass_h();
214 }
215
216
217 Klass* SystemDictionary::resolve_or_fail(Symbol* class_name,
218 bool throw_error, TRAPS)
219 {
220 return resolve_or_fail(class_name, Handle(), Handle(), throw_error, THREAD);
221 }
222
223
224 // Forwards to resolve_instance_class_or_null
225
226 Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS) {
227 assert(!THREAD->is_Compiler_thread(),
228 err_msg("can not load classes with compiler thread: class=%s, classloader=%s",
229 class_name->as_C_string(),
230 class_loader.is_null() ? "null" : class_loader->klass()->name()->as_C_string()));
231 if (FieldType::is_array(class_name)) {
232 return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD);
233 } else if (FieldType::is_obj(class_name)) {
234 ResourceMark rm(THREAD);
235 // Ignore wrapping L and ;.
236 TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1,
237 class_name->utf8_length() - 2, CHECK_NULL);
238 return resolve_instance_class_or_null(name, class_loader, protection_domain, THREAD);
239 } else {
240 return resolve_instance_class_or_null(class_name, class_loader, protection_domain, THREAD);
241 }
242 }
243
244 Klass* SystemDictionary::resolve_or_null(Symbol* class_name, TRAPS) {
245 return resolve_or_null(class_name, Handle(), Handle(), THREAD);
246 }
247
248 // Forwards to resolve_instance_class_or_null
249
250 Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
251 Handle class_loader,
252 Handle protection_domain,
253 TRAPS) {
254 assert(FieldType::is_array(class_name), "must be array");
255 Klass* k = NULL;
256 FieldArrayInfo fd;
257 // dimension and object_key in FieldArrayInfo are assigned as a side-effect
258 // of this call
259 BasicType t = FieldType::get_array_info(class_name, fd, CHECK_NULL);
260 if (t == T_OBJECT) {
|