local refs
Matthew Fluet
fluet@CS.Cornell.EDU
Tue, 11 Dec 2001 15:35:32 -0500 (EST)
> There is still a lot of easy fat (I'd guess >2X) in the dominator
> computation. It's been on my todo list for ages. It would be nice to
> know for both restore and commonSubexp how much of the time is
> dominators. I'd guess a lot.
I added the following to Control:
type traceAccum
val traceAccum: verbosity * string -> (traceAccum * (unit -> unit))
val traceAdd: traceAccum * string -> ('a -> 'b) -> 'a -> 'b
traceAccum gives you an accumulator and a message printer;
traceAdd adds each execution of the wrapped function to the accumulator.
I also reimplemented traceBatch as a special case of the above.
Anyways, that let me get the kinds of accumulated timing I wanted:
localRef starting
multi starting
multi finished in 0.70 + 1.89 (73% GC)
restore totals 2.96 + 3.25 (52% GC)
checkGlobalsViolations totals 0.01 + 0.0 (0.0% GC)
checkViolations totals 0.09 + 0.0 (0.0% GC)
dominatorTree totals 0.85 + 3.25 (79% GC)
computeDF totals 0.33 + 0.0 (0.0% GC)
computeLive totals 0.0 + 0.0 (0% GC)
computePhi totals 0.06 + 0.0 (0.0% GC)
rewrite totals 0.16 + 0.0 (0.0% GC)
shrink totals 0.46 + 0.0 (0.0% GC)
localRef finished in 5.48 + 6.52 (54% GC)
Although that's not very illuminating. I'm still missing 1.46s.
The checkGlobalsViolations above is just the first check of global
violations; i.e., given the vector of globals, mark each one as having a
def cardinality of One. What it is not counting is the check on every
restored function which verifies that after incrementing the def counts of
all variables defed in the function, no global has a def cardinality
greater than One. Considering the number of globals that a self compile
has, this might not be as trivial as I had thought it would be.
I'm rerunning self-compiles to factor in these other global checks (and
also to get dominator timing in commonSubexp); if that turns out to be
dominant, then maybe the best thing to do would be to implement a
three-point-lattice functor, make cardinality a three-point-lattice (with
zero, one, many), and set each global to raise an error if it's
cardinality reaches top.
Or, just skip this check and let the type-checker or some later pass
complain when it finds a second definition of a global.