1 /* |
1 /* |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
135 Symbol* _name; // extracted from JVM_CONSTANT_NameAndType |
135 Symbol* _name; // extracted from JVM_CONSTANT_NameAndType |
136 Symbol* _signature; |
136 Symbol* _signature; |
137 KlassHandle _resolved_klass; // class that the constant pool entry points to |
137 KlassHandle _resolved_klass; // class that the constant pool entry points to |
138 KlassHandle _current_klass; // class that owns the constant pool |
138 KlassHandle _current_klass; // class that owns the constant pool |
139 bool _check_access; |
139 bool _check_access; |
|
140 constantTag _tag; |
140 public: |
141 public: |
|
142 enum AccessCheck { |
|
143 needs_access_check, |
|
144 skip_access_check |
|
145 }; |
|
146 |
141 LinkInfo(const constantPoolHandle& pool, int index, TRAPS); |
147 LinkInfo(const constantPoolHandle& pool, int index, TRAPS); |
|
148 |
142 // Condensed information from other call sites within the vm. |
149 // Condensed information from other call sites within the vm. |
143 LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, |
150 LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, KlassHandle current_klass, |
144 KlassHandle current_klass, bool check_access = true) : |
151 AccessCheck check_access = needs_access_check, |
|
152 constantTag tag = JVM_CONSTANT_Invalid) : |
145 _resolved_klass(resolved_klass), |
153 _resolved_klass(resolved_klass), |
146 _name(name), _signature(signature), _current_klass(current_klass), |
154 _name(name), _signature(signature), _current_klass(current_klass), |
147 _check_access(check_access) {} |
155 _check_access(check_access == needs_access_check), _tag(tag) {} |
|
156 |
|
157 // Case where we just find the method and don't check access against the current class |
|
158 LinkInfo(KlassHandle resolved_klass, Symbol*name, Symbol* signature) : |
|
159 _resolved_klass(resolved_klass), |
|
160 _name(name), _signature(signature), _current_klass(NULL), |
|
161 _check_access(false), _tag(JVM_CONSTANT_Invalid) {} |
148 |
162 |
149 // accessors |
163 // accessors |
150 Symbol* name() const { return _name; } |
164 Symbol* name() const { return _name; } |
151 Symbol* signature() const { return _signature; } |
165 Symbol* signature() const { return _signature; } |
152 KlassHandle resolved_klass() const { return _resolved_klass; } |
166 KlassHandle resolved_klass() const { return _resolved_klass; } |
153 KlassHandle current_klass() const { return _current_klass; } |
167 KlassHandle current_klass() const { return _current_klass; } |
|
168 constantTag tag() const { return _tag; } |
154 bool check_access() const { return _check_access; } |
169 bool check_access() const { return _check_access; } |
155 char* method_string() const; |
170 char* method_string() const; |
156 |
171 |
157 void print() PRODUCT_RETURN; |
172 void print() PRODUCT_RETURN; |
158 }; |
173 }; |
190 static void check_field_loader_constraints(Symbol* field, Symbol* sig, |
205 static void check_field_loader_constraints(Symbol* field, Symbol* sig, |
191 KlassHandle current_klass, |
206 KlassHandle current_klass, |
192 KlassHandle sel_klass, TRAPS); |
207 KlassHandle sel_klass, TRAPS); |
193 |
208 |
194 static methodHandle resolve_interface_method(const LinkInfo& link_info, Bytecodes::Code code, TRAPS); |
209 static methodHandle resolve_interface_method(const LinkInfo& link_info, Bytecodes::Code code, TRAPS); |
195 static methodHandle resolve_method (const LinkInfo& link_info, bool require_methodref, TRAPS); |
210 static methodHandle resolve_method (const LinkInfo& link_info, Bytecodes::Code code, TRAPS); |
196 |
211 |
197 static methodHandle linktime_resolve_static_method (const LinkInfo& link_info, TRAPS); |
212 static methodHandle linktime_resolve_static_method (const LinkInfo& link_info, TRAPS); |
198 static methodHandle linktime_resolve_special_method (const LinkInfo& link_info, TRAPS); |
213 static methodHandle linktime_resolve_special_method (const LinkInfo& link_info, TRAPS); |
199 static methodHandle linktime_resolve_virtual_method (const LinkInfo& link_info, TRAPS); |
214 static methodHandle linktime_resolve_virtual_method (const LinkInfo& link_info, TRAPS); |
200 static methodHandle linktime_resolve_interface_method (const LinkInfo& link_info, TRAPS); |
215 static methodHandle linktime_resolve_interface_method (const LinkInfo& link_info, TRAPS); |