Java 类org.objectweb.asm.commons.CodeSizeEvaluator 实例源码

项目:allocation-instrumenter    文件:VerifyingClassAdapter.java   
/**
 * {@inheritDoc}
 * 
 * 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.";
      }
    }
  };
}
项目:salta    文件:MethodCompilationContext.java   
public CodeSizeHelper getCodeSizeHelper() {
    ClassNode node = new ClassNode();
    node.name = getClassCtx().getClazz().name;
    ClassCompilationContext ccc = new ClassCompilationContext(node, true, classCtx.getCompiler());
    CodeSizeEvaluator cse = new CodeSizeEvaluator(null);
    MethodCompilationContext mcc = new MethodCompilationContext(ccc,
            new GeneratorAdapter(cse, access, "method", desc), access, desc);
    CodeSizeHelper helper = new CodeSizeHelper();
    helper.ctx = mcc;
    helper.cse = cse;
    return helper;
}
项目:jBOP    文件:Block.java   
/**
 * Clears this block.
 */
void clear() {
  readers.clear();
  writers.clear();
  parameters.clear();
  insns.clear();
  varMap.clear();
  pushParameters.clear();
  sizeEvaluator = new CodeSizeEvaluator(null);
}
项目:jBOP    文件:MethodSplitter.java   
private int getLength(final MethodNode methodNode) {
  final CodeSizeEvaluator codeSizeEvaluator = new CodeSizeEvaluator(null);
  methodNode.accept(codeSizeEvaluator);
  return codeSizeEvaluator.getMaxSize();
}