Codota Logo
MethodVisitor.visitLabel
Code IndexAdd Codota to your IDE (free)

How to use
visitLabel
method
in
org.objectweb.asm.MethodVisitor

Best Java code snippets using org.objectweb.asm.MethodVisitor.visitLabel (Showing top 20 results out of 1,332)

Refine searchRefine arrow

  • MethodVisitor.visitInsn
  • Label.<init>
  • MethodVisitor.visitVarInsn
  • MethodVisitor.visitMaxs
  • MethodVisitor.visitEnd
  • MethodVisitor.visitCode
  • Common ways to obtain MethodVisitor
private void myMethod () {
MethodVisitor m =
  • Codota IconClassVisitor zuper;zuper.visitMethod(access, name, desc, signature, exceptions)
  • Codota IconClassVisitor cv;String name;String desc;String signature;String[] exceptions;cv.visitMethod(access, name, desc, signature, exceptions)
  • Codota IconClassVisitor cv;cv.visitMethod(access, "<init>", "()V", null, null)
  • Smart code suggestions by Codota
}
origin: pxb1988/dex2jar

private void genSwitchMethod(ClassVisitor cw, String typeName, String methodName, CB callback) {
  MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, methodName, "()Ljava/lang/String;", null, null);
  mv.visitCode();
  mv.visitVarInsn(ALOAD, 0);
  mv.visitFieldInsn(GETFIELD, typeName, "idx", "I");
  Label def = new Label();
  Label[] labels = new Label[callbacks.size()];
    Label label = strMap.get(key);
    if (label == null) {
      label = new Label();
      strMap.put(key, label);
    mv.visitLabel(e.getValue());
    mv.visitLdcInsn(e.getKey());
    mv.visitInsn(ARETURN);
  mv.visitLabel(def);
  mv.visitTypeInsn(NEW, "java/lang/RuntimeException");
  mv.visitInsn(DUP);
  mv.visitLdcInsn("invalid idx");
  mv.visitMethodInsn(INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V");
  mv.visitInsn(ATHROW);
  mv.visitMaxs(-1, -1);
  mv.visitEnd();
origin: Sable/soot

/**
 * Writes out the information stored in tags associated with the given unit
 * 
 * @param mv
 *          The method visitor for writing out the bytecode
 * @param u
 *          The unit for which to write out the tags
 */
protected void generateTagsForUnit(MethodVisitor mv, Unit u) {
 if (u.hasTag("LineNumberTag")) {
  LineNumberTag lnt = (LineNumberTag) u.getTag("LineNumberTag");
  Label l;
  if (branchTargetLabels.containsKey(u)) {
   l = branchTargetLabels.get(u);
  } else {
   l = new Label();
   mv.visitLabel(l);
  }
  mv.visitLineNumber(lnt.getLineNumber(), l);
 }
}
origin: pxb1988/dex2jar

LabelStmt labelStmt = (LabelStmt) st;
Label label = (Label) labelStmt.tag;
asm.visitLabel(label);
if (labelStmt.lineNumber >= 0) {
  asm.visitLineNumber(labelStmt.lineNumber, label);
    String arrayElementType = tp1.substring(1);
    insertI2x(v2.valueType, arrayElementType, asm);
    asm.visitInsn(getOpcode(arrayElementType, IASTORE));
  int index = ((Local) e2.op1)._ls_index;
  if (index >= 0) {
    asm.visitVarInsn(ASTORE, index);
    asm.visitVarInsn(getOpcode(v, ISTORE), nIndex);
    lockMap.put(key, nIndex);
origin: org.ow2.asm/asm

  case Constants.MONITORENTER:
  case Constants.MONITOREXIT:
   methodVisitor.visitInsn(opcode);
   currentOffset += 1;
   break;
  case Constants.ALOAD_3:
   opcode -= Constants.ILOAD_0;
   methodVisitor.visitVarInsn(Opcodes.ILOAD + (opcode >> 2), opcode & 0x3);
   currentOffset += 1;
   break;
  case Constants.ASTORE_3:
   opcode -= Constants.ISTORE_0;
   methodVisitor.visitVarInsn(Opcodes.ISTORE + (opcode >> 2), opcode & 0x3);
   currentOffset += 1;
   break;
    currentOffset += 6;
   } else {
    methodVisitor.visitVarInsn(opcode, readUnsignedShort(currentOffset + 2));
    currentOffset += 4;
 methodVisitor.visitLabel(labels[codeLength]);
methodVisitor.visitMaxs(maxStack, maxLocals);
origin: EvoSuite/evosuite

@Override
public void visitCode() {
  super.visitCode();
  if (methodName.equals("<clinit>")) {
    startingTryLabel = new Label();
    endingTryLabel = new Label();
    super.visitLabel(startingTryLabel);
  }
}
origin: glowroot/glowroot

@Override
protected void onMethodEnter() {
  // these classes can be initialized inside of ClassFileTransformer.transform(), via
  // Resources.toByteArray(url) inside of AnalyzedWorld.createAnalyzedClass()
  // because jboss registers org.jboss.net.protocol.URLStreamHandlerFactory to handle
  // "file" and "resource" URLs
  //
  // these classes can not be initialized in PreInitializeWeavingClasses since they are
  // not accessible from the bootstrap or system class loader, and thus, this hack
  Label l0 = new Label();
  Label l1 = new Label();
  Label l2 = new Label();
  mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Throwable");
  mv.visitLabel(l0);
  visitClassForName("org.jboss.net.protocol.file.Handler");
  visitClassForName("org.jboss.net.protocol.file.FileURLConnection");
  visitClassForName("org.jboss.net.protocol.resource.Handler");
  visitClassForName("org.jboss.net.protocol.resource.ResourceURLConnection");
  mv.visitLabel(l1);
  Label l3 = new Label();
  mv.visitJumpInsn(GOTO, l3);
  mv.visitLabel(l2);
  if (logger.isDebugEnabled()) {
    mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Throwable", "printStackTrace", "()V",
        false);
  } else {
    mv.visitInsn(POP);
  }
  mv.visitLabel(l3);
}
origin: scouter-project/scouter

@Override
public void visitMaxs(int maxStack, int maxLocals) {
  Label endFinally = new Label();
  mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
  mv.visitLabel(endFinally);
  mv.visitInsn(DUP);
  int errIdx = newLocal(Type.getType(Throwable.class));
  mv.visitVarInsn(Opcodes.ASTORE, errIdx);
  mv.visitVarInsn(Opcodes.ALOAD, statIdx);
  mv.visitVarInsn(Opcodes.ALOAD, errIdx);
  mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_MAIN, END_METHOD, END_SIGNATURE, false);
  mv.visitInsn(ATHROW);
  mv.visitMaxs(maxStack + 8, maxLocals + 2);
}
origin: EvoSuite/evosuite

@Override
public void visitCode() {
  super.visitCode();
  if (methodName.equals("<clinit>")) {
    startingTryLabel = new Label();
    endingTryLabel = new Label();
    super.visitLabel(startingTryLabel);
  }
}
origin: Sable/soot

Unit u = box.getUnit();
if (!branchTargetLabels.containsKey(u)) {
 branchTargetLabels.put(u, new Label());
startLabel = new Label();
mv.visitLabel(startLabel);
 mv.visitLabel(branchTargetLabels.get(u));
Label endLabel = new Label();
mv.visitLabel(endLabel);
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: hcoles/pitest

@Test
public void shouldForwardVisitLabelToChild() {
 final Label l = new Label();
 getTesteeVisitor().visitLabel(l);
 verify(this.mv).visitLabel(l);
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_SQL, END_METHOD, END_SIGNATURE2, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEAPICALL, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);
    mv.visitVarInsn(Opcodes.ALOAD, strArgIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_SQL, CONNECT_METHOD, ERR_SIGNATURE,false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_KAFKA, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACE_RABBIT, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);
    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitInsn(Opcodes.ACONST_NULL);// return
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, END_METHOD, END_SIGNATURE,false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);
    mv.visitVarInsn(Opcodes.ALOAD, statIdx);// stat
    mv.visitInsn(Opcodes.ACONST_NULL);// return
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);// throwable
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACESUBCALL, END_METHOD, END_SIGNATURE, false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
origin: scouter-project/scouter

  @Override
  public void visitMaxs(int maxStack, int maxLocals) {
    Label endFinally = new Label();
    mv.visitTryCatchBlock(startFinally, endFinally, endFinally, null);
    mv.visitLabel(endFinally);
    mv.visitInsn(DUP);
    int errIdx = newLocal(Type.getType(Throwable.class));
    mv.visitVarInsn(Opcodes.ASTORE, errIdx);

    mv.visitInsn(Opcodes.ACONST_NULL);// return
    mv.visitVarInsn(Opcodes.ALOAD, statIdx);
    mv.visitVarInsn(Opcodes.ALOAD, errIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TARGET, END_METHOD, END_METHOD_DESC,false);
    mv.visitInsn(ATHROW);
    mv.visitMaxs(maxStack + 8, maxLocals + 2);
  }
}
org.objectweb.asmMethodVisitorvisitLabel

