< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java

Print this page

        

*** 544,583 **** ListBuffer<PendingExit> prevPendingExits = pendingExits; pendingExits = new ListBuffer<>(); scanStat(tree.body); alive = alive.or(resolveContinues(tree)); scan(tree.cond); ! alive = alive.and(!tree.cond.type.isTrue()); alive = alive.or(resolveBreaks(tree, prevPendingExits)); } public void visitWhileLoop(JCWhileLoop tree) { ListBuffer<PendingExit> prevPendingExits = pendingExits; pendingExits = new ListBuffer<>(); scan(tree.cond); ! alive = Liveness.from(!tree.cond.type.isFalse()); scanStat(tree.body); alive = alive.or(resolveContinues(tree)); alive = resolveBreaks(tree, prevPendingExits).or( ! !tree.cond.type.isTrue()); } public void visitForLoop(JCForLoop tree) { ListBuffer<PendingExit> prevPendingExits = pendingExits; scanStats(tree.init); pendingExits = new ListBuffer<>(); if (tree.cond != null) { scan(tree.cond); ! alive = Liveness.from(!tree.cond.type.isFalse()); } else { alive = Liveness.ALIVE; } scanStat(tree.body); alive = alive.or(resolveContinues(tree)); scan(tree.step); alive = resolveBreaks(tree, prevPendingExits).or( ! tree.cond != null && !tree.cond.type.isTrue()); } public void visitForeachLoop(JCEnhancedForLoop tree) { visitVarDef(tree.var); ListBuffer<PendingExit> prevPendingExits = pendingExits; --- 544,583 ---- ListBuffer<PendingExit> prevPendingExits = pendingExits; pendingExits = new ListBuffer<>(); scanStat(tree.body); alive = alive.or(resolveContinues(tree)); scan(tree.cond); ! alive = alive.and(!ConstFold.isTrue(tree.cond.type.getTag(), tree.cond.type.constValue())); alive = alive.or(resolveBreaks(tree, prevPendingExits)); } public void visitWhileLoop(JCWhileLoop tree) { ListBuffer<PendingExit> prevPendingExits = pendingExits; pendingExits = new ListBuffer<>(); scan(tree.cond); ! alive = Liveness.from(!ConstFold.isFalse(tree.cond.type.getTag(), tree.cond.type.constValue())); scanStat(tree.body); alive = alive.or(resolveContinues(tree)); alive = resolveBreaks(tree, prevPendingExits).or( ! !ConstFold.isTrue(tree.cond.type.getTag(), tree.cond.type.constValue())); } public void visitForLoop(JCForLoop tree) { ListBuffer<PendingExit> prevPendingExits = pendingExits; scanStats(tree.init); pendingExits = new ListBuffer<>(); if (tree.cond != null) { scan(tree.cond); ! alive = Liveness.from(!ConstFold.isFalse(tree.cond.type.getTag(), tree.cond.type.constValue())); } else { alive = Liveness.ALIVE; } scanStat(tree.body); alive = alive.or(resolveContinues(tree)); scan(tree.step); alive = resolveBreaks(tree, prevPendingExits).or( ! tree.cond != null && !ConstFold.isTrue(tree.cond.type.getTag(), tree.cond.type.constValue())); } public void visitForeachLoop(JCEnhancedForLoop tree) { visitVarDef(tree.var); ListBuffer<PendingExit> prevPendingExits = pendingExits;
*** 1792,1810 **** /** Analyze a condition. Make sure to set (un)initsWhenTrue(WhenFalse) * rather than (un)inits on exit. */ void scanCond(JCTree tree) { ! if (tree.type.isFalse()) { if (inits.isReset()) merge(); initsWhenTrue.assign(inits); initsWhenTrue.inclRange(firstadr, nextadr); uninitsWhenTrue.assign(uninits); uninitsWhenTrue.inclRange(firstadr, nextadr); initsWhenFalse.assign(inits); uninitsWhenFalse.assign(uninits); ! } else if (tree.type.isTrue()) { if (inits.isReset()) merge(); initsWhenFalse.assign(inits); initsWhenFalse.inclRange(firstadr, nextadr); uninitsWhenFalse.assign(uninits); uninitsWhenFalse.inclRange(firstadr, nextadr); --- 1792,1810 ---- /** Analyze a condition. Make sure to set (un)initsWhenTrue(WhenFalse) * rather than (un)inits on exit. */ void scanCond(JCTree tree) { ! if (ConstFold.isFalse(tree.type.getTag(), tree.type.constValue())) { if (inits.isReset()) merge(); initsWhenTrue.assign(inits); initsWhenTrue.inclRange(firstadr, nextadr); uninitsWhenTrue.assign(uninits); uninitsWhenTrue.inclRange(firstadr, nextadr); initsWhenFalse.assign(inits); uninitsWhenFalse.assign(uninits); ! } else if (ConstFold.isTrue(tree.type.getTag(), tree.type.constValue())) { if (inits.isReset()) merge(); initsWhenFalse.assign(inits); initsWhenFalse.inclRange(firstadr, nextadr); uninitsWhenFalse.assign(uninits); uninitsWhenFalse.inclRange(firstadr, nextadr);
< prev index next >