1 /* 2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package vm.mlvm.mixed.func.regression.b7127687; 25 26 import nsk.share.Consts; 27 import vm.mlvm.share.MlvmTest; 28 import vm.mlvm.share.Env; 29 import vm.mlvm.share.CustomClassLoaders; 30 31 import java.lang.invoke.MethodType; 32 33 import java.util.List; 34 import java.util.ArrayList; 35 36 import jdk.internal.org.objectweb.asm.ClassWriter; 37 import static jdk.internal.org.objectweb.asm.Opcodes.*; 38 39 public class Test extends MlvmTest { 40 41 final static int CLASSES_COUNT = 1000; 42 43 public static void main(String[] args) { MlvmTest.launch(args); } 44 45 @Override 46 public boolean run() throws Throwable { 47 List<Class> classes = new ArrayList<Class>(); 48 49 //generating list of unique classes 50 for (int i = 0; i < CLASSES_COUNT; i++) { 51 classes.add(generateClass("Class" + i)); 52 } 53 54 for (Class a : classes) { 55 for (Class b : classes) { 56 Env.traceNormal("Perform call MethodType.methodType(" + a + ", " + b + ")"); 57 MethodType.methodType(a, b); 58 } 59 } 60 61 return true; 62 } 63 64 65 private static Class generateClass(String name) throws ClassNotFoundException{ 66 ClassWriter cw = new ClassWriter(0); 67 cw.visit(V1_1, ACC_PUBLIC, name, null, "java/lang/Object", null); 68 return CustomClassLoaders.makeClassBytesLoader(cw.toByteArray(), name).loadClass(name); 69 } 70 71 }