Java Code Examples for jdk.internal.org.objectweb.asm.MethodVisitor#visitMultiANewArrayInsn()

The following examples show how to use jdk.internal.org.objectweb.asm.MethodVisitor#visitMultiANewArrayInsn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestMultiANewArray.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void writeClassFile(int cfv) throws Exception {
    ClassWriter cw = new ClassWriter(0);
    MethodVisitor mv;

    cw.visit(cfv, ACC_PUBLIC + ACC_SUPER, "ClassFile", null, "java/lang/Object", null);
    mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
    mv.visitInsn(RETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();

    mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
    mv.visitCode();
    mv.visitInsn(ICONST_1);
    mv.visitInsn(ICONST_2);
    mv.visitMultiANewArrayInsn("[I", 2);
    mv.visitVarInsn(ASTORE, 1);
    mv.visitInsn(RETURN);
    mv.visitMaxs(2, 2);
    mv.visitEnd();

    cw.visitEnd();

    try (FileOutputStream fos = new FileOutputStream(new File("ClassFile.class"))) {
         fos.write(cw.toByteArray());
    }
}
 
Example 2
Source File: TestMultiANewArray.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void writeClassFile(int cfv) throws Exception {
    ClassWriter cw = new ClassWriter(0);
    MethodVisitor mv;

    cw.visit(cfv, ACC_PUBLIC + ACC_SUPER, "ClassFile", null, "java/lang/Object", null);
    mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
    mv.visitInsn(RETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();

    mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
    mv.visitCode();
    mv.visitInsn(ICONST_1);
    mv.visitInsn(ICONST_2);
    mv.visitMultiANewArrayInsn("[I", 2);
    mv.visitVarInsn(ASTORE, 1);
    mv.visitInsn(RETURN);
    mv.visitMaxs(2, 2);
    mv.visitEnd();

    cw.visitEnd();

    try (FileOutputStream fos = new FileOutputStream(new File("ClassFile.class"))) {
         fos.write(cw.toByteArray());
    }
}
 
Example 3
Source File: TestMultiANewArray.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void writeClassFile(int cfv) throws Exception {
    ClassWriter cw = new ClassWriter(0);
    MethodVisitor mv;

    cw.visit(cfv, ACC_PUBLIC + ACC_SUPER, "ClassFile", null, "java/lang/Object", null);
    mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
    mv.visitInsn(RETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();

    mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
    mv.visitCode();
    mv.visitInsn(ICONST_1);
    mv.visitInsn(ICONST_2);
    mv.visitMultiANewArrayInsn("[I", 2);
    mv.visitVarInsn(ASTORE, 1);
    mv.visitInsn(RETURN);
    mv.visitMaxs(2, 2);
    mv.visitEnd();

    cw.visitEnd();

    try (FileOutputStream fos = new FileOutputStream(new File("ClassFile.class"))) {
         fos.write(cw.toByteArray());
    }
}
 
Example 4
Source File: TestMultiANewArray.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void writeClassFile(int cfv) throws Exception {
    ClassWriter cw = new ClassWriter(0);
    MethodVisitor mv;

    cw.visit(cfv, ACC_PUBLIC + ACC_SUPER, "ClassFile", null, "java/lang/Object", null);
    mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
    mv.visitInsn(RETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();

    mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
    mv.visitCode();
    mv.visitInsn(ICONST_1);
    mv.visitInsn(ICONST_2);
    mv.visitMultiANewArrayInsn("[I", 2);
    mv.visitVarInsn(ASTORE, 1);
    mv.visitInsn(RETURN);
    mv.visitMaxs(2, 2);
    mv.visitEnd();

    cw.visitEnd();

    try (FileOutputStream fos = new FileOutputStream(new File("ClassFile.class"))) {
         fos.write(cw.toByteArray());
    }
}
 
Example 5
Source File: TestMultiANewArray.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void writeClassFile(int cfv) throws Exception {
    ClassWriter cw = new ClassWriter(0);
    MethodVisitor mv;

    cw.visit(cfv, ACC_PUBLIC + ACC_SUPER, "ClassFile", null, "java/lang/Object", null);
    mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
    mv.visitInsn(RETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();

    mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
    mv.visitCode();
    mv.visitInsn(ICONST_1);
    mv.visitInsn(ICONST_2);
    mv.visitMultiANewArrayInsn("[I", 2);
    mv.visitVarInsn(ASTORE, 1);
    mv.visitInsn(RETURN);
    mv.visitMaxs(2, 2);
    mv.visitEnd();

    cw.visitEnd();

    try (FileOutputStream fos = new FileOutputStream(new File("ClassFile.class"))) {
         fos.write(cw.toByteArray());
    }
}
 
Example 6
Source File: MultiANewArrayInsnNode.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void accept(final MethodVisitor mv) {
    mv.visitMultiANewArrayInsn(desc, dims);
    acceptAnnotations(mv);
}
 
Example 7
Source File: ArrayType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Type newarray(final MethodVisitor method, final int dims) {
    method.visitMultiANewArrayInsn(getInternalName(), dims);
    return this;
}
 
Example 8
Source File: ArrayType.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Type newarray(final MethodVisitor method, final int dims) {
    method.visitMultiANewArrayInsn(getInternalName(), dims);
    return this;
}
 
Example 9
Source File: ArrayType.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Type newarray(final MethodVisitor method, final int dims) {
    method.visitMultiANewArrayInsn(getInternalName(), dims);
    return this;
}
 
Example 10
Source File: ArrayType.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Type newarray(final MethodVisitor method, final int dims) {
    method.visitMultiANewArrayInsn(getInternalName(), dims);
    return this;
}
 
Example 11
Source File: MultiANewArrayInsnNode.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void accept(final MethodVisitor mv) {
    mv.visitMultiANewArrayInsn(desc, dims);
}
 
Example 12
Source File: MultiANewArrayInsnNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void accept(final MethodVisitor mv) {
    mv.visitMultiANewArrayInsn(desc, dims);
    acceptAnnotations(mv);
}
 
Example 13
Source File: ArrayType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Type newarray(final MethodVisitor method, final int dims) {
    method.visitMultiANewArrayInsn(getInternalName(), dims);
    return this;
}
 
Example 14
Source File: MultiANewArrayInsnNode.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public void accept(final MethodVisitor methodVisitor) {
    methodVisitor.visitMultiANewArrayInsn(desc, dims);
    acceptAnnotations(methodVisitor);
}
 
Example 15
Source File: MultiANewArrayInsnNode.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void accept(final MethodVisitor mv) {
    mv.visitMultiANewArrayInsn(desc, dims);
    acceptAnnotations(mv);
}
 
Example 16
Source File: MultiANewArrayInsnNode.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void accept(final MethodVisitor mv) {
    mv.visitMultiANewArrayInsn(desc, dims);
    acceptAnnotations(mv);
}
 
Example 17
Source File: ArrayType.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Type newarray(final MethodVisitor method, final int dims) {
    method.visitMultiANewArrayInsn(getInternalName(), dims);
    return this;
}
 
Example 18
Source File: MultiANewArrayInsnNode.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void accept(final MethodVisitor mv) {
    mv.visitMultiANewArrayInsn(desc, dims);
    acceptAnnotations(mv);
}
 
Example 19
Source File: ArrayType.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Type newarray(final MethodVisitor method, final int dims) {
    method.visitMultiANewArrayInsn(getInternalName(), dims);
    return this;
}
 
Example 20
Source File: MultiANewArrayInsnNode.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void accept(final MethodVisitor mv) {
    mv.visitMultiANewArrayInsn(desc, dims);
    acceptAnnotations(mv);
}