Class LiveVarStore

java.lang.Object
org.checkerframework.dataflow.livevariable.LiveVarStore
All Implemented Interfaces:
Store<LiveVarStore>

public class LiveVarStore extends Object implements Store<LiveVarStore>
A live variable store contains a set of live variables represented by nodes.
  • Constructor Details

    • LiveVarStore

      public LiveVarStore()
      Create a new LiveVarStore.
    • LiveVarStore

      public LiveVarStore(Set<LiveVarNode> liveVarNodeSet)
      Create a new LiveVarStore.
      Parameters:
      liveVarNodeSet - the set of live variable nodes. The parameter is captured and the caller should not retain an alias.
  • Method Details

    • putLiveVar

      public void putLiveVar(LiveVarNode variable)
      Add the information of a live variable into the live variable set.
      Parameters:
      variable - a live variable
    • killLiveVar

      public void killLiveVar(LiveVarNode variable)
      Remove the information of a live variable from the live variable set.
      Parameters:
      variable - a live variable
    • addUseInExpression

      public void addUseInExpression(Node expression)
      Add the information of live variables in an expression to the live variable set.
      Parameters:
      expression - a node
    • equals

      public boolean equals(@Nullable Object obj)
      Description copied from interface: Store
      Returns true if this is equal to the given argument.
      Specified by:
      equals in interface Store<LiveVarStore>
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare against this
      Returns:
      true if this is equal to the given argument
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • copy

      public LiveVarStore copy()
      Description copied from interface: Store
      Returns an exact copy of this store.
      Specified by:
      copy in interface Store<LiveVarStore>
      Returns:
      an exact copy of this store
    • leastUpperBound

      public LiveVarStore leastUpperBound(LiveVarStore other)
      Description copied from interface: Store
      Compute the least upper bound of two stores.

      Important: This method must fulfill the following contract:

      • Does not change this.
      • Does not change other.
      • Returns a fresh object which is not aliased yet.
      • Returns an object of the same (dynamic) type as this, even if the signature is more permissive.
      • Is commutative.
      Specified by:
      leastUpperBound in interface Store<LiveVarStore>
    • widenedUpperBound

      public LiveVarStore widenedUpperBound(LiveVarStore previous)
      It should not be called since it is not used by the backward analysis.
      Specified by:
      widenedUpperBound in interface Store<LiveVarStore>
      Parameters:
      previous - must be the previous store
    • canAlias

      public boolean canAlias(JavaExpression a, JavaExpression b)
      Description copied from interface: Store
      Can the objects a and b be aliases? Returns a conservative answer (i.e., returns true if not enough information is available to determine aliasing).
      Specified by:
      canAlias in interface Store<LiveVarStore>
    • visualize

      public String visualize(CFGVisualizer<?,LiveVarStore,?> viz)
      Description copied from interface: Store
      Delegate visualization responsibility to a visualizer.
      Specified by:
      visualize in interface Store<LiveVarStore>
      Parameters:
      viz - the visualizer to visualize this store
      Returns:
      the String representation of this store
    • toString

      public String toString()
      Overrides:
      toString in class Object