Class StackOptimizer


  • public class StackOptimizer
    extends java.lang.Object
    StackOptimizer analyzes the relative distances of various uses of the same definition of a local variable to add dups and swaps to the bytecode and eliminate loads and stores.
    • Constructor Detail

      • StackOptimizer

        public StackOptimizer​(Block owningBlock)
    • Method Detail

      • optimizeCFG

        public static void optimizeCFG​(FlowGraph cfg)
      • optimize

        public void optimize()
        Optimize runs the algorithm for analyzing the tree, looking for opportunities to replaces stores and loads with dups and swaps. It initiates several visitors, and information is sotred in defInfoMap and useInfoMap
      • shouldStore

        public boolean shouldStore​(LocalExpr expr)
        Various methods used by CodeGenerator, used as an interface into the information in defInfoMap and useInfoMap
      • dup_x1s

        public int dup_x1s​(LocalExpr expr)
      • dup_x2s

        public int dup_x2s​(LocalExpr expr)
      • onStack

        public boolean onStack​(LocalExpr expr)
      • shouldSwap

        public boolean shouldSwap​(LocalExpr expr)
      • infoDisplay

        public void infoDisplay​(LocalExpr expr)