1 /*
2 * Copyright (c) 1997, 2009, 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 *
23 */
24
25 // All the necessary definitions for run-time link resolution.
26
27 // LinkInfo & its subclasses provide all the information gathered
28 // for a particular link after resolving it. A link is any reference
29 // made from within the bytecodes of a method to an object outside of
30 // that method. If the info is invalid, the link has not been resolved
31 // successfully.
32
33 class LinkInfo VALUE_OBJ_CLASS_SPEC {
34 };
35
36
37 // Link information for getfield/putfield & getstatic/putstatic bytecodes.
38
39 class FieldAccessInfo: public LinkInfo {
40 protected:
41 KlassHandle _klass;
42 symbolHandle _name;
43 AccessFlags _access_flags;
44 int _field_index; // original index in the klass
157 static methodHandle resolve_interface_call_or_null(KlassHandle receiver_klass, KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass);
158 static methodHandle resolve_static_call_or_null (KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass);
159 static methodHandle resolve_special_call_or_null (KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass);
160
161 // same as above for compile-time resolution; returns vtable_index if current_klass if linked
162 static int resolve_virtual_vtable_index (KlassHandle receiver_klass, KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass);
163
164 // static resolving for compiler (does not throw exceptions, returns null handle if unsuccessful)
165 static methodHandle linktime_resolve_virtual_method_or_null (KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass, bool check_access);
166 static methodHandle linktime_resolve_interface_method_or_null(KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass, bool check_access);
167
168 // runtime resolving from constant pool
169 static void resolve_invokestatic (CallInfo& result, constantPoolHandle pool, int index, TRAPS);
170 static void resolve_invokespecial (CallInfo& result, constantPoolHandle pool, int index, TRAPS);
171 static void resolve_invokevirtual (CallInfo& result, Handle recv, constantPoolHandle pool, int index, TRAPS);
172 static void resolve_invokeinterface(CallInfo& result, Handle recv, constantPoolHandle pool, int index, TRAPS);
173 static void resolve_invokedynamic (CallInfo& result, constantPoolHandle pool, int index, TRAPS);
174
175 static void resolve_invoke (CallInfo& result, Handle recv, constantPoolHandle pool, int index, Bytecodes::Code byte, TRAPS);
176 };
|
1 /*
2 * Copyright (c) 1997, 2010, 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 *
23 */
24
25 #ifndef SHARE_VM_INTERPRETER_LINKRESOLVER_HPP
26 #define SHARE_VM_INTERPRETER_LINKRESOLVER_HPP
27
28 #include "oops/methodOop.hpp"
29 #include "utilities/top.hpp"
30
31 // All the necessary definitions for run-time link resolution.
32
33 // LinkInfo & its subclasses provide all the information gathered
34 // for a particular link after resolving it. A link is any reference
35 // made from within the bytecodes of a method to an object outside of
36 // that method. If the info is invalid, the link has not been resolved
37 // successfully.
38
39 class LinkInfo VALUE_OBJ_CLASS_SPEC {
40 };
41
42
43 // Link information for getfield/putfield & getstatic/putstatic bytecodes.
44
45 class FieldAccessInfo: public LinkInfo {
46 protected:
47 KlassHandle _klass;
48 symbolHandle _name;
49 AccessFlags _access_flags;
50 int _field_index; // original index in the klass
163 static methodHandle resolve_interface_call_or_null(KlassHandle receiver_klass, KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass);
164 static methodHandle resolve_static_call_or_null (KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass);
165 static methodHandle resolve_special_call_or_null (KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass);
166
167 // same as above for compile-time resolution; returns vtable_index if current_klass if linked
168 static int resolve_virtual_vtable_index (KlassHandle receiver_klass, KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass);
169
170 // static resolving for compiler (does not throw exceptions, returns null handle if unsuccessful)
171 static methodHandle linktime_resolve_virtual_method_or_null (KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass, bool check_access);
172 static methodHandle linktime_resolve_interface_method_or_null(KlassHandle resolved_klass, symbolHandle method_name, symbolHandle method_signature, KlassHandle current_klass, bool check_access);
173
174 // runtime resolving from constant pool
175 static void resolve_invokestatic (CallInfo& result, constantPoolHandle pool, int index, TRAPS);
176 static void resolve_invokespecial (CallInfo& result, constantPoolHandle pool, int index, TRAPS);
177 static void resolve_invokevirtual (CallInfo& result, Handle recv, constantPoolHandle pool, int index, TRAPS);
178 static void resolve_invokeinterface(CallInfo& result, Handle recv, constantPoolHandle pool, int index, TRAPS);
179 static void resolve_invokedynamic (CallInfo& result, constantPoolHandle pool, int index, TRAPS);
180
181 static void resolve_invoke (CallInfo& result, Handle recv, constantPoolHandle pool, int index, Bytecodes::Code byte, TRAPS);
182 };
183
184 #endif // SHARE_VM_INTERPRETER_LINKRESOLVER_HPP
|