Package com.tonic.analysis.absexec
Class InsnContext
- java.lang.Object
-
- com.tonic.analysis.absexec.InsnContext
-
public final class InsnContext extends Object
Records one execution of oneInstructionby the abstractExecution- its operand-stack pops and pushes (with def-use links back to theInsnContextthat produced each value) and its local reads.
-
-
Constructor Summary
Constructors Constructor Description InsnContext(Instruction insn, Frame frame)Creates a context for one execution of an instruction within a frame.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbranch(Frame f)Records a frame forked by this instruction at a branch target.List<Frame>getBranches()FramegetFrame()InstructiongetInstruction()List<StackCtx>getPops()List<StackCtx>getPushes()List<VarCtx>getReads()voidpop(StackCtx... ctx)Records each popped stack value and back-links it to this instruction.voidpush(StackCtx... ctx)Records the stack values this instruction pushed.voidread(VarCtx... ctx)Records each read local slot and back-links it to this instruction.InsnContextresolve()Follows def-use to the instruction that actually produced this context's value.
-
-
-
Constructor Detail
-
InsnContext
public InsnContext(Instruction insn, Frame frame)
Creates a context for one execution of an instruction within a frame.- Parameters:
insn- the executed instructionframe- the frame executing it
-
-
Method Detail
-
getFrame
public Frame getFrame()
- Returns:
- the frame
-
getPops
public List<StackCtx> getPops()
- Returns:
- the popped stack values, in pop order (index 0 = top of stack)
-
pop
public void pop(StackCtx... ctx)
Records each popped stack value and back-links it to this instruction.- Parameters:
ctx- the popped stack contexts
-
push
public void push(StackCtx... ctx)
Records the stack values this instruction pushed.- Parameters:
ctx- the pushed stack contexts
-
read
public void read(VarCtx... ctx)
Records each read local slot and back-links it to this instruction.- Parameters:
ctx- the local-slot contexts read
-
branch
public void branch(Frame f)
Records a frame forked by this instruction at a branch target.- Parameters:
f- the forked frame
-
getInstruction
public Instruction getInstruction()
- Returns:
- the instruction
-
resolve
public InsnContext resolve()
Follows def-use to the instruction that actually produced this context's value.- Returns:
- the producing context, or this one when the chain ends here
-
-