Example #1
0
 @Override
 public void visitFrame(int arg0, int arg1, Object[] arg2, int arg3, Object[] arg4) {
   if (removingMethodBody()) {
     return;
   }
   super.visitFrame(arg0, arg1, arg2, arg3, arg4);
 }
 public void visitMethodInsn(int opcode, String owner, String name, String desc) {
   // 调用父类的构造函数时
   if (opcode == Opcodes.INVOKESPECIAL && name.equals("<init>")) {
     owner = superClassName;
   }
   super.visitMethodInsn(opcode, owner, name, desc); // 改写父类为 superClassName
 }
 @Override
 public void visitInsn(final int opcode) {
   if (opcode == Opcodes.DUP) {
     machine.gotDup();
     if (machine.skipInstruction()) return;
   }
   super.visitInsn(opcode);
 }
Example #4
0
 @Override
 public void visitAttribute(Attribute attr) {
   if (removingMethodBody()) {
     return;
   }
   instrumentationStatsRecord.addInstruction();
   super.visitAttribute(attr);
 }
Example #5
0
 @Override
 public void visitIincInsn(int var, int increment) {
   if (removingMethodBody()) {
     return;
   }
   instrumentationStatsRecord.addInstruction();
   super.visitIincInsn(var, increment);
 }
Example #6
0
 @Override
 public void visitLdcInsn(Object arg0) {
   if (removingMethodBody()) {
     return;
   }
   instrumentationStatsRecord.addInstruction();
   super.visitLdcInsn(arg0);
 }
Example #7
0
 @Override
 public void visitFieldInsn(int opcode, String owner, String name, String desc) {
   if (removingMethodBody()) {
     return;
   }
   instrumentationStatsRecord.addInstruction();
   super.visitFieldInsn(opcode, owner, name, desc);
 }
Example #8
0
 @Override
 public void visitTableSwitchInsn(int arg0, int arg1, Label arg2, Label[] arg3) {
   if (removingMethodBody()) {
     return;
   }
   instrumentationStatsRecord.addInstruction();
   super.visitTableSwitchInsn(arg0, arg1, arg2, arg3);
 }
Example #9
0
 @Override
 public void visitTypeInsn(int arg0, String arg1) {
   if (removingMethodBody()) {
     return;
   }
   instrumentationStatsRecord.addInstruction();
   super.visitTypeInsn(arg0, arg1);
 }
Example #10
0
 @Override
 public void visitVarInsn(int opcode, int var) {
   if (removingMethodBody()) {
     return;
   }
   instrumentationStatsRecord.addInstruction();
   super.visitVarInsn(opcode, var);
 }
 @Override
 public void visitFieldInsn(
     final int opcode, final String owner, final String name, final String desc) {
   if (opcode == Opcodes.PUTSTATIC) {
     machine.gotPutStatic(owner);
     if (machine.skipInstruction()) return;
   }
   super.visitFieldInsn(opcode, owner, name, desc);
 }
 @Override
 public void visitTypeInsn(final int opcode, final String desc) {
   System.out.println(desc);
   if (opcode == Opcodes.NEW) {
     machine.gotNew(desc);
     if (machine.skipInstruction()) return;
   }
   super.visitTypeInsn(opcode, desc);
 }
 @Override
 public void visitMethodInsn(
     final int opcode, final String owner, final String name, final String desc) {
   if (opcode == Opcodes.INVOKESPECIAL) {
     machine.gotInvokeSpecial(owner);
     if (machine.skipInstruction()) return;
   }
   super.visitMethodInsn(opcode, owner, name, desc);
 }
Example #14
0
 /** * Parse the local variables */
 @Override
 public void visitLocalVariable(
     String name, String desc, String signature, Label start, Label end, int index) {
   if (removingMethodBody()) {
     return;
   }
   instrumentationStatsRecord.addInstruction();
   super.visitLocalVariable(name, desc, signature, start, end, index);
 }
 public void visitInsn(final int opcode) {
   if (opcode == RETURN) {
     for (Iterator i4 = m_mixinFields.values().iterator(); i4.hasNext(); ) {
       MixinFieldInfo fieldInfo = (MixinFieldInfo) i4.next();
       if (!fieldInfo.isStatic) {
         initializeMemberMixinField(mv, fieldInfo);
       }
     }
   }
   super.visitInsn(opcode);
 }
Example #16
0
  @Override
  public void visitLabel(Label arg0) {
    if (removingMethodBody()) {
      return;
    }

    if (allStartingTryCatchingBlockLabels != null
        && allStartingTryCatchingBlockLabels.contains(arg0)) {
      ++tryCatchDepth;
    } else if (allEndingTryCatchingBlockLabels != null
        && allEndingTryCatchingBlockLabels.contains(arg0)) {
      --tryCatchDepth;
    }
    super.visitLabel(arg0);
  }
 @Override
 public void visitIntInsn(final int opcode, final int operand) {
   machine.gotSomethingWrong();
   super.visitIntInsn(opcode, operand);
 }
 @Override
 public void visitJumpInsn(final int opcode, final Label label) {
   machine.gotSomethingWrong();
   super.visitJumpInsn(opcode, label);
 }
 @Override
 public void visitLdcInsn(final Object cst) {
   machine.gotSomethingWrong();
   super.visitLdcInsn(cst);
 }
 @Override
 public void visitIincInsn(final int var, final int increment) {
   machine.gotSomethingWrong();
   super.visitIincInsn(var, increment);
 }
 @Override
 public void visitTableSwitchInsn(
     final int min, final int max, final Label dflt, final Label[] labels) {
   machine.gotSomethingWrong();
   super.visitTableSwitchInsn(min, max, dflt, labels);
 }
 @Override
 public void visitLookupSwitchInsn(final Label dflt, final int[] keys, final Label[] labels) {
   machine.gotSomethingWrong();
   super.visitLookupSwitchInsn(dflt, keys, labels);
 }
 @Override
 public void visitMultiANewArrayInsn(final String desc, final int dims) {
   machine.gotSomethingWrong();
   super.visitMultiANewArrayInsn(desc, dims);
 }
 @Override
 public void visitVarInsn(final int opcode, final int var) {
   machine.gotSomethingWrong();
   super.visitVarInsn(opcode, var);
 }