Class TypeResolver


  • public class TypeResolver
    extends Object
    New Type Resolver by Ben Bellamy (see 'Efficient Local Type Inference' at OOPSLA 08). Ben has tested this code, and verified that it provides a typing that is at least as tight as the original algorithm (tighter in 2914 methods out of 295598) on a number of benchmarks. These are: abc-complete.jar, BlueJ, CSO (Scala code), Gant, Groovy, havoc.jar, Java 3D, jEdit, Java Grande Forum, Jigsaw, Jython, Kawa, rt.jar, Kawa, Scala and tools.jar. The mean execution time improvement is around 10 times, but for the longest methods (abc parser methods and havoc with >9000 statements) the improvement is between 200 and 500 times.
    Author:
    Ben Bellamy
    • Constructor Detail

      • TypeResolver

        public TypeResolver​(JimpleBody jb)
    • Method Detail

      • inferTypes

        public void inferTypes()
      • convert

        protected Type convert​(Type t)
      • createCastInsertionUseVisitor

        protected TypeResolver.CastInsertionUseVisitor createCastInsertionUseVisitor​(Typing tg,
                                                                                     IHierarchy h,
                                                                                     boolean countOnly)
        Allows clients to provide an own visitor for cast insertion
        Parameters:
        tg - the typing
        h - the hierarchy
        countOnly - whether to count only (no actual changes)
        Returns:
        the visitor
      • createSigmaQueue

        protected ArrayDeque<soot.jimple.toolkits.typing.fast.TypeResolver.WorklistElement> createSigmaQueue()
      • createResultList

        protected List<Typing> createResultList()
      • typesEqual

        public static boolean typesEqual​(Type a,
                                         Type b)