jdk.internal.org.objectweb.asm.commons.Method Java Examples

The following examples show how to use jdk.internal.org.objectweb.asm.commons.Method. 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: EventInstrumentation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static Method makeWriteMethod(List<FieldInfo> fields) {
    StringBuilder sb = new StringBuilder();
    sb.append("(");
    for (FieldInfo v : fields) {
        sb.append(v.fieldDescriptor);
    }
    sb.append(")V");
    return new Method("write", sb.toString());
}
 
Example #2
Source File: ASMToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static Method makeWriteMethod(List<FieldInfo> fields) {
    StringBuilder sb = new StringBuilder();
    sb.append("(");
    for (FieldInfo v : fields) {
        if (!v.fieldName.equals(EventInstrumentation.FIELD_EVENT_THREAD) && !v.fieldName.equals(EventInstrumentation.FIELD_STACK_TRACE)) {
            sb.append(v.fieldDescriptor);
        }
    }
    sb.append(")V");
    return new Method("write", sb.toString());
}
 
Example #3
Source File: EventInstrumentation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static Method makeWriteMethod(List<FieldInfo> fields) {
    StringBuilder sb = new StringBuilder();
    sb.append("(");
    for (FieldInfo v : fields) {
        sb.append(v.fieldDescriptor);
    }
    sb.append(")V");
    return new Method("write", sb.toString());
}
 
Example #4
Source File: EventInstrumentation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private final void updateMethod(Method method, Consumer<MethodVisitor> code) {
    MethodNode old = getMethodNode(method);
    int index = classNode.methods.indexOf(old);
    classNode.methods.remove(old);
    MethodVisitor mv = classNode.visitMethod(old.access, old.name, old.desc, null, null);
    mv.visitCode();
    code.accept(mv);
    mv.visitMaxs(0, 0);
    MethodNode newMethod = getMethodNode(method);
    classNode.methods.remove(newMethod);
    classNode.methods.add(index, newMethod);
}
 
Example #5
Source File: EventInstrumentation.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private MethodNode getMethodNode(Method method) {
    for (MethodNode m : classNode.methods) {
        if (m.name.equals(method.getName()) && m.desc.equals(method.getDescriptor())) {
            return m;
        }
    }
    return null;
}
 
Example #6
Source File: ASMToolkit.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static Method makeWriteMethod(List<FieldInfo> fields) {
    StringBuilder sb = new StringBuilder();
    sb.append("(");
    for (FieldInfo v : fields) {
        if (!v.fieldName.equals(EventInstrumentation.FIELD_EVENT_THREAD) && !v.fieldName.equals(EventInstrumentation.FIELD_STACK_TRACE)) {
            sb.append(v.fieldDescriptor);
        }
    }
    sb.append(")V");
    return new Method("write", sb.toString());
}
 
Example #7
Source File: EventInstrumentation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private final void updateMethod(Method method, Consumer<MethodVisitor> code) {
    MethodNode old = getMethodNode(method);
    int index = classNode.methods.indexOf(old);
    classNode.methods.remove(old);
    MethodVisitor mv = classNode.visitMethod(old.access, old.name, old.desc, null, null);
    mv.visitCode();
    code.accept(mv);
    mv.visitMaxs(0, 0);
    MethodNode newMethod = getMethodNode(method);
    classNode.methods.remove(newMethod);
    classNode.methods.add(index, newMethod);
}
 
Example #8
Source File: EventInstrumentation.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private MethodNode getMethodNode(Method method) {
    for (MethodNode m : classNode.methods) {
        if (m.name.equals(method.getName()) && m.desc.equals(method.getDescriptor())) {
            return m;
        }
    }
    return null;
}
 
Example #9
Source File: ASMToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static Method makeWriteMethod(List<FieldInfo> fields) {
    StringBuilder sb = new StringBuilder();
    sb.append("(");
    for (FieldInfo v : fields) {
        if (!v.fieldName.equals(EventInstrumentation.FIELD_EVENT_THREAD) && !v.fieldName.equals(EventInstrumentation.FIELD_STACK_TRACE)) {
            sb.append(v.fieldDescriptor);
        }
    }
    sb.append(")V");
    return new Method("write", sb.toString());
}
 
Example #10
Source File: EventInstrumentation.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private MethodNode getMethodNode(Method method) {
    for (MethodNode m : classNode.methods) {
        if (m.name.equals(method.getName()) && m.desc.equals(method.getDescriptor())) {
            return m;
        }
    }
    return null;
}
 
