8007888: jdk fix default method: VerifyError: Illegal use of nonvirtual
authoracorn
Wed, 13 Feb 2013 16:09:13 -0500
changeset 15670 eca7bd7651cf
parent 15668 c5d8a90a4b40
child 15671 6cd269394b2a
8007888: jdk fix default method: VerifyError: Illegal use of nonvirtual Summary: Recognize VM generated method in old verifier. With 8004967 Reviewed-by: coleenp, acorn Contributed-by: bharadwaj.yadavalli@oracle.com
jdk/src/share/javavm/export/jvm.h
jdk/src/share/native/common/check_code.c
--- a/jdk/src/share/javavm/export/jvm.h	Wed Feb 13 12:56:46 2013 -0800
+++ b/jdk/src/share/javavm/export/jvm.h	Wed Feb 13 16:09:13 2013 -0500
@@ -822,6 +822,13 @@
 JVM_IsConstructorIx(JNIEnv *env, jclass cb, int index);
 
 /*
+ * Is the given method generated by the VM.
+ * The method is identified by method_index.
+ */
+JNIEXPORT jboolean JNICALL
+JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cb, int index);
+
+/*
  * Returns the name of a given method in UTF format.
  * The result remains valid until JVM_ReleaseUTF is called.
  *
--- a/jdk/src/share/native/common/check_code.c	Wed Feb 13 12:56:46 2013 -0800
+++ b/jdk/src/share/native/common/check_code.c	Wed Feb 13 16:09:13 2013 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -983,6 +983,12 @@
         CCerror(context, "Inconsistent access bits.");
     }
 
+    // If this method is an overpass method, which is generated by the VM,
+    // we trust the code and no check needs to be done.
+    if (JVM_IsVMGeneratedMethodIx(env, cb, method_index)) {
+      return;
+    }
+
     /* Run through the code.  Mark the start of each instruction, and give
      * the instruction a number */
     for (i = 0, offset = 0; offset < code_length; i++) {