mirror of
https://github.com/corda/corda.git
synced 2025-06-22 09:08:49 +00:00
handle invokevirtual calls to non-virtual methods
OpenJDK's sun.reflect.MethodAccessorGenerator can generate invokevirtual calls to private methods (which we normally consider non-virtual); we must compile them as non-virtual calls since they aren't in the vtable.
This commit is contained in:
@ -4890,6 +4890,9 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
||||
if (LIKELY(target)) {
|
||||
assert(t, (methodFlags(t, target) & ACC_STATIC) == 0);
|
||||
|
||||
bool tailCall = isTailCall(t, code, ip, context->method, target);
|
||||
|
||||
if (LIKELY(methodVirtual(t, target))) {
|
||||
unsigned parameterFootprint = methodParameterFootprint(t, target);
|
||||
|
||||
unsigned offset = ClassVtable
|
||||
@ -4899,8 +4902,6 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
||||
|
||||
unsigned rSize = resultSize(t, methodReturnCode(t, target));
|
||||
|
||||
bool tailCall = isTailCall(t, code, ip, context->method, target);
|
||||
|
||||
Compiler::Operand* result = c->stackCall
|
||||
(c->memory
|
||||
(c->and_
|
||||
@ -4918,6 +4919,13 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
||||
if (rSize) {
|
||||
pushReturnValue(t, frame, methodReturnCode(t, target), result);
|
||||
}
|
||||
} else {
|
||||
// OpenJDK generates invokevirtual calls to private methods
|
||||
// (e.g. readObject and writeObject for serialization), so
|
||||
// we must handle such cases here.
|
||||
|
||||
compileDirectInvoke(t, frame, target, tailCall);
|
||||
}
|
||||
} else {
|
||||
PROTECT(t, reference);
|
||||
|
||||
|
Reference in New Issue
Block a user