Class ShimpleLocalDefs

  • All Implemented Interfaces:
    LocalDefs

    public class ShimpleLocalDefs
    extends Object
    implements LocalDefs
    This class implements the LocalDefs interface for Shimple. ShimpleLocalDefs can be used in conjunction with SimpleLocalUses to provide Definition/Use and Use/Definition chains in SSA.

    This implementation can be considered a small demo for how SSA can be put to good use since it is much simpler than soot.toolkits.scalar.SimpleLocalDefs. Shimple can often be treated as Jimple with the added benefits of SSA assumptions.

    In addition to the interface required by LocalDefs, ShimpleLocalDefs also provides a method for obtaining the definition Unit given only the Local.

    Author:
    Navindra Umanee
    See Also:
    ShimpleLocalUses, SimpleLocalDefs, SimpleLocalUses
    • Constructor Detail

      • ShimpleLocalDefs

        public ShimpleLocalDefs​(ShimpleBody sb)
        Build a LocalDefs interface from a ShimpleBody. Proper SSA form is required, otherwise correct behaviour is not guaranteed.
    • Method Detail

      • getDefsOf

        public List<Unit> getDefsOf​(Local l)
        Unconditionally returns the definition site of a local (as a singleton list).
        Specified by:
        getDefsOf in interface LocalDefs
        Parameters:
        l - the Local in question.
        Returns:
        a list of Units where the local is defined in the current method context. If there are no uses an empty list will returned.
      • getDefsOfAt

        public List<Unit> getDefsOfAt​(Local l,
                                      Unit s)
        Returns the definition site for a Local at a certain point (Unit) in a method as a singleton list.
        Specified by:
        getDefsOfAt in interface LocalDefs
        Parameters:
        l - the Local in question.
        s - a unit that specifies the method context (location) to query for the definitions of the Local.
        Returns:
        a singleton list containing the definition site.