Package org.objectweb.asm.util

Examples of org.objectweb.asm.util.TraceMethodVisitor


    mv.visitEnd();
    checkMethod(tmv);
  }

  protected void checkMethod(TraceMethodVisitor tmv) {
    TraceMethodVisitor mv = new TraceMethodVisitor(null);
    mv.visitCode();
    mv.visitVarInsn(ILOAD, 1);
    Label label = new Label();
    mv.visitJumpInsn(IFLT, label);
    mv.visitVarInsn(ALOAD, 0);
    mv.visitVarInsn(ILOAD, 1);
    mv.visitFieldInsn(PUTFIELD, "pkg/Bean", "f", "I");
    mv.visitInsn(RETURN);
    mv.visitLabel(label);
    mv.visitFrame(F_SAME, 0, null, 0, null);
    mv.visitTypeInsn(NEW, "java/lang/IllegalArgumentException");
    mv.visitInsn(DUP);
    mv.visitMethodInsn(INVOKESPECIAL,
        "java/lang/IllegalArgumentException", "<init>", "()V");
    mv.visitInsn(ATHROW);
    mv.visitLabel(new Label());
    mv.visitMaxs(2, 2);
    mv.visitEnd();
    assertEquals(mv, tmv);
  }
View Full Code Here


*/
public class RemoveLoadStoreTransformerTest extends
    RemoveLoadStoreAdapterTest {

  public void test() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    MethodNode mn = new MethodNode(0, null, null, null, null);
    mn.visitCode();
    mn.visitVarInsn(ILOAD, 1);
    mn.visitVarInsn(ISTORE, 1);
    mn.visitVarInsn(ILOAD, 1);
View Full Code Here

* @author Eric Bruneton
*/
public class OptimizeJumpTransformerTest extends AbstractTestCase {

  public void test() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    MethodNode mn = new MethodNode(0, null, null, null, null);
    mn.visitCode();
    mn.visitVarInsn(ILOAD, 1);
    Label label = new Label();
    mn.visitJumpInsn(IFLT, label);
View Full Code Here

    mn.accept(tmv);
    checkMethod(tmv);
  }

  protected void checkMethod(TraceMethodVisitor tmv) {
    TraceMethodVisitor mv = new TraceMethodVisitor(null);
    mv.visitCode();
    mv.visitVarInsn(ILOAD, 1);
    Label label = new Label();
    mv.visitJumpInsn(IFLT, label);
    mv.visitVarInsn(ALOAD, 0);
    mv.visitVarInsn(ILOAD, 1);
    mv.visitFieldInsn(PUTFIELD, "pkg/Bean", "f", "I");
    Label end = new Label();
    mv.visitInsn(RETURN);
    mv.visitLabel(label);
    mv.visitFrame(F_SAME, 0, null, 0, null);
    mv.visitTypeInsn(NEW, "java/lang/IllegalArgumentException");
    mv.visitInsn(DUP);
    mv.visitMethodInsn(INVOKESPECIAL,
        "java/lang/IllegalArgumentException", "<init>", "()V");
    mv.visitInsn(ATHROW);
    mv.visitLabel(end);
    mv.visitFrame(F_SAME, 0, null, 0, null);
    mv.visitInsn(RETURN);
    mv.visitMaxs(0, 0);
    mv.visitEnd();
    assertEquals(mv, tmv);
  }
View Full Code Here

*/
public class RemoveGetFieldPutFieldTransformerTest extends
    RemoveGetFieldPutFieldAdapterTest {

  public void test() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    MethodNode mn = new MethodNode(0, null, null, null, null);
    mn.visitCode();
    mn.visitVarInsn(ALOAD, 0);
    mn.visitVarInsn(ALOAD, 0);
    mn.visitVarInsn(ALOAD, 0);
View Full Code Here

* @author Eric Bruneton
*/
public class BasicVerifierAdapterTest extends AbstractTestCase {

  public void test() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    MethodVisitor mv = new BasicVerifierAdapter("C", ACC_PUBLIC, "m",
        "(I)I", tmv);
    mv.visitCode();
    mv.visitVarInsn(ILOAD, 1);
    mv.visitInsn(ICONST_0);
View Full Code Here

    mv.visitMaxs(2, 2);
    mv.visitEnd();
  }

  public void testError() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    MethodVisitor mv = new BasicVerifierAdapter("C", ACC_PUBLIC, "m",
        "(I)LC;", tmv);
    mv.visitCode();
    mv.visitVarInsn(ILOAD, 1);
    mv.visitVarInsn(ISTORE, 1);
View Full Code Here

* @author Eric Bruneton
*/
public class RemoveUnusedCastAdapterTest extends AbstractTestCase {

  public void test() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    RemoveUnusedCastAdapter rc = new RemoveUnusedCastAdapter(tmv);
    AnalyzerAdapter aa = new AnalyzerAdapter("C", ACC_PUBLIC, "m",
        "(Ljava/lang/Integer;)I", rc);
    rc.aa = aa;
    aa.visitCode();
View Full Code Here

    aa.visitEnd();
    checkMethod(tmv);
  }

  protected void checkMethod(TraceMethodVisitor tmv) {
    TraceMethodVisitor mv = new TraceMethodVisitor(null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 1);
    mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Number", "intValue",
        "()I");
    mv.visitInsn(IRETURN);
    mv.visitMaxs(1, 2);
    mv.visitEnd();
    assertEquals(mv, tmv);
  }
View Full Code Here

*/
public class RemoveUnusedCastTransformerTest extends
    RemoveUnusedCastAdapterTest {

  public void test() {
    TraceMethodVisitor tmv = new TraceMethodVisitor(null);
    MethodNode mn = new MethodNode(ACC_PUBLIC, "m",
        "(Ljava/lang/Integer;)I", null, null);
    mn.visitCode();
    mn.visitVarInsn(ALOAD, 1);
    mn.visitTypeInsn(CHECKCAST, "java/lang/Number");
View Full Code Here

TOP

Related Classes of org.objectweb.asm.util.TraceMethodVisitor

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.