Package soot.baf
Class BafASMBackend
- java.lang.Object
-
- soot.AbstractASMBackend
-
- soot.baf.BafASMBackend
-
public class BafASMBackend extends AbstractASMBackend
Concrete ASM based bytecode generation backend for the BAF intermediate representation- Author:
- Tobias Hamann, Florian Kuebler, Dominik Helm, Lukas Sommer, Alex Bertram, Andreas Dann
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Unit,org.objectweb.asm.Label>branchTargetLabelsprotected Map<Local,Integer>localToSlot-
Fields inherited from class soot.AbstractASMBackend
cv, javaVersion, sc
-
-
Constructor Summary
Constructors Constructor Description BafASMBackend(SootClass sc, int javaVersion)Creates a new BafASMBackend with a given enforced java version
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidgenerateInstruction(org.objectweb.asm.MethodVisitor mv, Inst inst)Emits the bytecode for a single Baf instructionprotected voidgenerateMethodBody(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 needsprotected voidgenerateTagsForUnit(org.objectweb.asm.MethodVisitor mv, Unit u)Writes out the information stored in tags associated with the given unitprotected org.objectweb.asm.LabelgetBranchTargetLabel(Unit target)Returns the ASM Label for a given Unit that is the target of a branch or jumpprotected intgetMinJavaVersion(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-
Methods inherited from class soot.AbstractASMBackend
generateAnnotationElems, generateAnnotations, generateAttributes, generateAttributes, generateAttributes, generateByteCode, generateClassFile, generateClassHeader, generateFields, generateInnerClassReferences, generateMethods, generateOuterClassReference, generateTextualRepresentation, getBafBody, getModifiers, writeInnerClassTags
-
-
-
-
Constructor Detail
-
BafASMBackend
public BafASMBackend(SootClass sc, int javaVersion)
Creates a new BafASMBackend with a given enforced java version- Parameters:
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 used
-
-
Method Detail
-
getBranchTargetLabel
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- Parameters:
target- The unit that is the branch target- Returns:
- The Label that specifies this unit
-
getMinJavaVersion
protected int getMinJavaVersion(SootMethod method)
Description copied from class:AbstractASMBackendDetermines 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- Overrides:
getMinJavaVersionin classAbstractASMBackend- Parameters:
method- The SootMethod the minimum Java version is to be determined for- Returns:
- The minimum Java version required for the given SootMethod
-
generateMethodBody
protected void generateMethodBody(org.objectweb.asm.MethodVisitor mv, SootMethod method)Description copied from class:AbstractASMBackendEmits the bytecode for the body of a single method Has to be implemented by subclasses to suit their needs- Specified by:
generateMethodBodyin classAbstractASMBackend- Parameters:
mv- The MethodVisitor to emit the bytecode tomethod- The SootMethod the bytecode is to be emitted for
-
generateTagsForUnit
protected void generateTagsForUnit(org.objectweb.asm.MethodVisitor mv, Unit u)Writes out the information stored in tags associated with the given unit- Parameters:
mv- The method visitor for writing out the bytecodeu- The unit for which to write out the tags
-
generateInstruction
protected void generateInstruction(org.objectweb.asm.MethodVisitor mv, Inst inst)Emits the bytecode for a single Baf instruction- Parameters:
mv- The ASM MethodVisitor the bytecode is to be emitted toinst- The Baf instruction to be converted into bytecode
-
-