Tabnine Logo
MethodVisitor.visitLabel
Code IndexAdd Tabnine 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
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, 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, 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, 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, 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_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);// 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.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.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

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JLabel (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now