org.objectweb.asm.commons.CodeSizeEvaluator Java Examples
The following examples show how to use
org.objectweb.asm.commons.CodeSizeEvaluator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VerifyingClassAdapter.java From allocation-instrumenter with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} * * <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) { 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."; } } }; }
Example #2
Source File: MethodWrapper.java From radon with GNU General Public License v3.0 | 4 votes |
/** * @return computes and returns the size of the wrapped {@link MethodNode}. */ public int getCodeSize() { CodeSizeEvaluator cse = new CodeSizeEvaluator(null); methodNode.accept(cse); return cse.getMaxSize(); }