org.dellroad.jc.cgen.escape
Class KnownSizeDetector
java.lang.Object
soot.jimple.AbstractJimpleValueSwitch
org.dellroad.jc.cgen.escape.KnownSizeDetector
- All Implemented Interfaces:
- ConstantSwitch, ExprSwitch, JimpleValueSwitch, RefSwitch, Switch
- public class KnownSizeDetector
- extends AbstractJimpleValueSwitch
Instances of this class detect 'new' expressions with a known
instance size. The result is an Integer
with the
estimated size, or null
if the type of the 'new'
expression does not have a fixed size (or the value is not
some kind of 'new' expression).
Methods inherited from class soot.jimple.AbstractJimpleValueSwitch |
caseAddExpr, caseAndExpr, caseArrayRef, caseCastExpr, caseCaughtExceptionRef, caseCmpExpr, caseCmpgExpr, caseCmplExpr, caseDivExpr, caseDoubleConstant, caseEqExpr, caseFloatConstant, caseGeExpr, caseGtExpr, caseInstanceFieldRef, caseInstanceOfExpr, caseIntConstant, caseInterfaceInvokeExpr, caseLeExpr, caseLengthExpr, caseLocal, caseLongConstant, caseLtExpr, caseMulExpr, caseNeExpr, caseNegExpr, caseNullConstant, caseOrExpr, caseParameterRef, caseRemExpr, caseShlExpr, caseShrExpr, caseSpecialInvokeExpr, caseStaticFieldRef, caseStaticInvokeExpr, caseStringConstant, caseSubExpr, caseThisRef, caseUshrExpr, caseVirtualInvokeExpr, caseXorExpr, getResult, setResult |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REFERENCE_SIZE
public static final int REFERENCE_SIZE
- See Also:
- Constant Field Values
OBJECT_HEADER_SIZE
public static final int OBJECT_HEADER_SIZE
- See Also:
- Constant Field Values
KnownSizeDetector
public KnownSizeDetector()
caseNewExpr
public void caseNewExpr(NewExpr v)
caseNewArrayExpr
public void caseNewArrayExpr(NewArrayExpr v)
caseNewMultiArrayExpr
public void caseNewMultiArrayExpr(NewMultiArrayExpr v)
defaultCase
public void defaultCase(Object obj)
size
public static int size(Type type)
- Return our best guess of the size of an instance of the given type,
in bytes. We include
OBJECT_HEADER_SIZE
for object overhead, but don't include any gaps for alignment.
- Parameters:
type
- a primitive type, or a non-interface, non-array
reference type.
- Throws:
IllegalArgumentException
- if type