SandMark version 2.0


sandmark.obfuscate.boolsplitter.dtree
Class StackOptimizer

java.lang.Object
  |
  +--sandmark.obfuscate.boolsplitter.dtree.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.

Author:
Thomas VanDrunen

Field Summary
(package private) static boolean DEBUG
           
(package private)  java.util.Hashtable defInfoMap
           
(package private)  Block owningBlock
           
(package private)  java.util.Hashtable useInfoMap
           
 
Constructor Summary
StackOptimizer(Block owningBlock)
           
 
Method Summary
 int dup_x1s(LocalExpr expr)
           
 int dup_x2s(LocalExpr expr)
           
 int dups(LocalExpr expr)
           
 void infoDisplay(LocalExpr expr)
           
 boolean onStack(LocalExpr expr)
           
 void optimize()
          Optimize runs the algorithm for analyzing the tree, looking for opportunities to replaces stores and loads with dups and swaps.
static void optimizeCFG(FlowGraph cfg)
           
 boolean shouldStore(LocalExpr expr)
          Various methods used by CodeGenerator, used as an interface into the information in defInfoMap and useInfoMap
 boolean shouldSwap(LocalExpr expr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

static boolean DEBUG

defInfoMap

java.util.Hashtable defInfoMap

useInfoMap

java.util.Hashtable useInfoMap

owningBlock

Block owningBlock
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


dups

public int dups(LocalExpr expr)

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)

SandMark version 2.0

Mon Jun 17 12:30:47 MST 2002