Package nginx.clojure.asm.tree

Examples of nginx.clojure.asm.tree.MethodNode


           
            if(methods == null) {
                methods = new ArrayList<MethodNode>();
            }
           
            MethodNode mn = null;
            MethodVisitor mv = null;
            if (name.charAt(0) == '<') {
              mv = mn = new MethodNode(access, name, desc, signature, exceptions);
            }else {
              if (db.meetTraceTargetClassMethod(className, method)) {
                Printer tp = new Textifier();
                mn = new TracableMethodNode("Orginal: " + className + "." + method,  db, access, name, desc, signature, exceptions, tp, new PrintWriter(System.out));
                mv = new TraceMethodVisitor(mn, tp);
View Full Code Here


     *            a map of already visited labels (in other methods).
     */
    public CheckMethodAdapter(final int access, final String name,
            final String desc, final MethodVisitor cmv,
            final Map<Label, Integer> labels) {
        this(new MethodNode(access, name, desc, null, null) {
            @Override
            public void visitEnd() {
                Analyzer<BasicValue> a = new Analyzer<BasicValue>(
                        new BasicVerifier());
                try {
View Full Code Here

        for (Iterator<String> i = cn.interfaces.iterator(); i.hasNext();) {
            interfaces.add(Type.getObjectType(i.next().toString()));
        }

        for (int i = 0; i < methods.size(); ++i) {
            MethodNode method = methods.get(i);
            SimpleVerifier verifier = new SimpleVerifier(
                    Type.getObjectType(cn.name), syperType, interfaces,
                    (cn.access & Opcodes.ACC_INTERFACE) != 0);
            Analyzer<BasicValue> a = new Analyzer<BasicValue>(verifier);
            if (loader != null) {
View Full Code Here

    List<String> exps = new ArrayList<String>(mn.exceptions);
    if (!exps.contains(CheckInstrumentationVisitor.EXCEPTION_NAME)) {
      exps.add(CheckInstrumentationVisitor.EXCEPTION_NAME);
    }
    String[] expss = MethodDatabase.toStringArray(exps);
    MethodNode mv = new MethodNode(Opcodes.ACC_PUBLIC, buildInitHelpMethodName(mn.desc), "()V", null, expss);
   
    Label invokedInitInsnStart = null;
    Label invokedInitInsnEnd = null;
    Label invokedInitInsnCatchAll = null;
    boolean needWaveInvokedInitInsn = invokedInitInsn != null
        && db.checkMethodSuspendType(invokedInitInsn.owner, ClassEntry.key(invokedInitInsn.name, invokedInitInsn.desc), false) == MethodDatabase.SUSPEND_NORMAL;
    if (needWaveInvokedInitInsn) {
      invokedInitInsnStart = new Label();
      invokedInitInsnEnd = new Label();
      invokedInitInsnCatchAll = new Label();
      mv.visitTryCatchBlock(invokedInitInsnStart, invokedInitInsnEnd, invokedInitInsnCatchAll, null);
    }
   
    for(TryCatchBlockNode tcb : mn.tryCatchBlocks) {
            tcb.accept(mv);
        }
   
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, CSTACK_NAME, "getStack", "()L"+CSTACK_NAME+";");
    mv.visitVarInsn(Opcodes.ASTORE, lvarCStack);
   
    if (needWaveInvokedInitInsn) {
      mv.visitLabel(invokedInitInsnStart);
      mv.visitVarInsn(Opcodes.ALOAD, 0);
      mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, invokedInitInsn.owner, "inch_" + getMD5(invokedInitInsn.desc), "()V");
      mv.visitLabel(invokedInitInsnEnd);
    }
   
    for(int i=firstLocal ; i<f.getLocals() ; i++) {
        BasicValue v = (BasicValue) f.getLocal(i);
        if(!isNullType(v)) {
            int slotIdx = fi.localSlotIndices[i];
            assert slotIdx >= 0 && slotIdx < fi.numSlots;
            emitRestoreValue(mv, v, lvarCStack, slotIdx);
            mv.visitVarInsn(v.getType().getOpcode(Opcodes.ISTORE), i);
        } else if(v != BasicValue.UNINITIALIZED_VALUE) {
            mv.visitInsn(Opcodes.ACONST_NULL);
            mv.visitVarInsn(Opcodes.ASTORE, i);
        }
    }
   
    for(int i=0 ; i<f.getStackSize() ; i++) {
        BasicValue v = (BasicValue) f.getStack(i);
        if(!isOmitted(v)) {
            if(!isNullType(v)) {
                int slotIdx = fi.stackSlotIndices[i];
                assert slotIdx >= 0 && slotIdx < fi.numSlots;
                emitRestoreValue(mv, v, lvarCStack, slotIdx);
            } else {
                mv.visitInsn(Opcodes.ACONST_NULL);
            }
        }
    }
   
    mv.visitVarInsn(Opcodes.ALOAD,lvarCStack);
    emitConst(mv, fi.numSlots);
    mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CSTACK_NAME, "release", "(I)V");
   
    int maxStack = mn.maxStack;
    for (int i = splitPos; i < numIns; i++) {
      AbstractInsnNode insn = mn.instructions.get(i);
      if (insn instanceof MethodInsnNode) {
        MethodInsnNode misn = (MethodInsnNode) insn;
        String name = misn.name;
        if (name.charAt(0) == '<' && name.charAt(1) == 'i' && db != null && db.checkMethodSuspendType(misn.owner, ClassEntry.key(name, misn.desc), false, false) == MethodDatabase.SUSPEND_NORMAL) {
          mv.visitInsn(Opcodes.ACONST_NULL);
          mv.visitMethodInsn(misn.getOpcode(), misn.owner, name, InstrumentConstructorMethod.buildShrinkedInitMethodDesc(misn.desc));
          mv.visitInsn(Opcodes.DUP);
          mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, misn.owner, InstrumentConstructorMethod.buildInitHelpMethodName(misn.desc), "()V");
          maxStack = mn.maxStack + 1;
          continue;
        }
      }
      insn.accept(mv);
    }
   
    if (needWaveInvokedInitInsn) {
      mv.visitLabel(invokedInitInsnCatchAll);
      mv.visitVarInsn(Opcodes.ALOAD,lvarCStack);
      emitConst(mv, fi.numSlots);
      mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, CSTACK_NAME, "release", "(I)V");
      mv.visitInsn(Opcodes.ATHROW);
    }

    if(mn.localVariables != null && !mn.localVariables.isEmpty()) {
      for (int i = 0; i < f.getLocals(); i++) {
        mn.localVariables.get(i).accept(mv);
      }
        }
   
    mv.visitMaxs(maxStack+3, mn.maxLocals+3);
    mv.visitEnd();
   
    InstrumentMethod im = new InstrumentMethod(db, className, mv);
    if(im.collectCodeBlocks()) {
      im.accept(cv.makeOutMV(mv));
    }else {
View Full Code Here

TOP

Related Classes of nginx.clojure.asm.tree.MethodNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.