Menu

#513 Abstract interface method compilation failure

working
closed
runtime (64)
7
2012-09-21
2006-05-08
Anonymous
No

The Compiler framework
(vm/compilers/baseline/VM_CompilerFramework.java)
implicitly assumes that an invokevirtual on method M in
class C will resolve to a method in C or a superclass,
consistent with the recursive resolution algorithm
specified by JVM spec 5.4.3.3.

This assumption, as manifest in
VM_CompilerFramework.genCode(), is incorrect in cases
which satisfy all of the following conditions hold true:

(a) C is abstract
(b) M is defined by an interface or superinterface of C
(c) M is invokevirtual [rather than invokeinterface]
through C
(d) M is not explicitly defined as abstract in C

Cases which satisfy all the above conditions result in
the following exception being raised at compilation
runtime:

Exception in thread "main":
java.lang.NoSuchMethodError: < SystemAppCL,
LAbstractClass;, someMethod, (Ljava/lang/Object;I)V >
at
com.ibm.JikesRVM.classloader.VM_MethodReference.resolveInternal(VM_MethodReference.java:231)
at
com.ibm.JikesRVM.classloader.VM_MethodReference.peekResolvedMethod(VM_MethodReference.java:173)
at
com.ibm.JikesRVM.classloader.VM_MemberReference.peekResolvedMember(VM_MemberReference.java:227)
at
com.ibm.JikesRVM.classloader.VM_MemberReference.needsDynamicLink(VM_MemberReference.java:249)
at
com.ibm.JikesRVM.VM_CompilerFramework.genCode(VM_CompilerFramework.java:1438)
at
com.ibm.JikesRVM.VM_BaselineCompiler.compile(VM_BaselineCompiler.java:214)
at
com.ibm.JikesRVM.VM_BaselineCompiler.compile(VM_BaselineCompiler.java:159)
at
com.ibm.JikesRVM.VM_RuntimeCompiler.baselineCompile(VM_RuntimeCompiler.java:319)
at
com.ibm.JikesRVM.VM_RuntimeCompiler.compile(VM_RuntimeCompiler.java:843)
at
com.ibm.JikesRVM.classloader.VM_NormalMethod.genCode(VM_NormalMethod.java:176)
at
com.ibm.JikesRVM.classloader.VM_Method.compile(VM_Method.java:399)
at
com.ibm.JikesRVM.VM_DynamicLinker$DL_Helper.compileMethod(VM_DynamicLinker.java:124)
at
com.ibm.JikesRVM.VM_DynamicLinker.lazyMethodInvoker(VM_DynamicLinker.java:31)
at Test.testSomeClass(Test.java:19)
at Test.main(Test.java:13)

A test case demonstrating this bug will be added to
rvm/regression/tests/bytecodeTests.

Discussion

  • Ian Rogers

    Ian Rogers - 2006-05-08

    Logged In: YES
    user_id=308843

    I can confirm we differ from Sun's JVM with this case.

    Ian

     
  • Ian Rogers

    Ian Rogers - 2006-05-09

    Logged In: YES
    user_id=308843

    From conversation on the Classpath IRC with Tom Tromey and
    Mark Weilaard, apparently this issue is likely to be related
    to the Jikes RVM's handling of Miranda methods. Google
    provides the source of a few links, but there's also some
    discussion here:

    http://lists.nongnu.org/archive/html/classpath/2003-03/msg00002.html

    Ian

     
  • Dave Grove

    Dave Grove - 2006-06-07

    Logged In: YES
    user_id=1215435

    applied patch 1483900 which fixes this defect.

     
  • Dave Grove

    Dave Grove - 2006-06-07

    Logged In: YES
    user_id=1215435

    patch only fixed IA32 baseline compiler; working on
    comprable fixes for PPC and opt compilers.

     
  • Dave Grove

    Dave Grove - 2006-06-07

    Logged In: YES
    user_id=1215435

    fix for PPC compiler committed; fix for opt compiler will be
    committed shortly.

     

Log in to post a comment.