Class StrongLocalMustAliasAnalysis


  • public class StrongLocalMustAliasAnalysis
    extends LocalMustAliasAnalysis
    A special version of the local must-alias analysis that takes redefinitions within loops into account. For variable that is redefined in a loop, the must-alias information is invalidated and set to LocalMustAliasAnalysis#UNKNOWN. E.g. assume the following example: while(..) { c = foo(); //(1) c.doSomething(); //(2) } While it is certainly true that c at (2) must-alias c at (1) (they have the same value number), it is also true that in a second iteration, c at (2) may not alias the previous c at (2).
    Author:
    Eric Bodden
    • Field Detail

      • invalidInstanceKeys

        protected final Set<Integer> invalidInstanceKeys
    • Constructor Detail

      • StrongLocalMustAliasAnalysis

        public StrongLocalMustAliasAnalysis​(UnitGraph g)
    • Method Detail

      • mustAlias

        public boolean mustAlias​(Local l1,
                                 Stmt s1,
                                 Local l2,
                                 Stmt s2)
        Overrides:
        mustAlias in class LocalMustAliasAnalysis
        Returns:
        true if values of l1 (at s1) and l2 (at s2) have the exact same object IDs, i.e. at statement s1 the variable l1 must point to the same object as l2 at s2.
      • instanceKeyString

        public String instanceKeyString​(Local l,
                                        Stmt s)
        Returns a string (natural number) representation of the instance key associated with l at statement s or null if there is no such key associated.
        Overrides:
        instanceKeyString in class LocalMustAliasAnalysis
        Parameters:
        l - any local of the associated method
        s - the statement at which to check