List of usage examples for org.objectweb.asm.commons CodeSizeEvaluator CodeSizeEvaluator
public CodeSizeEvaluator(final MethodVisitor methodVisitor)
From source file:br.usp.each.saeg.badua.core.internal.instr.MethodInstrumenter.java
License:Open Source License
@Override public void visitEnd() { if (next == null) return;// w w w . ja v a 2 s.c om final MethodNode original = new MethodNode(api, access, name, desc, signature, exceptions); final CodeSizeEvaluator sizeEval = new CodeSizeEvaluator(null); // 1. create a copy of the unmodified MethodNode accept(original); // 2. transform transform(); // 3. evaluate new size accept(sizeEval); // size is fine (lower than 65535 bytes) if (sizeEval.getMaxSize() < 0xFFFF) accept(next); // size overflow else { sizeOverflow(); original.accept(next); } }
From source file:com.github.malamut2.low.VerifyingClassAdapter.java
License:Apache License
/** * {@inheritDoc}/*from ww w . j a va 2 s. c o m*/ * * In addition, the returned {@link org.objectweb.asm.MethodVisitor} * will throw an exception if the method is greater than 64K in length. */ @Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); return new CodeSizeEvaluator(mv) { @Override public void visitEnd() { super.visitEnd(); if (getMaxSize() > 64 * 1024) { state = State.FAIL_TOO_LONG; message = "the method " + name + " was too long."; } } }; }
From source file:com.google.monitoring.runtime.instrumentation.adapters.VerifyingClassAdapter.java
License:Apache License
/** * {@inheritDoc}//from w w w . java 2 s . c o m * <p> * In addition, the returned {@link org.objectweb.asm.MethodVisitor} * will throw an exception if the method is greater than 64K in length. */ @Override public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); return new CodeSizeEvaluator(mv) { @Override public void visitEnd() { super.visitEnd(); if (getMaxSize() > 64 * 1024) { state = State.FAIL_TOO_LONG; message = "the method " + name + " was too long."; } } }; }
From source file:de.tuberlin.uebb.jbop.optimizer.methodsplitter.Block.java
License:Open Source License
/** * Clears this block./* w ww .j a v a2 s. c o m*/ */ void clear() { readers.clear(); writers.clear(); parameters.clear(); insns.clear(); varMap.clear(); pushParameters.clear(); sizeEvaluator = new CodeSizeEvaluator(null); }
From source file:de.tuberlin.uebb.jbop.optimizer.methodsplitter.MethodSplitter.java
License:Open Source License
private int getLength(final MethodNode methodNode) { final CodeSizeEvaluator codeSizeEvaluator = new CodeSizeEvaluator(null); methodNode.accept(codeSizeEvaluator); return codeSizeEvaluator.getMaxSize(); }