Пример #1
0
 /**
  * Compares the instrumentation level interval against the runtime value.
  *
  * <p>If the runtime value is fitting the level interval there will be 0 on stack upon return from
  * this method. Otherwise there will be -1.
  *
  * @param clsName The probe class name
  * @param level The probe instrumentation level
  * @return itself
  */
 public Assembler compareLevel(String clsName, Level level) {
   Interval itv = level.getValue();
   if (itv.getA() <= 0) {
     if (itv.getB() != Integer.MAX_VALUE) {
       ldc(itv.getB());
       getStatic(clsName, "$btrace$$level", Type.INT_TYPE.getDescriptor());
       sub(Type.INT_TYPE);
     }
   } else if (itv.getA() < itv.getB()) {
     if (itv.getB() == Integer.MAX_VALUE) {
       getStatic(clsName, "$btrace$$level", Type.INT_TYPE.getDescriptor());
       ldc(itv.getA());
       sub(Type.INT_TYPE);
     } else {
       Label l1 = new Label();
       Label l2 = new Label();
       ldc(itv.getA());
       jump(Opcodes.IF_ICMPLT, l1);
       getStatic(clsName, "$btrace$$level", Type.INT_TYPE.getDescriptor());
       ldc(itv.getB());
       jump(Opcodes.IF_ICMPGT, l1);
       ldc(0);
       jump(Opcodes.GOTO, l2);
       label(l1);
       ldc(-1);
       label(l2);
     }
   }
   return this;
 }
Пример #2
0
 public Assembler addLevelCheck(String clsName, Level level, Label jmp) {
   return addLevelCheck(clsName, level.getValue(), jmp);
 }