*/
public Block optimize(Block js, MessageQueue mq) {
finishInference();
while (true) {
Result out = new Result();
Scope s = Scope.fromProgram(js, new Rewriter(mq, false, false));
optimize(s, js, false, false, false, false, out);
Block optimized = ConstLocalOptimization.optimize((Block) out.node);
if (optimized == js) { return optimized; }
js = optimized;
}