Package com.tonic.analysis.ssa.lift
Class BytecodeLifter
- java.lang.Object
-
- com.tonic.analysis.ssa.lift.BytecodeLifter
-
public class BytecodeLifter extends Object
Lifts bytecode to SSA-form IR.
-
-
Constructor Summary
Constructors Constructor Description BytecodeLifter(ConstPool constPool)Creates a new bytecode lifter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<IRBlock[]>addExceptionEdges(IRMethod irMethod)Adds an exception edge from every protected block to its handler block.IRMethodlift(MethodEntry method)Lifts a method from bytecode to SSA-form IR.static voidrefinePhiTypes(IRMethod method)Re-types phi results to the common type of their incoming values when every non-null incoming is the same primitive type.static voidremoveExceptionEdges(List<IRBlock[]> addedEdges)Removes the transient exception edges added byaddExceptionEdges(com.tonic.analysis.ssa.cfg.IRMethod)once SSA local renaming is complete, so the final CFG carries only real control-flow edges.
-
-
-
Constructor Detail
-
BytecodeLifter
public BytecodeLifter(ConstPool constPool)
Creates a new bytecode lifter.- Parameters:
constPool- the constant pool
-
-
Method Detail
-
lift
public IRMethod lift(MethodEntry method)
Lifts a method from bytecode to SSA-form IR.- Parameters:
method- the method to lift- Returns:
- the SSA-form IR representation
-
refinePhiTypes
public static void refinePhiTypes(IRMethod method)
Re-types phi results to the common type of their incoming values when every non-null incoming is the same primitive type.- Parameters:
method- the SSA method whose phi results are re-typed in place
-
addExceptionEdges
public static List<IRBlock[]> addExceptionEdges(IRMethod irMethod)
Adds an exception edge from every protected block to its handler block.- Parameters:
irMethod- the method whose handler blocks to connect- Returns:
- the list of (fromBlock, handlerBlock) edges that were actually added
-
removeExceptionEdges
public static void removeExceptionEdges(List<IRBlock[]> addedEdges)
Removes the transient exception edges added byaddExceptionEdges(com.tonic.analysis.ssa.cfg.IRMethod)once SSA local renaming is complete, so the final CFG carries only real control-flow edges.- Parameters:
addedEdges- the edges returned byaddExceptionEdges(com.tonic.analysis.ssa.cfg.IRMethod)
-
-