edu.umd.cs.findbugs.ba
Class BetterCFGBuilder2.Context

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.BetterCFGBuilder2.Context
Enclosing class:
BetterCFGBuilder2

private static class BetterCFGBuilder2.Context
extends java.lang.Object

Inlining context. This essentially consists of a inlining site and a subroutine to be inlined. A stack of calling contexts is maintained in order to resolve EscapeTargets.


Field Summary
private  java.util.IdentityHashMap<BasicBlock,BasicBlock> blockMap
           
private  BetterCFGBuilder2.Context caller
           
private  CFG result
           
private  BetterCFGBuilder2.Subroutine subroutine
           
private  java.util.LinkedList<BasicBlock> workList
           
 
Constructor Summary
BetterCFGBuilder2.Context(BetterCFGBuilder2.Context caller, BetterCFGBuilder2.Subroutine subroutine, CFG result)
          Constructor.
 
Method Summary
 void addItem(BasicBlock item)
          Add a basic block to the inlining work list.
 void checkForRecursion()
          Check to ensure that this context is not the result of recursion.
 BasicBlock getBlock(BasicBlock subBlock)
          Get the block in the result CFG corresponding to the given subroutine block.
 BetterCFGBuilder2.Context getCaller()
          Get the calling context.
 CFG getResult()
          Get the result CFG.
 BetterCFGBuilder2.Subroutine getSubroutine()
          Get the subroutine being inlined.
 boolean hasMoreWork()
          Are there more work list items?
 void mapBlock(BasicBlock subBlock, BasicBlock resultBlock)
          Map a basic block in a subroutine to the corresponding block in the resulting CFG.
 BasicBlock nextItem()
          Get the next work list item (basic block to be inlined).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

caller

private final BetterCFGBuilder2.Context caller

subroutine

private final BetterCFGBuilder2.Subroutine subroutine

result

private final CFG result

blockMap

private final java.util.IdentityHashMap<BasicBlock,BasicBlock> blockMap

workList

private final java.util.LinkedList<BasicBlock> workList
Constructor Detail

BetterCFGBuilder2.Context

public BetterCFGBuilder2.Context(BetterCFGBuilder2.Context caller,
                                 BetterCFGBuilder2.Subroutine subroutine,
                                 CFG result)
Constructor.

Parameters:
caller - the calling context
subroutine - the subroutine being inlined
result - the result CFG
Method Detail

getCaller

public BetterCFGBuilder2.Context getCaller()
Get the calling context.


getSubroutine

public BetterCFGBuilder2.Subroutine getSubroutine()
Get the subroutine being inlined.


getResult

public CFG getResult()
Get the result CFG.


addItem

public void addItem(BasicBlock item)
Add a basic block to the inlining work list.


hasMoreWork

public boolean hasMoreWork()
Are there more work list items?


nextItem

public BasicBlock nextItem()
Get the next work list item (basic block to be inlined).


mapBlock

public void mapBlock(BasicBlock subBlock,
                     BasicBlock resultBlock)
Map a basic block in a subroutine to the corresponding block in the resulting CFG.

Parameters:
subBlock - the subroutine block
resultBlock - the result CFG block

getBlock

public BasicBlock getBlock(BasicBlock subBlock)
Get the block in the result CFG corresponding to the given subroutine block.

Parameters:
subBlock - the subroutine block
Returns:
the result CFG block

checkForRecursion

public void checkForRecursion()
                       throws CFGBuilderException
Check to ensure that this context is not the result of recursion.

Throws:
CFGBuilderException