246 // Workaround for the case where we encounter an invokeinterface, but we |
246 // Workaround for the case where we encounter an invokeinterface, but we |
247 // should really have an _invokevirtual since the resolved method is a |
247 // should really have an _invokevirtual since the resolved method is a |
248 // virtual method in java.lang.Object. This is a corner case in the spec |
248 // virtual method in java.lang.Object. This is a corner case in the spec |
249 // but is presumably legal. javac does not generate this code. |
249 // but is presumably legal. javac does not generate this code. |
250 // |
250 // |
251 // We set bytecode_1() to _invokeinterface, because that is the |
251 // We do not set bytecode_1() to _invokeinterface, because that is the |
252 // bytecode # used by the interpreter to see if it is resolved. |
252 // bytecode # used by the interpreter to see if it is resolved. In this |
|
253 // case, the method gets reresolved with caller for each interface call |
|
254 // because the actual selected method may not be public. |
|
255 // |
253 // We set bytecode_2() to _invokevirtual. |
256 // We set bytecode_2() to _invokevirtual. |
254 // See also interpreterRuntime.cpp. (8/25/2000) |
257 // See also interpreterRuntime.cpp. (8/25/2000) |
255 // Only set resolved for the invokeinterface case if method is public. |
|
256 // Otherwise, the method needs to be reresolved with caller for each |
|
257 // interface call. |
|
258 if (method->is_public()) set_bytecode_1(invoke_code); |
|
259 } else { |
258 } else { |
260 assert(invoke_code == Bytecodes::_invokevirtual, ""); |
259 assert(invoke_code == Bytecodes::_invokevirtual, ""); |
261 } |
260 } |
262 // set up for invokevirtual, even if linking for invokeinterface also: |
261 // set up for invokevirtual, even if linking for invokeinterface also: |
263 set_bytecode_2(Bytecodes::_invokevirtual); |
262 set_bytecode_2(Bytecodes::_invokevirtual); |