< prev index next >

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

Print this page
rev 3804 : 8067429: java.lang.VerifyError: Inconsistent stackmap frames at branch target

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -1220,24 +1220,29 @@
                     c = items.makeCondItem(goto_);
                 }
                 code.resolve(c.jumpTrue(), startpc);
                 code.resolve(c.falseJumps);
             }
-            code.resolve(loopEnv.info.exit);
-            if (loopEnv.info.exit != null) {
-                loopEnv.info.exit.state.defined.excludeFrom(code.nextreg);
+            Chain exit = loopEnv.info.exit;
+            if (exit != null) {
+                code.resolve(exit);
+                exit.state.defined.excludeFrom(code.nextreg);
             }
         }
 
     public void visitForeachLoop(JCEnhancedForLoop tree) {
         throw new AssertionError(); // should have been removed by Lower.
     }
 
     public void visitLabelled(JCLabeledStatement tree) {
         Env<GenContext> localEnv = env.dup(tree, new GenContext());
         genStat(tree.body, localEnv, CRT_STATEMENT);
-        code.resolve(localEnv.info.exit);
+        Chain exit = localEnv.info.exit;
+        if (exit != null) {
+            code.resolve(exit);
+            exit.state.defined.excludeFrom(code.nextreg);
+        }
     }
 
     public void visitSwitch(JCSwitch tree) {
         int limit = code.nextreg;
         Assert.check(!tree.selector.type.hasTag(CLASS));

@@ -1342,11 +1347,15 @@
                 // Generate code for the statements in this case.
                 genStats(c.stats, switchEnv, CRT_FLOW_TARGET);
             }
 
             // Resolve all breaks.
-            code.resolve(switchEnv.info.exit);
+            Chain exit = switchEnv.info.exit;
+            if  (exit != null) {
+                code.resolve(exit);
+                exit.state.defined.excludeFrom(code.nextreg);
+            }
 
             // If we have not set the default offset, we do so now.
             if (code.get4(tableBase) == -1) {
                 code.put4(tableBase, code.entryPoint(stateSwitch) - startpc);
             }
< prev index next >