Revision: 15691
http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=15691&view=revAuthor: dframpton-oss
Date: 2009-05-20 01:46:10 +0000 (Wed, 20 May 2009)
Log Message:
-----------
Fix for RVM-826.
Modified Paths:
--------------
rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMMethod.java
rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Reflection.java
Modified: rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMMethod.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMMethod.java 2009-05-13 23:05:16 UTC (rev 15690)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/classloader/RVMMethod.java 2009-05-20 01:46:10 UTC (rev 15691)
@@ -929,12 +929,21 @@
TypeReference[] parameters = getParameterTypes();
int numParams = parameters.length;
byte[] bytecodes;
+ boolean interfaceCall = false;
int curBC = 0;
if (!isStatic()) {
- bytecodes = new byte[8 * numParams + 8];
+ if (!getDeclaringClass().isInterface()) {
+ // virtual call
+ bytecodes = new byte[8 * numParams + 8];
+ } else {
+ // interface call
+ bytecodes = new byte[8 * numParams + 10];
+ interfaceCall = true;
+ }
bytecodes[curBC] = JBC_aload_1;
curBC++;
} else {
+ // static call
bytecodes = new byte[8 * numParams + 7];
}
for (int i=0; i < numParams; i++) {
@@ -1013,12 +1022,18 @@
bytecodes[curBC] = (byte)JBC_invokestatic;
} else if (isObjectInitializer() || isPrivate()) {
bytecodes[curBC] = (byte)JBC_invokespecial;
+ } else if (interfaceCall) {
+ bytecodes[curBC] = (byte)JBC_invokeinterface;
} else {
bytecodes[curBC] = (byte)JBC_invokevirtual;
}
constantPool[numParams+1] = ClassFileReader.packCPEntry(CP_MEMBER, getId());
bytecodes[curBC+1] = (byte)((numParams+1) >>> 8);
bytecodes[curBC+2] = (byte)(numParams+1);
+ if (interfaceCall) {
+ // invokeinterface bytecodes are historically longer than others
+ curBC+=2;
+ }
TypeReference returnType = getReturnType();
if (!returnType.isPrimitiveType() || returnType.isWordType()) {
bytecodes[curBC+3] = (byte)JBC_nop;
Modified: rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Reflection.java
===================================================================
--- rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Reflection.java 2009-05-13 23:05:16 UTC (rev 15690)
+++ rvmroot/trunk/rvm/src/org/jikesrvm/runtime/Reflection.java 2009-05-20 01:46:10 UTC (rev 15691)
@@ -149,9 +149,18 @@
if (isNonvirtual || method.isStatic() || method.isObjectInitializer()) {
targetMethod = method;
} else {
- int tibIndex = method.getOffset().toInt() >>> LOG_BYTES_IN_ADDRESS;
- targetMethod =
- Magic.getObjectType(thisArg).asClass().getVirtualMethods()[tibIndex - TIB_FIRST_VIRTUAL_METHOD_INDEX];
+ RVMClass C = Magic.getObjectType(thisArg).asClass();
+ if (!method.getDeclaringClass().isInterface()) {
+ int tibIndex = method.getOffset().toInt() >>> LOG_BYTES_IN_ADDRESS;
+ targetMethod = C.getVirtualMethods()[tibIndex - TIB_FIRST_VIRTUAL_METHOD_INDEX];
+ } else {
+ RVMClass I = method.getDeclaringClass();
+ if (!RuntimeEntrypoints.isAssignableWith(I, C))
+ throw new IncompatibleClassChangeError();
+ targetMethod = C.findVirtualMethod(method.getName(), method.getDescriptor());
+ if (targetMethod == null)
+ throw new IncompatibleClassChangeError();
+ }
}
// getCurrentCompiledMethod is synchronized but Unpreemptible.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects_______________________________________________
Jikesrvm-commits mailing list
Jikesrvm-commits@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-commits