PointerAnalyzer

public final class PointerAnalyzer extends DataFlowAnalyzer

Analyzer in charge of detection of possible pointer destinations.

Feature: derives from DataFlowAnalyzer : OK
Feature: able to analyze recursive code: OK
Feature: distinguishes structure elemts: OK
Feature: takes  care  of  pointer dests: OK
Feature: refine on loop-local variables: OK
Feature: std method for call arguments : OK
Feature: able to analyze sub-flow-graph: OK

Methods

buildExplicitIdentityDestsRow

public static BoolVector buildExplicitIdentityDestsRow(int rowIndex, SymbolTable symbolTable)

Build a BoolVector dests row representing explicit-Identity for row number “rowIndex”. This is a shortcut that doesn’t use the maps: valid only if the structure of maps does not change. Also, this does not work when the rowIndex is about a formal parameter!

Parameters
  • rowIndex – The given row index.

  • symbolTable – The SymbolTable of the current location in the current Unit.

Returns

The BoolVector that explicitly represents identity.

compareChannelZoneDataDownstream

protected boolean compareChannelZoneDataDownstream(int mpZone, Block refBlock)

compareDownstreamValues

protected boolean compareDownstreamValues()

compareUpstreamValues

protected boolean compareUpstreamValues()

cumulCycleValueWithAdditional

protected void cumulCycleValueWithAdditional(SymbolTable commonSymbolTable)

cumulValueWithAdditional

protected void cumulValueWithAdditional(SymbolTable commonSymbolTable)

getValueFlowingThrough

protected boolean getValueFlowingThrough()

initializeCGForUnit

protected Object initializeCGForUnit()

initializeCumulValue

protected void initializeCumulValue()

initializeFGForBlock

protected void initializeFGForBlock()

Initializes for curBlock before analysis of its Unit. Fills the BoolMatrix of the pointer effect of curBlock. If no pointer around, does nothing and exits quickly.

initializeInitBlock

protected void initializeInitBlock()

initializeUnit

protected void initializeUnit()

Initialize just before pointer analysis on “curUnit”. This is re-done once per Unit during each sweep on the CG.

propagateValuesForwardThroughBlock

protected boolean propagateValuesForwardThroughBlock()

replaceActualsByInitials

public static void replaceActualsByInitials(BoolVector infoVector, Tree callTree, int whichKind)

Reciprocal of replaceInitialsByActuals(). Given a data flow info “infoVector” which exists in some (calling) subroutine just before calling some (called) subroutine, changes the “infoVector” so that it contains the same info, but based on the global pointers’ initial destination zones at the entry into the called subroutine. This uses the “pointersActualInitialDests” annotation that was precomputed for this call site at the end of pointer analysis.

replaceActualsByInitials

public static void replaceActualsByInitials(BoolMatrix infoMatrix, Tree callTree, int whichKind)

replaceInitialsByActuals

public static void replaceInitialsByActuals(BoolVector infoVector, Tree callTree, int whichKind, int globNb)

Given a data flow info “infoVector” where some info concerns zones that are indeed “initial destinations” of global pointers at the entry into a called procedure, changes the “infoVector” so that it contains the same info, but based on the actual destinations of these global pointers at the call site “callTree” in the calling subroutine. This uses the “pointersActualInitialDests” annotation that was precomputed for this call site at the end of pointer analysis.

replaceInitialsByActuals

public static void replaceInitialsByActuals(BoolMatrix infoMatrix, Tree callTree, int whichKind)

runAnalysis

public static void runAnalysis(CallGraph callgraph, TapList<Unit> rootUnits)

Main entry point. Builds a PointerAnalyzer, stores it and runs it.

setCurBlockEtc

protected void setCurBlockEtc(Block block)

In addition to super.setCurBlockEtc(), sets nDPZ and the 3rd size of curRowMap and curColMap.

setCurUnitEtc

public void setCurUnitEtc(Unit unit)

In addition to super.setCurUnitEtc(), sets nDPZ and the contents of curRowMap and curColMap.

setEmptyCumulAndCycleValues

protected void setEmptyCumulAndCycleValues()

terminateCGForUnit

protected void terminateCGForUnit()

Places the comments about pointers into the code or curUnit, then cleans last bits of memory. Done only once for each Unit, when all sweeps on the CG are finished.

terminateFGForBlock

protected void terminateFGForBlock()

terminateUnit

protected boolean terminateUnit()

Stores the condensed pointer dests info after analysis of “curUnit”. Prepares the pointer destination comments when requested. Makes removeDanglingPointers() emit messages for dangling pointers. Builds the public pointer dests info for curUnit, to be used during analysis of calling units. This is re-done once per Unit during each sweep on the CG.