src/share/classes/com/sun/tools/javac/jvm/Gen.java

changeset 3864
d0cf124d8ee9
parent 3446
e468915bad3a
parent 3852
f02d967ddce2
equal deleted inserted replaced
3848:2b48e252b14f 3864:d0cf124d8ee9
1220 c = items.makeCondItem(goto_); 1220 c = items.makeCondItem(goto_);
1221 } 1221 }
1222 code.resolve(c.jumpTrue(), startpc); 1222 code.resolve(c.jumpTrue(), startpc);
1223 code.resolve(c.falseJumps); 1223 code.resolve(c.falseJumps);
1224 } 1224 }
1225 code.resolve(loopEnv.info.exit); 1225 Chain exit = loopEnv.info.exit;
1226 if (loopEnv.info.exit != null) { 1226 if (exit != null) {
1227 loopEnv.info.exit.state.defined.excludeFrom(code.nextreg); 1227 code.resolve(exit);
1228 exit.state.defined.excludeFrom(code.nextreg);
1228 } 1229 }
1229 } 1230 }
1230 1231
1231 public void visitForeachLoop(JCEnhancedForLoop tree) { 1232 public void visitForeachLoop(JCEnhancedForLoop tree) {
1232 throw new AssertionError(); // should have been removed by Lower. 1233 throw new AssertionError(); // should have been removed by Lower.
1233 } 1234 }
1234 1235
1235 public void visitLabelled(JCLabeledStatement tree) { 1236 public void visitLabelled(JCLabeledStatement tree) {
1236 Env<GenContext> localEnv = env.dup(tree, new GenContext()); 1237 Env<GenContext> localEnv = env.dup(tree, new GenContext());
1237 genStat(tree.body, localEnv, CRT_STATEMENT); 1238 genStat(tree.body, localEnv, CRT_STATEMENT);
1238 code.resolve(localEnv.info.exit); 1239 Chain exit = localEnv.info.exit;
1240 if (exit != null) {
1241 code.resolve(exit);
1242 exit.state.defined.excludeFrom(code.nextreg);
1243 }
1239 } 1244 }
1240 1245
1241 public void visitSwitch(JCSwitch tree) { 1246 public void visitSwitch(JCSwitch tree) {
1242 int limit = code.nextreg; 1247 int limit = code.nextreg;
1243 Assert.check(!tree.selector.type.hasTag(CLASS)); 1248 Assert.check(!tree.selector.type.hasTag(CLASS));
1342 // Generate code for the statements in this case. 1347 // Generate code for the statements in this case.
1343 genStats(c.stats, switchEnv, CRT_FLOW_TARGET); 1348 genStats(c.stats, switchEnv, CRT_FLOW_TARGET);
1344 } 1349 }
1345 1350
1346 // Resolve all breaks. 1351 // Resolve all breaks.
1347 code.resolve(switchEnv.info.exit); 1352 Chain exit = switchEnv.info.exit;
1353 if (exit != null) {
1354 code.resolve(exit);
1355 exit.state.defined.excludeFrom(code.nextreg);
1356 }
1348 1357
1349 // If we have not set the default offset, we do so now. 1358 // If we have not set the default offset, we do so now.
1350 if (code.get4(tableBase) == -1) { 1359 if (code.get4(tableBase) == -1) {
1351 code.put4(tableBase, code.entryPoint(stateSwitch) - startpc); 1360 code.put4(tableBase, code.entryPoint(stateSwitch) - startpc);
1352 } 1361 }

mercurial