224 // Workaround for the case where we encounter an invokeinterface, but we |
224 // Workaround for the case where we encounter an invokeinterface, but we |
225 // should really have an _invokevirtual since the resolved method is a |
225 // should really have an _invokevirtual since the resolved method is a |
226 // virtual method in java.lang.Object. This is a corner case in the spec |
226 // virtual method in java.lang.Object. This is a corner case in the spec |
227 // but is presumably legal. javac does not generate this code. |
227 // but is presumably legal. javac does not generate this code. |
228 // |
228 // |
229 // We set bytecode_1() to _invokeinterface, because that is the |
229 // We do not set bytecode_1() to _invokeinterface, because that is the |
230 // bytecode # used by the interpreter to see if it is resolved. |
230 // bytecode # used by the interpreter to see if it is resolved. In this |
|
231 // case, the method gets reresolved with caller for each interface call |
|
232 // because the actual selected method may not be public. |
|
233 // |
231 // We set bytecode_2() to _invokevirtual. |
234 // We set bytecode_2() to _invokevirtual. |
232 // See also interpreterRuntime.cpp. (8/25/2000) |
235 // See also interpreterRuntime.cpp. (8/25/2000) |
233 // Only set resolved for the invokeinterface case if method is public. |
|
234 // Otherwise, the method needs to be reresolved with caller for each |
|
235 // interface call. |
|
236 if (method->is_public()) set_bytecode_1(invoke_code); |
|
237 } else { |
236 } else { |
238 assert(invoke_code == Bytecodes::_invokevirtual, ""); |
237 assert(invoke_code == Bytecodes::_invokevirtual, ""); |
239 } |
238 } |
240 // set up for invokevirtual, even if linking for invokeinterface also: |
239 // set up for invokevirtual, even if linking for invokeinterface also: |
241 set_bytecode_2(Bytecodes::_invokevirtual); |
240 set_bytecode_2(Bytecodes::_invokevirtual); |