< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java

Print this page
rev 51104 : imported patch switch

@@ -181,10 +181,12 @@
      */
     final Pool pool;
 
     final MethodSymbol meth;
 
+    private int letExprStackPos = 0;
+
     /** Construct a code object, given the settings of the fatcode,
      *  debugging info switches and the CharacterRangeTable.
      */
     public Code(MethodSymbol meth,
                 boolean fatcode,

@@ -380,11 +382,11 @@
             emit1(op);
         }
     }
 
     void postop() {
-        Assert.check(alive || state.stacksize == 0);
+        Assert.check(alive || isStatementStart());
     }
 
     /** Emit a ldc (or ldc_w) instruction, taking into account operand size
     */
     public void emitLdc(int od) {

@@ -1209,10 +1211,19 @@
         if (debugCode) System.err.println("entry point " + state);
         pendingStackMap = needStackMap;
         return pc;
     }
 
+    public int setLetExprStackPos(int pos) {
+        int res = letExprStackPos;
+        letExprStackPos = pos;
+        return res;
+    }
+
+    public boolean isStatementStart() {
+        return state.stacksize == letExprStackPos;
+    }
 
 /**************************************************************************
  * Stack map generation
  *************************************************************************/
 

@@ -1472,11 +1483,11 @@
     public void resolve(Chain chain, int target) {
         boolean changed = false;
         State newState = state;
         for (; chain != null; chain = chain.next) {
             Assert.check(state != chain.state
-                    && (target > chain.pc || state.stacksize == 0));
+                    && (target > chain.pc || isStatementStart()));
             if (target >= cp) {
                 target = cp;
             } else if (get1(target) == goto_) {
                 if (fatcode) target = target + get4(target + 1);
                 else target = target + get2(target + 1);
< prev index next >