public class BafASMBackend extends AbstractASMBackend
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<Unit,org.objectweb.asm.Label> |
branchTargetLabels |
protected java.util.Map<Local,java.lang.Integer> |
localToSlot |
cv, javaVersion, sc
Constructor and Description |
---|
BafASMBackend(SootClass sc,
int javaVersion)
Creates a new BafASMBackend with a given enforced java version
|
Modifier and Type | Method and Description |
---|---|
protected void |
generateInstruction(org.objectweb.asm.MethodVisitor mv,
Inst inst)
Emits the bytecode for a single Baf instruction
|
protected void |
generateMethodBody(org.objectweb.asm.MethodVisitor mv,
SootMethod method)
Emits the bytecode for the body of a single method
Has to be implemented by subclasses to suit their needs
|
protected org.objectweb.asm.Label |
getBranchTargetLabel(Unit target)
Returns the ASM Label for a given Unit that is the target of a branch or
jump
|
protected int |
getMinJavaVersion(SootMethod method)
Determines the minimum Java version required for the bytecode of the given SootMethod
Subclasses should override this method to suit their needs, otherwise Java 1.7 is assumed for compatibility with invokeDynamic
|
generateAnnotationElems, generateAnnotations, generateAttributes, generateAttributes, generateAttributes, generateByteCode, generateClassFile, generateClassHeader, generateFields, generateInnerClassReferences, generateMethods, generateOuterClassReference, generateTextualRepresentation, getBafBody, getModifiers
protected final java.util.Map<Unit,org.objectweb.asm.Label> branchTargetLabels
protected final java.util.Map<Local,java.lang.Integer> localToSlot
public BafASMBackend(SootClass sc, int javaVersion)
sc
- The SootClass the bytecode is to be generated forjavaVersion
- A particular Java version enforced by the user, may be 0 for
automatic detection, must not be lower than necessary for all
features usedprotected org.objectweb.asm.Label getBranchTargetLabel(Unit target)
target
- The unit that is the branch targetprotected int getMinJavaVersion(SootMethod method)
AbstractASMBackend
getMinJavaVersion
in class AbstractASMBackend
method
- The SootMethod the minimum Java version is to be determined forprotected void generateMethodBody(org.objectweb.asm.MethodVisitor mv, SootMethod method)
AbstractASMBackend
generateMethodBody
in class AbstractASMBackend
mv
- The MethodVisitor to emit the bytecode tomethod
- The SootMethod the bytecode is to be emitted forprotected void generateInstruction(org.objectweb.asm.MethodVisitor mv, Inst inst)
mv
- The ASM MethodVisitor the bytecode is to be emitted toinst
- The Baf instruction to be converted into bytecode