138 "size must not change: parameter_size=%d, value=%d", parameter_size(), value); |
138 "size must not change: parameter_size=%d, value=%d", parameter_size(), value); |
139 } |
139 } |
140 |
140 |
141 void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_code, |
141 void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_code, |
142 methodHandle method, |
142 methodHandle method, |
143 int vtable_index) { |
143 int vtable_index, |
|
144 bool sender_is_interface) { |
144 bool is_vtable_call = (vtable_index >= 0); // FIXME: split this method on this boolean |
145 bool is_vtable_call = (vtable_index >= 0); // FIXME: split this method on this boolean |
145 assert(method->interpreter_entry() != NULL, "should have been set at this point"); |
146 assert(method->interpreter_entry() != NULL, "should have been set at this point"); |
146 assert(!method->is_obsolete(), "attempt to write obsolete method to cpCache"); |
147 assert(!method->is_obsolete(), "attempt to write obsolete method to cpCache"); |
147 |
148 |
148 int byte_no = -1; |
149 int byte_no = -1; |
202 |
203 |
203 // Note: byte_no also appears in TemplateTable::resolve. |
204 // Note: byte_no also appears in TemplateTable::resolve. |
204 if (byte_no == 1) { |
205 if (byte_no == 1) { |
205 assert(invoke_code != Bytecodes::_invokevirtual && |
206 assert(invoke_code != Bytecodes::_invokevirtual && |
206 invoke_code != Bytecodes::_invokeinterface, ""); |
207 invoke_code != Bytecodes::_invokeinterface, ""); |
|
208 // Don't mark invokespecial to method as resolved if sender is an interface. The receiver |
|
209 // has to be checked that it is a subclass of the current class every time this bytecode |
|
210 // is executed. |
|
211 if (invoke_code != Bytecodes::_invokespecial || !sender_is_interface || |
|
212 method->name() == vmSymbols::object_initializer_name()) { |
207 set_bytecode_1(invoke_code); |
213 set_bytecode_1(invoke_code); |
|
214 } |
208 } else if (byte_no == 2) { |
215 } else if (byte_no == 2) { |
209 if (change_to_virtual) { |
216 if (change_to_virtual) { |
210 assert(invoke_code == Bytecodes::_invokeinterface, ""); |
217 assert(invoke_code == Bytecodes::_invokeinterface, ""); |
211 // NOTE: THIS IS A HACK - BE VERY CAREFUL!!! |
218 // NOTE: THIS IS A HACK - BE VERY CAREFUL!!! |
212 // |
219 // |
232 ShouldNotReachHere(); |
239 ShouldNotReachHere(); |
233 } |
240 } |
234 NOT_PRODUCT(verify(tty)); |
241 NOT_PRODUCT(verify(tty)); |
235 } |
242 } |
236 |
243 |
237 void ConstantPoolCacheEntry::set_direct_call(Bytecodes::Code invoke_code, methodHandle method) { |
244 void ConstantPoolCacheEntry::set_direct_call(Bytecodes::Code invoke_code, methodHandle method, |
|
245 bool sender_is_interface) { |
238 int index = Method::nonvirtual_vtable_index; |
246 int index = Method::nonvirtual_vtable_index; |
239 // index < 0; FIXME: inline and customize set_direct_or_vtable_call |
247 // index < 0; FIXME: inline and customize set_direct_or_vtable_call |
240 set_direct_or_vtable_call(invoke_code, method, index); |
248 set_direct_or_vtable_call(invoke_code, method, index, sender_is_interface); |
241 } |
249 } |
242 |
250 |
243 void ConstantPoolCacheEntry::set_vtable_call(Bytecodes::Code invoke_code, methodHandle method, int index) { |
251 void ConstantPoolCacheEntry::set_vtable_call(Bytecodes::Code invoke_code, methodHandle method, int index) { |
244 // either the method is a miranda or its holder should accept the given index |
252 // either the method is a miranda or its holder should accept the given index |
245 assert(method->method_holder()->is_interface() || method->method_holder()->verify_vtable_index(index), ""); |
253 assert(method->method_holder()->is_interface() || method->method_holder()->verify_vtable_index(index), ""); |
246 // index >= 0; FIXME: inline and customize set_direct_or_vtable_call |
254 // index >= 0; FIXME: inline and customize set_direct_or_vtable_call |
247 set_direct_or_vtable_call(invoke_code, method, index); |
255 set_direct_or_vtable_call(invoke_code, method, index, false); |
248 } |
256 } |
249 |
257 |
250 void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, const methodHandle& method, int index) { |
258 void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, const methodHandle& method, int index) { |
251 assert(method->method_holder()->verify_itable_index(index), ""); |
259 assert(method->method_holder()->verify_itable_index(index), ""); |
252 assert(invoke_code == Bytecodes::_invokeinterface, ""); |
260 assert(invoke_code == Bytecodes::_invokeinterface, ""); |