src/share/vm/oops/cpCache.cpp

changeset 8739
0b85ccd62409
parent 7795
157895117ad5
child 8856
ac27a9c85bea
child 8997
f8a45a60bc6b
equal deleted inserted replaced
8738:5ee58c7d3938 8739:0b85ccd62409
1 /* 1 /*
2 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 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.
142 err_msg("size must not change: parameter_size=%d, value=%d", parameter_size(), value)); 142 err_msg("size must not change: parameter_size=%d, value=%d", parameter_size(), value));
143 } 143 }
144 144
145 void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_code, 145 void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_code,
146 methodHandle method, 146 methodHandle method,
147 int vtable_index) { 147 int vtable_index,
148 bool sender_is_interface) {
148 bool is_vtable_call = (vtable_index >= 0); // FIXME: split this method on this boolean 149 bool is_vtable_call = (vtable_index >= 0); // FIXME: split this method on this boolean
149 assert(method->interpreter_entry() != NULL, "should have been set at this point"); 150 assert(method->interpreter_entry() != NULL, "should have been set at this point");
150 assert(!method->is_obsolete(), "attempt to write obsolete method to cpCache"); 151 assert(!method->is_obsolete(), "attempt to write obsolete method to cpCache");
151 152
152 int byte_no = -1; 153 int byte_no = -1;
206 207
207 // Note: byte_no also appears in TemplateTable::resolve. 208 // Note: byte_no also appears in TemplateTable::resolve.
208 if (byte_no == 1) { 209 if (byte_no == 1) {
209 assert(invoke_code != Bytecodes::_invokevirtual && 210 assert(invoke_code != Bytecodes::_invokevirtual &&
210 invoke_code != Bytecodes::_invokeinterface, ""); 211 invoke_code != Bytecodes::_invokeinterface, "");
212 // Don't mark invokespecial to method as resolved if sender is an interface. The receiver
213 // has to be checked that it is a subclass of the current class every time this bytecode
214 // is executed.
215 if (invoke_code != Bytecodes::_invokespecial || !sender_is_interface ||
216 method->name() == vmSymbols::object_initializer_name()) {
211 set_bytecode_1(invoke_code); 217 set_bytecode_1(invoke_code);
218 }
212 } else if (byte_no == 2) { 219 } else if (byte_no == 2) {
213 if (change_to_virtual) { 220 if (change_to_virtual) {
214 assert(invoke_code == Bytecodes::_invokeinterface, ""); 221 assert(invoke_code == Bytecodes::_invokeinterface, "");
215 // NOTE: THIS IS A HACK - BE VERY CAREFUL!!! 222 // NOTE: THIS IS A HACK - BE VERY CAREFUL!!!
216 // 223 //
236 ShouldNotReachHere(); 243 ShouldNotReachHere();
237 } 244 }
238 NOT_PRODUCT(verify(tty)); 245 NOT_PRODUCT(verify(tty));
239 } 246 }
240 247
241 void ConstantPoolCacheEntry::set_direct_call(Bytecodes::Code invoke_code, methodHandle method) { 248 void ConstantPoolCacheEntry::set_direct_call(Bytecodes::Code invoke_code, methodHandle method,
249 bool sender_is_interface) {
242 int index = Method::nonvirtual_vtable_index; 250 int index = Method::nonvirtual_vtable_index;
243 // index < 0; FIXME: inline and customize set_direct_or_vtable_call 251 // index < 0; FIXME: inline and customize set_direct_or_vtable_call
244 set_direct_or_vtable_call(invoke_code, method, index); 252 set_direct_or_vtable_call(invoke_code, method, index, sender_is_interface);
245 } 253 }
246 254
247 void ConstantPoolCacheEntry::set_vtable_call(Bytecodes::Code invoke_code, methodHandle method, int index) { 255 void ConstantPoolCacheEntry::set_vtable_call(Bytecodes::Code invoke_code, methodHandle method, int index) {
248 // either the method is a miranda or its holder should accept the given index 256 // either the method is a miranda or its holder should accept the given index
249 assert(method->method_holder()->is_interface() || method->method_holder()->verify_vtable_index(index), ""); 257 assert(method->method_holder()->is_interface() || method->method_holder()->verify_vtable_index(index), "");
250 // index >= 0; FIXME: inline and customize set_direct_or_vtable_call 258 // index >= 0; FIXME: inline and customize set_direct_or_vtable_call
251 set_direct_or_vtable_call(invoke_code, method, index); 259 set_direct_or_vtable_call(invoke_code, method, index, false);
252 } 260 }
253 261
254 void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, methodHandle method, int index) { 262 void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, methodHandle method, int index) {
255 assert(method->method_holder()->verify_itable_index(index), ""); 263 assert(method->method_holder()->verify_itable_index(index), "");
256 assert(invoke_code == Bytecodes::_invokeinterface, ""); 264 assert(invoke_code == Bytecodes::_invokeinterface, "");

mercurial