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

The following examples show how to use jdk.internal.org.objectweb.asm.commons.SimpleRemapper. 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: JIMethodMergeAdapter.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitEnd() {
    SimpleRemapper remapper = new SimpleRemapper(typeMap);
    for (MethodNode mn : cn.methods) {
        // Check if the method is in the list of methods to copy
        if (methodInFilter(mn.name, mn.desc)) {
            Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "Copying method: " + mn.name + mn.desc);
            Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG,  "   with mapper: " + typeMap);

            String[] exceptions = new String[mn.exceptions.size()];
            mn.exceptions.toArray(exceptions);
            MethodVisitor mv = cv.visitMethod(mn.access, mn.name, mn.desc, mn.signature, exceptions);
            mn.instructions.resetLabels();
            mn.accept(new RemappingMethodAdapter(mn.access, mn.desc, mv, remapper));
        }
    }
    super.visitEnd();
}
 
Example #2
Source File: JIMethodCallInliner.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitMethodInsn(int opcode, String owner, String name,
        String desc, boolean itf) {
    // Now we are looking at method call in the source method
    if (!shouldBeInlined(owner, name, desc)) {
        // If this method call should not be inlined, just keep it
        mv.visitMethodInsn(opcode, owner, name, desc, itf);
        return;
    }
    // If the call should be inlined, we create a MethodInliningAdapter
    // The MIA will walk the instructions in the inlineTarget and add them
    // to the current method, doing the necessary name remappings.
    Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "Inlining call to " + name + desc);
    Remapper remapper = new SimpleRemapper(oldClass, newClass);
    Label end = new Label();
    inlining = true;
    inlineTarget.instructions.resetLabels();
    JIMethodInliningAdapter mia = new JIMethodInliningAdapter(this, end,
            opcode == Opcodes.INVOKESTATIC ? Opcodes.ACC_STATIC : 0, desc,
            remapper);
    inlineTarget.accept(mia);
    inlining = false;
    super.visitLabel(end);
}
 
Example #3
Source File: JIMethodMergeAdapter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitEnd() {
    SimpleRemapper remapper = new SimpleRemapper(typeMap);
    for (MethodNode mn : cn.methods) {
        // Check if the method is in the list of methods to copy
        if (methodInFilter(mn.name, mn.desc)) {
            Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "Copying method: " + mn.name + mn.desc);
            Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG,  "   with mapper: " + typeMap);

            String[] exceptions = new String[mn.exceptions.size()];
            mn.exceptions.toArray(exceptions);
            MethodVisitor mv = cv.visitMethod(mn.access, mn.name, mn.desc, mn.signature, exceptions);
            mn.instructions.resetLabels();
            mn.accept(new RemappingMethodAdapter(mn.access, mn.desc, mv, remapper));
        }
    }
    super.visitEnd();
}
 
Example #4
Source File: JIMethodCallInliner.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitMethodInsn(int opcode, String owner, String name,
        String desc, boolean itf) {
    // Now we are looking at method call in the source method
    if (!shouldBeInlined(owner, name, desc)) {
        // If this method call should not be inlined, just keep it
        mv.visitMethodInsn(opcode, owner, name, desc, itf);
        return;
    }
    // If the call should be inlined, we create a MethodInliningAdapter
    // The MIA will walk the instructions in the inlineTarget and add them
    // to the current method, doing the necessary name remappings.
    Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "Inlining call to " + name + desc);
    Remapper remapper = new SimpleRemapper(oldClass, newClass);
    Label end = new Label();
    inlining = true;
    inlineTarget.instructions.resetLabels();
    JIMethodInliningAdapter mia = new JIMethodInliningAdapter(this, end,
            opcode == Opcodes.INVOKESTATIC ? Opcodes.ACC_STATIC : 0, desc,
            remapper);
    inlineTarget.accept(mia);
    inlining = false;
    super.visitLabel(end);
}
 
Example #5
Source File: JIMethodMergeAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitEnd() {
    SimpleRemapper remapper = new SimpleRemapper(typeMap);
    for (MethodNode mn : cn.methods) {
        // Check if the method is in the list of methods to copy
        if (methodInFilter(mn.name, mn.desc)) {
            Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "Copying method: " + mn.name + mn.desc);
            Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG,  "   with mapper: " + typeMap);

            String[] exceptions = new String[mn.exceptions.size()];
            mn.exceptions.toArray(exceptions);
            MethodVisitor mv = cv.visitMethod(mn.access, mn.name, mn.desc, mn.signature, exceptions);
            mn.instructions.resetLabels();
            mn.accept(new RemappingMethodAdapter(mn.access, mn.desc, mv, remapper));
        }
    }
    super.visitEnd();
}
 
Example #6
Source File: JIMethodCallInliner.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void visitMethodInsn(int opcode, String owner, String name,
        String desc, boolean itf) {
    // Now we are looking at method call in the source method
    if (!shouldBeInlined(owner, name, desc)) {
        // If this method call should not be inlined, just keep it
        mv.visitMethodInsn(opcode, owner, name, desc, itf);
        return;
    }
    // If the call should be inlined, we create a MethodInliningAdapter
    // The MIA will walk the instructions in the inlineTarget and add them
    // to the current method, doing the necessary name remappings.
    Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "Inlining call to " + name + desc);
    Remapper remapper = new SimpleRemapper(oldClass, newClass);
    Label end = new Label();
    inlining = true;
    inlineTarget.instructions.resetLabels();
    JIMethodInliningAdapter mia = new JIMethodInliningAdapter(this, end,
            opcode == Opcodes.INVOKESTATIC ? Opcodes.ACC_STATIC : 0, desc,
            remapper);
    inlineTarget.accept(mia);
    inlining = false;
    super.visitLabel(end);
}