114 int itable_index() const {
115 assert(call_kind() == itable_call, "");
116 // The returned value is always >= 0, a valid itable index.
117 return _call_index;
118 }
119
120 // debugging
121 #ifdef ASSERT
122 bool has_vtable_index() const { return _call_index >= 0 && _call_kind != CallInfo::itable_call; }
123 bool is_statically_bound() const { return _call_index == Method::nonvirtual_vtable_index; }
124 #endif //ASSERT
125 void verify() PRODUCT_RETURN;
126 void print() PRODUCT_RETURN;
127 };
128
129
130 // Condensed information from constant pool to use to resolve the method or field.
131 // resolved_klass = specified class (i.e., static receiver class)
132 // current_klass = sending method holder (i.e., class containing the method
133 // containing the call being resolved)
134 class LinkInfo : public StackObj {
135 Symbol* _name; // extracted from JVM_CONSTANT_NameAndType
136 Symbol* _signature;
137 KlassHandle _resolved_klass; // class that the constant pool entry points to
138 KlassHandle _current_klass; // class that owns the constant pool
139 bool _check_access;
140 public:
141 LinkInfo(const constantPoolHandle& pool, int index, TRAPS);
142 // Condensed information from other call sites within the vm.
143 LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature,
144 KlassHandle current_klass, bool check_access = true) :
145 _resolved_klass(resolved_klass),
146 _name(name), _signature(signature), _current_klass(current_klass),
147 _check_access(check_access) {}
148
149 // accessors
150 Symbol* name() const { return _name; }
151 Symbol* signature() const { return _signature; }
152 KlassHandle resolved_klass() const { return _resolved_klass; }
153 KlassHandle current_klass() const { return _current_klass; }
154 bool check_access() const { return _check_access; }
155 char* method_string() const;
156
157 void print() PRODUCT_RETURN;
158 };
159
160 // Link information for getfield/putfield & getstatic/putstatic bytecodes
161 // is represented using a fieldDescriptor.
162
163 // The LinkResolver is used to resolve constant-pool references at run-time.
164 // It does all necessary link-time checks & throws exceptions if necessary.
165
166 class LinkResolver: AllStatic {
167 friend class klassVtable;
168 friend class klassItable;
169
170 private:
171
172 static methodHandle lookup_method_in_klasses(const LinkInfo& link_info,
173 bool checkpolymorphism,
234 static void resolve_invokevirtual (CallInfo& result, Handle recv,
235 const constantPoolHandle& pool, int index, TRAPS);
236 static void resolve_invokeinterface(CallInfo& result, Handle recv,
237 const constantPoolHandle& pool, int index, TRAPS);
238 static void resolve_invokedynamic (CallInfo& result,
239 const constantPoolHandle& pool, int index, TRAPS);
240 static void resolve_invokehandle (CallInfo& result,
241 const constantPoolHandle& pool, int index, TRAPS);
242 public:
243 // constant pool resolving
244 static void check_klass_accessability(KlassHandle ref_klass, KlassHandle sel_klass, TRAPS);
245
246 // static resolving calls (will not run any Java code);
247 // used only from Bytecode_invoke::static_target
248 static methodHandle resolve_method_statically(Bytecodes::Code code,
249 const constantPoolHandle& pool,
250 int index, TRAPS);
251
252 static void resolve_field_access(fieldDescriptor& result,
253 const constantPoolHandle& pool,
254 int index, Bytecodes::Code byte, TRAPS);
255 static void resolve_field(fieldDescriptor& result, const LinkInfo& link_info,
256 Bytecodes::Code access_kind,
257 bool initialize_class, TRAPS);
258
259 static void resolve_static_call (CallInfo& result,
260 const LinkInfo& link_info,
261 bool initialize_klass, TRAPS);
262 static void resolve_special_call (CallInfo& result,
263 const LinkInfo& link_info,
264 TRAPS);
265 static void resolve_virtual_call (CallInfo& result, Handle recv, KlassHandle recv_klass,
266 const LinkInfo& link_info,
267 bool check_null_and_abstract, TRAPS);
268 static void resolve_interface_call(CallInfo& result, Handle recv, KlassHandle recv_klass,
269 const LinkInfo& link_info,
270 bool check_null_and_abstract, TRAPS);
271 static void resolve_handle_call (CallInfo& result,
272 const LinkInfo& link_info, TRAPS);
273 static void resolve_dynamic_call (CallInfo& result, Handle bootstrap_specifier,
274 Symbol* method_name, Symbol* method_signature,
|
114 int itable_index() const {
115 assert(call_kind() == itable_call, "");
116 // The returned value is always >= 0, a valid itable index.
117 return _call_index;
118 }
119
120 // debugging
121 #ifdef ASSERT
122 bool has_vtable_index() const { return _call_index >= 0 && _call_kind != CallInfo::itable_call; }
123 bool is_statically_bound() const { return _call_index == Method::nonvirtual_vtable_index; }
124 #endif //ASSERT
125 void verify() PRODUCT_RETURN;
126 void print() PRODUCT_RETURN;
127 };
128
129
130 // Condensed information from constant pool to use to resolve the method or field.
131 // resolved_klass = specified class (i.e., static receiver class)
132 // current_klass = sending method holder (i.e., class containing the method
133 // containing the call being resolved)
134 // current_method = sending method (relevant for field resolution)
135 class LinkInfo : public StackObj {
136 Symbol* _name; // extracted from JVM_CONSTANT_NameAndType
137 Symbol* _signature;
138 KlassHandle _resolved_klass; // class that the constant pool entry points to
139 KlassHandle _current_klass; // class that owns the constant pool
140 methodHandle _current_method; // sending method
141 bool _check_access;
142 public:
143 LinkInfo(const constantPoolHandle& pool, int index, methodHandle current_method, TRAPS);
144 // Condensed information from other call sites within the vm.
145 LinkInfo(KlassHandle resolved_klass,
146 Symbol* name, Symbol* signature, // field or method signature
147 KlassHandle current_klass, methodHandle current_method,
148 bool check_access = true) :
149 _resolved_klass(resolved_klass),
150 _name(name), _signature(signature),
151 _current_klass(current_klass), _current_method(current_method),
152 _check_access(check_access) {}
153
154 // accessors
155 Symbol* name() const { return _name; }
156 Symbol* signature() const { return _signature; }
157 KlassHandle resolved_klass() const { return _resolved_klass; }
158 KlassHandle current_klass() const { return _current_klass; }
159 methodHandle current_method() const { return _current_method; }
160 bool check_access() const { return _check_access; }
161 char* method_string() const;
162
163 void print() PRODUCT_RETURN;
164 };
165
166 // Link information for getfield/putfield & getstatic/putstatic bytecodes
167 // is represented using a fieldDescriptor.
168
169 // The LinkResolver is used to resolve constant-pool references at run-time.
170 // It does all necessary link-time checks & throws exceptions if necessary.
171
172 class LinkResolver: AllStatic {
173 friend class klassVtable;
174 friend class klassItable;
175
176 private:
177
178 static methodHandle lookup_method_in_klasses(const LinkInfo& link_info,
179 bool checkpolymorphism,
240 static void resolve_invokevirtual (CallInfo& result, Handle recv,
241 const constantPoolHandle& pool, int index, TRAPS);
242 static void resolve_invokeinterface(CallInfo& result, Handle recv,
243 const constantPoolHandle& pool, int index, TRAPS);
244 static void resolve_invokedynamic (CallInfo& result,
245 const constantPoolHandle& pool, int index, TRAPS);
246 static void resolve_invokehandle (CallInfo& result,
247 const constantPoolHandle& pool, int index, TRAPS);
248 public:
249 // constant pool resolving
250 static void check_klass_accessability(KlassHandle ref_klass, KlassHandle sel_klass, TRAPS);
251
252 // static resolving calls (will not run any Java code);
253 // used only from Bytecode_invoke::static_target
254 static methodHandle resolve_method_statically(Bytecodes::Code code,
255 const constantPoolHandle& pool,
256 int index, TRAPS);
257
258 static void resolve_field_access(fieldDescriptor& result,
259 const constantPoolHandle& pool,
260 int index,
261 const methodHandle& method,
262 Bytecodes::Code byte, TRAPS);
263 static void resolve_field(fieldDescriptor& result, const LinkInfo& link_info,
264 Bytecodes::Code access_kind,
265 bool initialize_class, TRAPS);
266
267 static void resolve_static_call (CallInfo& result,
268 const LinkInfo& link_info,
269 bool initialize_klass, TRAPS);
270 static void resolve_special_call (CallInfo& result,
271 const LinkInfo& link_info,
272 TRAPS);
273 static void resolve_virtual_call (CallInfo& result, Handle recv, KlassHandle recv_klass,
274 const LinkInfo& link_info,
275 bool check_null_and_abstract, TRAPS);
276 static void resolve_interface_call(CallInfo& result, Handle recv, KlassHandle recv_klass,
277 const LinkInfo& link_info,
278 bool check_null_and_abstract, TRAPS);
279 static void resolve_handle_call (CallInfo& result,
280 const LinkInfo& link_info, TRAPS);
281 static void resolve_dynamic_call (CallInfo& result, Handle bootstrap_specifier,
282 Symbol* method_name, Symbol* method_signature,
|