Example usage for org.objectweb.asm Opcodes ASM5

List of usage examples for org.objectweb.asm Opcodes ASM5

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes ASM5.

Prototype

int ASM5

To view the source code for org.objectweb.asm Opcodes ASM5.

Click Source Link

Usage

From source file:de.tuberlin.uebb.jbop.optimizer.utils.rename.ClassRenamer.java

License:Open Source License

/**
 * Instantiates a new class renamer.//from w w  w. j a  va  2s  .com
 * 
 * @param parent
 *          the parent
 * @param newName
 *          the new name
 */
public ClassRenamer(final ClassWriter parent, final String newName) {
    super(Opcodes.ASM5, parent);
    fixer = new NameFixer(newName);
}

From source file:de.tuberlin.uebb.jbop.optimizer.utils.rename.MethodRenamer.java

License:Open Source License

/**
 * Instantiates a new {@link MethodRenamer}.
 * //w ww  . j  av  a  2 s  . c  om
 * @param parent
 *          the parent
 * @param fixer
 *          the fixer
 */
public MethodRenamer(final MethodVisitor parent, final NameFixer fixer) {
    super(Opcodes.ASM5, parent);
    this.fixer = fixer;
}

From source file:de.unisb.cs.st.javaslicer.tracer.instrumentation.JSRInliner.java

License:Open Source License

public JSRInliner(final ClassVisitor cv) {
    super(Opcodes.ASM5, cv);
}

From source file:de.zib.sfs.instrument.AbstractSfsAdapter.java

License:BSD License

protected <InstrumentedType, CallbackType> AbstractSfsAdapter(ClassVisitor cv,
        Class<InstrumentedType> instrumentedTypeClass, Class<CallbackType> callbackTypeClass,
        String methodPrefix, Set<OperationCategory> skip) {
    super(Opcodes.ASM5, cv);

    this.methodPrefix = methodPrefix;

    this.instrumentedTypeInternalName = Type.getInternalName(instrumentedTypeClass);
    this.callbackTypeInternalName = Type.getInternalName(callbackTypeClass);
    this.callbackTypeDescriptor = Type.getDescriptor(callbackTypeClass);
    try {//from  w w  w .j a v a 2  s . c o m
        this.callbackTypeConstructorDescriptor = Type
                .getConstructorDescriptor(callbackTypeClass.getConstructor(instrumentedTypeClass));
    } catch (Exception e) {
        throw new IllegalArgumentException(
                "Constructor of " + this.callbackTypeInternalName + " is not accessible.", e);
    }

    this.systemInternalName = Type.getInternalName(System.class);
    this.nanoTimeDescriptor = Type.getMethodDescriptor(Type.LONG_TYPE);

    this.skip = skip;
}

From source file:de.zib.sfs.instrument.AbstractSfsAdapter.java

License:BSD License

protected <InstrumentedType> AbstractSfsAdapter(ClassVisitor cv, Class<InstrumentedType> instrumentedTypeClass,
        Set<OperationCategory> skip) {
    super(Opcodes.ASM5, cv);

    this.methodPrefix = null;

    this.instrumentedTypeInternalName = Type.getInternalName(instrumentedTypeClass);
    this.callbackTypeInternalName = null;
    this.callbackTypeDescriptor = null;
    this.callbackTypeConstructorDescriptor = null;

    this.systemInternalName = Type.getInternalName(System.class);
    this.nanoTimeDescriptor = Type.getMethodDescriptor(Type.LONG_TYPE);

    this.skip = skip;
}

From source file:de.zib.sfs.instrument.AbstractSfsAdapter.java

License:BSD License

protected <CallbackType> AbstractSfsAdapter(ClassVisitor cv, String instrumentedTypeInternalName,
        Class<CallbackType> callbackTypeClass, String methodPrefix, Set<OperationCategory> skip) {
    super(Opcodes.ASM5, cv);

    this.methodPrefix = methodPrefix;

    this.instrumentedTypeInternalName = instrumentedTypeInternalName;
    this.callbackTypeInternalName = Type.getInternalName(callbackTypeClass);
    this.callbackTypeDescriptor = Type.getDescriptor(callbackTypeClass);
    try {//w  w w .  j a  v  a2s.  c om
        this.callbackTypeConstructorDescriptor = Type
                .getConstructorDescriptor(callbackTypeClass.getConstructor());
    } catch (Exception e) {
        throw new IllegalArgumentException(
                "No-arg constructor of " + this.callbackTypeInternalName + " is not accessible.", e);
    }

    this.systemInternalName = Type.getInternalName(System.class);
    this.nanoTimeDescriptor = Type.getMethodDescriptor(Type.LONG_TYPE);

    this.skip = skip;
}

From source file:de.zib.sfs.instrument.ShutdownAdapter.java

License:BSD License

public ShutdownAdapter(ClassVisitor cv) {
    super(Opcodes.ASM5, cv);
}

From source file:de.zib.sfs.instrument.ZipFileAdapter.java

License:BSD License

protected ZipFileAdapter(ClassVisitor cv, String methodPrefix, Set<OperationCategory> skip) {
    super(Opcodes.ASM5, cv);

    this.methodPrefix = methodPrefix;

    Constructor<ZipFile> constructor;
    try {//  w  ww  . j a  va2 s  .c o  m
        constructor = ZipFile.class.getConstructor(File.class, Integer.TYPE, Charset.class);
        this.constructorDescriptor = Type.getConstructorDescriptor(constructor);
    } catch (Exception e) {
        throw new RuntimeException("Could not access constructor", e);
    }

    this.skip = skip;
}

From source file:edu.illinois.nondex.instr.ClassVisitorShufflingAdder.java

License:Open Source License

public ClassVisitorShufflingAdder(ClassVisitor ca) {
    super(Opcodes.ASM5, ca);
}

From source file:edu.illinois.nondex.instr.ClassVisitorShufflingAdder.java

License:Open Source License

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {

    final String methodId = this.cn + "." + name;

    if (apisReturningShufflableArrays.contains(methodId)) {

        return new MethodVisitor(Opcodes.ASM5, super.visitMethod(access, name, desc, signature, exceptions)) {

            @Override/*from   ww  w  .j  ava 2 s. c  o  m*/
            public void visitInsn(int opcode) {
                if (opcode == Opcodes.ARETURN
                        && "java/text/DateFormatSymbols.getZoneStrings".equals(methodId)) {
                    this.visitMethodInsn(Opcodes.INVOKESTATIC,
                            "edu/illinois/nondex/shuffling/ControlNondeterminism", "extendZoneStrings",
                            "([[Ljava/lang/String;)[[Ljava/lang/String;", false);
                } else if (opcode == Opcodes.ARETURN) {
                    shuffleJustReturnedArray();
                }
                super.visitInsn(opcode);
            }

            private void shuffleJustReturnedArray() {
                this.visitMethodInsn(Opcodes.INVOKESTATIC,
                        "edu/illinois/nondex/shuffling/ControlNondeterminism", "shuffle",
                        "([Ljava/lang/Object;)[Ljava/lang/Object;", false);
            }
        };
    } else {
        return super.visitMethod(access, name, desc, signature, exceptions);
    }
}