[vmkit-commits] [vmkit] r60031 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaConstantPool.cpp JavaJIT.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Tue Nov 25 08:12:33 PST 2008
Author: geoffray
Date: Tue Nov 25 10:12:29 2008
New Revision: 60031
URL: http://llvm.org/viewvc/llvm-project?rev=60031&view=rev
Log:
Some invokevirtual are buggy and should actually be invokeinterface.
Try to catch these errors as soon as possible.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=60031&r1=60030&r2=60031&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Tue Nov 25 10:12:29 2008
@@ -366,6 +366,14 @@
// lookup the method
meth = cl->lookupMethodDontThrow(utf8, sign->keyName, isStatic(access),
true, 0);
+ // OK, this is rare, but the Java bytecode may do an invokevirtual on an
+ // interface method. Lookup the method as if it was static.
+ // The caller is responsible for taking any action if the method is
+ // an interface method.
+
+ if (!meth) {
+ meth = cl->lookupMethodDontThrow(utf8, sign->keyName, true, true, 0);
+ }
}
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=60031&r1=60030&r2=60031&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Tue Nov 25 10:12:29 2008
@@ -70,6 +70,8 @@
(meth && (isFinal(meth->access) || isPrivate(meth->access))))
return invokeSpecial(index);
+ if (meth && isInterface(meth->classDef->access))
+ return invokeInterfaceOrVirtual(index);
#if !defined(WITHOUT_VTABLE)
Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index);
More information about the vmkit-commits
mailing list