accrue.analysis.interprocanalysis

## Class WorkQueue<T extends Ordered<T>>

- java.lang.Object
- - accrue.analysis.interprocanalysis.WorkQueue<T>

- Type Parameters:
    `T` - The type of the analysis results (not of the elements in the queue)
  Direct Known Subclasses:
    WorkQueueVarContext

      public class WorkQueue<T extends Ordered<T>>
      extends java.lang.Object

  Manages the work queue of AnalysisUnits for interprocedural analyses. The work queue notices when analysis results change, and adds dependent jobs back to the queue. Thus, the work queue finds fixed points for the interprocedural analysis. We could try to do some smart things, like figuring out the call graph, and doing a topo sort on it, but we're being quick and dirty now.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `WorkQueue.AnalysisUnitRecord<T extends Ordered<T>>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WorkQueue(Registrar registrar, polyglot.frontend.ExtensionInfo extInfo, AnalysisFactory<T> factory, polyglot.frontend.Pass pass)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `CallGraph` | `callGraph()`
    `protected void` | `clearDependees(AnalysisUnit a)` Clear the set of AnalysisUnits that depend on the results of AnalysisUnit a.
    `protected WorkQueue.AnalysisUnitRecord<T>` | `createAnalysisUnitRecord()`
    `protected WorkQueue.AnalysisUnitRecord<T>` | `createAnalysisUnitRecord(T initialInput, ExitMap<T> initialOutput)`
    `protected ExitMap<T>` | `createExitMap(T input)`
    `void` | `dumpQueue(java.io.PrintStream out)`
    `ExitMap<T>` | `emptyExitMap()`
    `protected boolean` | `existingResultSuitable(T input, WorkQueue.AnalysisUnitRecord<T> rec)`
    `polyglot.frontend.ExtensionInfo` | `extensionInfo()`
    `AnalysisFactory<T>` | `factory()`
    `ExitMap<T>` | `getAnalysisResult(AnalysisUnit callee, T input, AnalysisUtil<T> callerAUtil)`
    `WorkQueue.AnalysisUnitRecord<T>` | `getAnalysisUnitRecord(AnalysisUnit unit)`
    `protected java.util.Set<AnalysisUnit>` | `getDependees(AnalysisUnit a)`
    `protected ExitMap<T>` | `initialAnalysisUnitOutput(AnalysisUnit callee, T input)`
    `boolean` | `isEmpty()`
    `protected boolean` | `isOutputChanged(ExitMap<T> output, WorkQueue.AnalysisUnitRecord<T> rec, AnalysisUtil<T> autil)`
    `boolean` | `maybeRecursiveCall(AnalysisUnit caller, AnalysisUnit callee)`
    `polyglot.frontend.Pass` | `pass()`
    `void` | `processQueue()`
    `void` | `recordResult(AnalysisUnit pc, AnalysisUtil<T> autil, T input, ExitMap<T> output)`
    `Registrar` | `registrar()`
    `protected ExitMap<T>` | `restoreCallingFrame(ExitMap<T> output, T input, WorkQueue.AnalysisUnitRecord<T> rec)`
    `protected void` | `updateCallerRecordAfterCalleeProcessing(WorkQueue.AnalysisUnitRecord<T> callerRec, WorkQueue.AnalysisUnitRecord<T> rec)`
    `protected void` | `updateOutput(WorkQueue.AnalysisUnitRecord<T> rec, ExitMap<T> output, AnalysisUtil<T> autil)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WorkQueue

          public WorkQueue(Registrar registrar,
                   polyglot.frontend.ExtensionInfo extInfo,
                   AnalysisFactory<T> factory,
                   polyglot.frontend.Pass pass)

  - ### Method Detail

    - #### factory

          public AnalysisFactory<T> factory()

    - #### registrar

          public Registrar registrar()

    - #### callGraph

          public CallGraph callGraph()

    - #### pass

          public polyglot.frontend.Pass pass()

    - #### extensionInfo

          public polyglot.frontend.ExtensionInfo extensionInfo()

    - #### processQueue

          public void processQueue()
                            throws polyglot.types.SemanticException

      Throws:
        `polyglot.types.SemanticException`

    - #### isEmpty

          public boolean isEmpty()

    - #### recordResult

          public void recordResult(AnalysisUnit pc,
                          AnalysisUtil<T> autil,
                          T input,
                          ExitMap<T> output)

    - #### updateOutput

          protected void updateOutput(WorkQueue.AnalysisUnitRecord<T> rec,
                          ExitMap<T> output,
                          AnalysisUtil<T> autil)

    - #### isOutputChanged

          protected boolean isOutputChanged(ExitMap<T> output,
                                WorkQueue.AnalysisUnitRecord<T> rec,
                                AnalysisUtil<T> autil)

    - #### getAnalysisResult

          public ExitMap<T> getAnalysisResult(AnalysisUnit callee,
                                     T input,
                                     AnalysisUtil<T> callerAUtil)
                                                          throws polyglot.types.SemanticException

      Throws:
        `polyglot.types.SemanticException`

    - #### createAnalysisUnitRecord

          protected WorkQueue.AnalysisUnitRecord<T> createAnalysisUnitRecord()

    - #### createAnalysisUnitRecord

          protected WorkQueue.AnalysisUnitRecord<T> createAnalysisUnitRecord(T initialInput,
                                                                 ExitMap<T> initialOutput)

    - #### updateCallerRecordAfterCalleeProcessing

          protected void updateCallerRecordAfterCalleeProcessing(WorkQueue.AnalysisUnitRecord<T> callerRec,
                                                     WorkQueue.AnalysisUnitRecord<T> rec)

    - #### existingResultSuitable

          protected boolean existingResultSuitable(T input,
                                       WorkQueue.AnalysisUnitRecord<T> rec)

    - #### restoreCallingFrame

          protected ExitMap<T> restoreCallingFrame(ExitMap<T> output,
                                       T input,
                                       WorkQueue.AnalysisUnitRecord<T> rec)

    - #### emptyExitMap

          public ExitMap<T> emptyExitMap()

    - #### createExitMap

          protected ExitMap<T> createExitMap(T input)

    - #### initialAnalysisUnitOutput

          protected ExitMap<T> initialAnalysisUnitOutput(AnalysisUnit callee,
                                             T input)

    - #### maybeRecursiveCall

          public boolean maybeRecursiveCall(AnalysisUnit caller,
                                   AnalysisUnit callee)

    - #### getDependees

          protected java.util.Set<AnalysisUnit> getDependees(AnalysisUnit a)

    - #### clearDependees

          protected void clearDependees(AnalysisUnit a)

      Clear the set of AnalysisUnits that depend on the results of AnalysisUnit a.
      Parameters:
        `a` -

    - #### dumpQueue

          public void dumpQueue(java.io.PrintStream out)

    - #### getAnalysisUnitRecord

          public WorkQueue.AnalysisUnitRecord<T> getAnalysisUnitRecord(AnalysisUnit unit)