1 /*
2 * Copyright (c) 1999, 2016, 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 *
62 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
63 }
64
65 // ------------------------------------------------------------------
66 // Note: the logic of this method should mirror the logic of
67 // constantPoolOopDesc::verify_constant_pool_resolve.
68 bool JVMCIEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
69 if (accessing_klass->is_objArray_klass()) {
70 accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
71 }
72 if (!accessing_klass->is_instance_klass()) {
73 return true;
74 }
75
76 if (resolved_klass->is_objArray_klass()) {
77 // Find the element klass, if this is an array.
78 resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
79 }
80 if (resolved_klass->is_instance_klass()) {
81 Reflection::VerifyClassAccessResults result =
82 Reflection::verify_class_access(accessing_klass(), resolved_klass(), true);
83 return result == Reflection::ACCESS_OK;
84 }
85 return true;
86 }
87
88 // ------------------------------------------------------------------
89 KlassHandle JVMCIEnv::get_klass_by_name_impl(KlassHandle& accessing_klass,
90 const constantPoolHandle& cpool,
91 Symbol* sym,
92 bool require_local) {
93 JVMCI_EXCEPTION_CONTEXT;
94
95 // Now we need to check the SystemDictionary
96 if (sym->byte_at(0) == 'L' &&
97 sym->byte_at(sym->utf8_length()-1) == ';') {
98 // This is a name from a signature. Strip off the trimmings.
99 // Call recursive to keep scope of strippedsym.
100 TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
101 sym->utf8_length()-2,
102 CHECK_(KlassHandle()));
|
1 /*
2 * Copyright (c) 1999, 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 *
62 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
63 }
64
65 // ------------------------------------------------------------------
66 // Note: the logic of this method should mirror the logic of
67 // constantPoolOopDesc::verify_constant_pool_resolve.
68 bool JVMCIEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
69 if (accessing_klass->is_objArray_klass()) {
70 accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
71 }
72 if (!accessing_klass->is_instance_klass()) {
73 return true;
74 }
75
76 if (resolved_klass->is_objArray_klass()) {
77 // Find the element klass, if this is an array.
78 resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
79 }
80 if (resolved_klass->is_instance_klass()) {
81 Reflection::VerifyClassAccessResults result =
82 Reflection::verify_class_access(accessing_klass(), InstanceKlass::cast(resolved_klass()), true);
83 return result == Reflection::ACCESS_OK;
84 }
85 return true;
86 }
87
88 // ------------------------------------------------------------------
89 KlassHandle JVMCIEnv::get_klass_by_name_impl(KlassHandle& accessing_klass,
90 const constantPoolHandle& cpool,
91 Symbol* sym,
92 bool require_local) {
93 JVMCI_EXCEPTION_CONTEXT;
94
95 // Now we need to check the SystemDictionary
96 if (sym->byte_at(0) == 'L' &&
97 sym->byte_at(sym->utf8_length()-1) == ';') {
98 // This is a name from a signature. Strip off the trimmings.
99 // Call recursive to keep scope of strippedsym.
100 TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
101 sym->utf8_length()-2,
102 CHECK_(KlassHandle()));
|