--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Tue Jul 15 18:17:31 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Jul 16 10:47:56 2014 -0400
@@ -1072,7 +1072,7 @@
boolean testFirst) {
Env<GenContext> loopEnv = env.dup(loop, new GenContext());
int startpc = code.entryPoint();
- if (testFirst) {
+ if (testFirst) { //while or for loop
CondItem c;
if (cond != null) {
code.statBegin(cond.pos);
@@ -1118,6 +1118,9 @@
code.resolve(c.falseJumps);
}
code.resolve(loopEnv.info.exit);
+ if (loopEnv.info.exit != null) {
+ loopEnv.info.exit.state.defined.excludeFrom(code.nextreg);
+ }
}
private enum LoopLocalVarRangeEndingPoint {