hotspot/test/runtime/lambda-features/TestStaticandInstance.java
author stefank
Wed, 20 Apr 2016 09:58:15 +0200
changeset 38000 7519aefb5b86
parent 36209 8db2a78cbc29
child 41705 332239c052cc
permissions -rw-r--r--
8079843: do_young_space_rescan - comment out of sync with code Reviewed-by: mgerdin, sjohanss, ehelin, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32189
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
     1
/*
36209
8db2a78cbc29 8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents: 32189
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
32189
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
     4
 *
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
     8
 *
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    13
 * accompanied this code).
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    14
 *
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    18
 *
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    21
 * questions.
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    22
 *
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    23
 */
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    24
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    25
/*
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    26
 * @test
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    27
 * @bug 8087342
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    28
 * @summary Test linkresolver search static, instance and overpass duplicates
36209
8db2a78cbc29 8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents: 32189
diff changeset
    29
 * @modules java.base/jdk.internal.org.objectweb.asm
32189
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    30
 * @run main/othervm -Xverify:none TestStaticandInstance
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    31
 */
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    32
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    33
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    34
import java.util.*;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    35
import jdk.internal.org.objectweb.asm.*;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    36
import static jdk.internal.org.objectweb.asm.Opcodes.*;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    37
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    38
public class TestStaticandInstance {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    39
  static final String stringC = "C";
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    40
  static final String stringD = "D";
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    41
  static final String stringI = "I";
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    42
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    43
  public static void main(String args[]) throws Throwable {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    44
    ClassLoader cl = new ClassLoader() {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    45
      public Class<?> loadClass(String name) throws ClassNotFoundException {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    46
        Class retClass;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    47
        if ((retClass = findLoadedClass(name)) != null) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    48
           return retClass;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    49
        }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    50
        if (stringC.equals(name)) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    51
            byte[] classFile=dumpC();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    52
            return defineClass(stringC, classFile, 0, classFile.length);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    53
        }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    54
        if (stringD.equals(name)) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    55
            byte[] classFile=dumpD();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    56
            return defineClass(stringD, classFile, 0, classFile.length);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    57
        }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    58
        if (stringI.equals(name)) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    59
            byte[] classFile=dumpI();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    60
            return defineClass(stringI, classFile, 0, classFile.length);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    61
        }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    62
        return super.loadClass(name);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    63
      }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    64
    };
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    65
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    66
    Class classC = cl.loadClass(stringC);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    67
    Class classI = cl.loadClass(stringI);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    68
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    69
    try {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    70
      int staticret = (Integer)cl.loadClass(stringD).getDeclaredMethod("CallStatic").invoke(null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    71
      if (staticret != 1) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    72
        throw new RuntimeException("invokestatic failed to call correct method");
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    73
      }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    74
      System.out.println("staticret: " + staticret); // should be 1
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    75
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    76
      int invokeinterfaceret = (Integer)cl.loadClass(stringD).getDeclaredMethod("CallInterface").invoke(null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    77
      if (invokeinterfaceret != 0) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    78
        throw new RuntimeException(String.format("Expected java.lang.AbstractMethodError, got %d", invokeinterfaceret));
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    79
      }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    80
      System.out.println("invokeinterfaceret: AbstractMethodError");
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    81
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    82
      int invokevirtualret = (Integer)cl.loadClass(stringD).getDeclaredMethod("CallVirtual").invoke(null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    83
      if (invokevirtualret != 0) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    84
        throw new RuntimeException(String.format("Expected java.lang.IncompatibleClassChangeError, got %d", invokevirtualret));
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    85
      }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    86
      System.out.println("invokevirtualret: IncompatibleClassChangeError");
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    87
    } catch (java.lang.Throwable e) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    88
      throw new RuntimeException("Unexpected exception: " + e.getMessage());
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    89
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    90
  }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    91
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    92
/*
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    93
interface I {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    94
  public int m(); // abstract
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    95
  default int q() { return 3; } // trigger defmeth processing: C gets AME overpass
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    96
}
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    97
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    98
// C gets static, private and AME overpass m()I with -Xverify:none
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
    99
class C implements I {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   100
  static int m() { return 1;}  // javac with "n()" and patch to "m()"
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   101
  private int m() { return 2;} // javac with public and patch to private
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   102
}
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   103
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   104
public class D {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   105
  public static int CallStatic() {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   106
    int staticret = C.m();    // javac with "C.n" and patch to "C.m"
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   107
    return staticret;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   108
  }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   109
  public static int CallInterface() throws AbstractMethodError{
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   110
    try {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   111
      I myI = new C();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   112
      return myI.m();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   113
    } catch (java.lang.AbstractMethodError e) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   114
      return 0; // for success
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   115
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   116
  }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   117
  public static int CallVirtual() {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   118
    try {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   119
      C myC = new C();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   120
      return myC.m();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   121
    } catch (java.lang.IncompatibleClassChangeError e) {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   122
      return 0; // for success
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   123
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   124
  }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   125
}
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   126
*/
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   127
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   128
  public static byte[] dumpC() {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   129
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   130
    ClassWriter cw = new ClassWriter(0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   131
    FieldVisitor fv;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   132
    MethodVisitor mv;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   133
    AnnotationVisitor av0;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   134
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   135
    cw.visit(52, ACC_SUPER, "C", null, "java/lang/Object", new String[] { "I" });
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   136
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   137
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   138
      mv = cw.visitMethod(0, "<init>", "()V", null, null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   139
      mv.visitCode();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   140
      mv.visitVarInsn(ALOAD, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   141
      mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   142
      mv.visitInsn(RETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   143
      mv.visitMaxs(1, 1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   144
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   145
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   146
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   147
      mv = cw.visitMethod(ACC_STATIC, "m", "()I", null, null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   148
      mv.visitCode();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   149
      mv.visitInsn(ICONST_1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   150
      mv.visitInsn(IRETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   151
      mv.visitMaxs(1, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   152
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   153
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   154
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   155
      mv = cw.visitMethod(ACC_PRIVATE, "m", "()I", null, null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   156
      mv.visitCode();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   157
      mv.visitInsn(ICONST_2);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   158
      mv.visitInsn(IRETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   159
      mv.visitMaxs(1, 1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   160
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   161
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   162
    cw.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   163
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   164
    return cw.toByteArray();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   165
  }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   166
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   167
  public static byte[] dumpD () {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   168
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   169
    ClassWriter cw = new ClassWriter(0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   170
    FieldVisitor fv;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   171
    MethodVisitor mv;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   172
    AnnotationVisitor av0;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   173
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   174
    cw.visit(52, ACC_PUBLIC + ACC_SUPER, "D", null, "java/lang/Object", null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   175
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   176
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   177
      mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   178
      mv.visitCode();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   179
      mv.visitVarInsn(ALOAD, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   180
      mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   181
      mv.visitInsn(RETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   182
      mv.visitMaxs(1, 1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   183
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   184
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   185
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   186
      mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "CallStatic", "()I", null, null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   187
      mv.visitCode();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   188
      mv.visitMethodInsn(INVOKESTATIC, "C", "m", "()I", false);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   189
      mv.visitVarInsn(ISTORE, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   190
      mv.visitVarInsn(ILOAD, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   191
      mv.visitInsn(IRETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   192
      mv.visitMaxs(1, 1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   193
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   194
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   195
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   196
      mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "CallInterface", "()I", null, new String[] { "java/lang/AbstractMethodError" });
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   197
      mv.visitCode();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   198
      Label l0 = new Label();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   199
      Label l1 = new Label();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   200
      Label l2 = new Label();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   201
      mv.visitTryCatchBlock(l0, l1, l2, "java/lang/AbstractMethodError");
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   202
      mv.visitLabel(l0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   203
      mv.visitTypeInsn(NEW, "C");
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   204
      mv.visitInsn(DUP);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   205
      mv.visitMethodInsn(INVOKESPECIAL, "C", "<init>", "()V", false);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   206
      mv.visitVarInsn(ASTORE, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   207
      mv.visitVarInsn(ALOAD, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   208
      mv.visitMethodInsn(INVOKEINTERFACE, "I", "m", "()I", true);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   209
      mv.visitLabel(l1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   210
      mv.visitInsn(IRETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   211
      mv.visitLabel(l2);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   212
      mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {"java/lang/AbstractMethodError"});
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   213
      mv.visitVarInsn(ASTORE, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   214
      mv.visitInsn(ICONST_0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   215
      mv.visitInsn(IRETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   216
      mv.visitMaxs(2, 1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   217
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   218
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   219
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   220
      mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "CallVirtual", "()I", null, null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   221
      mv.visitCode();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   222
      Label l0 = new Label();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   223
      Label l1 = new Label();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   224
      Label l2 = new Label();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   225
      mv.visitTryCatchBlock(l0, l1, l2, "java/lang/IncompatibleClassChangeError");
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   226
      mv.visitLabel(l0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   227
      mv.visitTypeInsn(NEW, "C");
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   228
      mv.visitInsn(DUP);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   229
      mv.visitMethodInsn(INVOKESPECIAL, "C", "<init>", "()V", false);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   230
      mv.visitVarInsn(ASTORE, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   231
      mv.visitVarInsn(ALOAD, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   232
      mv.visitMethodInsn(INVOKEVIRTUAL, "C", "m", "()I", false);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   233
      mv.visitLabel(l1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   234
      mv.visitInsn(IRETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   235
      mv.visitLabel(l2);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   236
      mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] {"java/lang/IncompatibleClassChangeError"});
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   237
      mv.visitVarInsn(ASTORE, 0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   238
      mv.visitInsn(ICONST_0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   239
      mv.visitInsn(IRETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   240
      mv.visitMaxs(2, 1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   241
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   242
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   243
    cw.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   244
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   245
    return cw.toByteArray();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   246
  }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   247
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   248
  public static byte[] dumpI() {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   249
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   250
    ClassWriter cw = new ClassWriter(0);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   251
    FieldVisitor fv;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   252
    MethodVisitor mv;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   253
    AnnotationVisitor av0;
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   254
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   255
    cw.visit(52, ACC_ABSTRACT + ACC_INTERFACE, "I", null, "java/lang/Object", null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   256
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   257
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   258
      mv = cw.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, "m", "()I", null, null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   259
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   260
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   261
    {
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   262
      mv = cw.visitMethod(ACC_PUBLIC, "q", "()I", null, null);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   263
      mv.visitCode();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   264
      mv.visitInsn(ICONST_3);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   265
      mv.visitInsn(IRETURN);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   266
      mv.visitMaxs(1, 1);
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   267
      mv.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   268
    }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   269
    cw.visitEnd();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   270
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   271
    return cw.toByteArray();
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   272
  }
5264b560ab1b 8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
diff changeset
   273
}