Javadoc

Visits a label. A label designates the instruction that will be visited just after it.

Popular methods of MethodVisitor

  • visitMethodInsn
    Visits a method instruction. A method instruction is an instruction that invokes a method.
  • visitInsn
    Visits a zero operand instruction.
  • visitVarInsn
    Visits a local variable instruction. A local variable instruction is an instruction that loads or st
  • visitMaxs
    Visits the maximum stack size and the maximum number of local variables of the method.
  • visitEnd
    Visits the end of the method. This method, which is the last one to be called, is used to inform the
  • visitCode
    Starts the visit of the method's code, if any (i.e. non abstract method).
  • visitFieldInsn
    Visits a field instruction. A field instruction is an instruction that loads or stores the value of
  • visitTypeInsn
    Visits a type instruction. A type instruction is an instruction that takes the internal name of a cl
  • visitLdcInsn
    Visits a LDC instruction. Note that new constant types may be added in future versions of the Java V
  • visitJumpInsn
    Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction
  • visitIntInsn
    Visits an instruction with a single int operand.
  • visitLocalVariable
    Visits a local variable declaration.
  • visitIntInsn,
  • visitLocalVariable,
  • visitAnnotation,
  • visitTryCatchBlock,
  • visitLineNumber,
  • visitFrame,
  • visitTableSwitchInsn,
  • visitParameterAnnotation,
  • visitIincInsn

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JComboBox (javax.swing)
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now