Search in sources :

Example 1 with CheckMethodVisitorFsm

use of org.apache.drill.exec.compile.CheckMethodVisitorFsm in project drill by apache.

the class ScalarReplacementNode method visitEnd.

@Override
public void visitEnd() {
    /*
     * Note this is a MethodNode, not a MethodVisitor. As a result, calls to the various visitX()
     * methods will be building up a method. Then, once we analyze it, we use accept() to visit that
     * method and transform it with the InstructionModifier at the bottom.
     */
    super.visitEnd();
    final LinkedList<ReplacingBasicValue> valueList = new LinkedList<>();
    final MethodAnalyzer<BasicValue> analyzer = new MethodAnalyzer<BasicValue>(new ReplacingInterpreter(className, valueList));
    Frame<BasicValue>[] frames;
    try {
        frames = analyzer.analyze(className, this);
    } catch (final AnalyzerException e) {
        throw new IllegalStateException(e);
    }
    if (logger.isTraceEnabled()) {
        final StringBuilder sb = new StringBuilder();
        sb.append("ReplacingBasicValues for " + className + "\n");
        for (final ReplacingBasicValue value : valueList) {
            value.dump(sb, 2);
            sb.append('\n');
        }
        logger.debug(sb.toString());
    }
    // wrap the instruction handler so that we can do additional things
    final TrackingInstructionList list = new TrackingInstructionList(frames, this.instructions);
    this.instructions = list;
    MethodVisitor methodVisitor = inner;
    if (verifyBytecode) {
        methodVisitor = new CheckMethodVisitorFsm(CompilationConfig.ASM_API_VERSION, methodVisitor);
    }
    final InstructionModifier holderV = new InstructionModifier(this.access, this.name, this.desc, this.signature, this.exceptionsArr, list, methodVisitor);
    accept(holderV);
}
Also used : Frame(org.objectweb.asm.tree.analysis.Frame) AnalyzerException(org.objectweb.asm.tree.analysis.AnalyzerException) LinkedList(java.util.LinkedList) BasicValue(org.objectweb.asm.tree.analysis.BasicValue) MethodVisitor(org.objectweb.asm.MethodVisitor) CheckMethodVisitorFsm(org.apache.drill.exec.compile.CheckMethodVisitorFsm)

Aggregations

LinkedList (java.util.LinkedList)1 CheckMethodVisitorFsm (org.apache.drill.exec.compile.CheckMethodVisitorFsm)1 MethodVisitor (org.objectweb.asm.MethodVisitor)1 AnalyzerException (org.objectweb.asm.tree.analysis.AnalyzerException)1 BasicValue (org.objectweb.asm.tree.analysis.BasicValue)1 Frame (org.objectweb.asm.tree.analysis.Frame)1