Example #11
Source File: EventInstrumentation.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private final void updateMethod(Method method, Consumer<MethodVisitor> code) {
    MethodNode old = getMethodNode(method);
    int index = classNode.methods.indexOf(old);
    classNode.methods.remove(old);
    MethodVisitor mv = classNode.visitMethod(old.access, old.name, old.desc, null, null);
    mv.visitCode();
    code.accept(mv);
    mv.visitMaxs(0, 0);
    MethodNode newMethod = getMethodNode(method);
    classNode.methods.remove(newMethod);
    classNode.methods.add(index, newMethod);
}
 
Example #12
Source File: EventInstrumentation.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static Method makeWriteMethod(List<FieldInfo> fields) {
    StringBuilder sb = new StringBuilder();
    sb.append("(");
    for (FieldInfo v : fields) {
        sb.append(v.fieldDescriptor);
    }
    sb.append(")V");
    return new Method("write", sb.toString());
}
 
Example #13
Source File: EventInstrumentation.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private final void updateExistingWithEmptyVoidMethod(Method voidMethod) {
    updateMethod(voidMethod, methodVisitor -> {
        methodVisitor.visitInsn(Opcodes.RETURN);
    });
}
 
Example #14
Source File: ASMToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeVirtual(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className, m.getName(), m.getDescriptor(), false);
}
 
Example #15
Source File: ASMToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeVirtual(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className, m.getName(), m.getDescriptor(), false);
}
 
Example #16
Source File: ASMToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeStatic(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, className, m.getName(), m.getDescriptor(), false);
}
 
Example #17
Source File: ASMToolkit.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeSpecial(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, className, m.getName(), m.getDescriptor(), false);
}
 
Example #18
Source File: EventInstrumentation.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private final void updateExistingWithReturnFalse(Method voidMethod) {
    updateMethod(voidMethod, methodVisitor -> {
        methodVisitor.visitInsn(Opcodes.ICONST_0);
        methodVisitor.visitInsn(Opcodes.IRETURN);
    });
}
 
Example #19
Source File: EventInstrumentation.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private final void updateExistingWithReturnFalse(Method voidMethod) {
    updateMethod(voidMethod, methodVisitor -> {
        methodVisitor.visitInsn(Opcodes.ICONST_0);
        methodVisitor.visitInsn(Opcodes.IRETURN);
    });
}
 
Example #20
Source File: EventInstrumentation.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private final void updateExistingWithEmptyVoidMethod(Method voidMethod) {
    updateMethod(voidMethod, methodVisitor -> {
        methodVisitor.visitInsn(Opcodes.RETURN);
    });
}
 
Example #21
Source File: EventHandlerCreator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void visitMethod(final MethodVisitor mv, final int opcode, final Type type, final Method method) {
    mv.visitMethodInsn(opcode, type.getInternalName(), method.getName(), method.getDescriptor(), false);
}
 
Example #22
Source File: ASMToolkit.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeVirtual(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, className, m.getName(), m.getDescriptor(), false);
}
 
Example #23
Source File: ASMToolkit.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeStatic(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, className, m.getName(), m.getDescriptor(), false);
}
 
Example #24
Source File: ASMToolkit.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeSpecial(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, className, m.getName(), m.getDescriptor(), false);
}
 
Example #25
Source File: EventHandlerCreator.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private void visitMethod(final MethodVisitor mv, final int opcode, final Type type, final Method method) {
    mv.visitMethodInsn(opcode, type.getInternalName(), method.getName(), method.getDescriptor(), false);
}
 
Example #26
Source File: ASMToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeSpecial(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, className, m.getName(), m.getDescriptor(), false);
}
 
Example #27
Source File: ASMToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void invokeStatic(MethodVisitor methodVisitor, String className, Method m) {
    methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, className, m.getName(), m.getDescriptor(), false);
}
 
Example #28
Source File: EventInstrumentation.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private final void updateExistingWithReturnFalse(Method voidMethod) {
    updateMethod(voidMethod, methodVisitor -> {
        methodVisitor.visitInsn(Opcodes.ICONST_0);
        methodVisitor.visitInsn(Opcodes.IRETURN);
    });
}
 
Example #29
Source File: EventInstrumentation.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private final void updateExistingWithEmptyVoidMethod(Method voidMethod) {
    updateMethod(voidMethod, methodVisitor -> {
        methodVisitor.visitInsn(Opcodes.RETURN);
    });
}
 
Example #30
Source File: EventHandlerCreator.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void visitMethod(final MethodVisitor mv, final int opcode, final Type type, final Method method) {
    mv.visitMethodInsn(opcode, type.getInternalName(), method.getName(), method.getDescriptor(), false);
}