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

changeset 2178
cc80c03c41e4
parent 2047
5f915a0c9615
child 2186
6e0f31d61e56
     1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Code.java	Wed Oct 30 14:12:16 2013 -0400
     1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java	Fri Nov 01 19:08:56 2013 +0000
     1.3 @@ -1790,8 +1790,9 @@
     1.4  
     1.5          void markInitialized(UninitializedType old) {
     1.6              Type newtype = old.initializedType();
     1.7 -            for (int i=0; i<stacksize; i++)
     1.8 +            for (int i=0; i<stacksize; i++) {
     1.9                  if (stack[i] == old) stack[i] = newtype;
    1.10 +            }
    1.11              for (int i=0; i<lvar.length; i++) {
    1.12                  LocalVar lv = lvar[i];
    1.13                  if (lv != null && lv.sym.type == old) {
    1.14 @@ -2112,7 +2113,6 @@
    1.15      private void endScope(int adr) {
    1.16          LocalVar v = lvar[adr];
    1.17          if (v != null) {
    1.18 -            lvar[adr] = null;
    1.19              if (v.isLastRangeInitialized()) {
    1.20                  char length = (char)(curCP() - v.lastRange().start_pc);
    1.21                  if (length < Character.MAX_VALUE) {
    1.22 @@ -2121,6 +2121,12 @@
    1.23                      fillLocalVarPosition(v);
    1.24                  }
    1.25              }
    1.26 +            /** the call to curCP() can implicitly adjust the current cp, if so
    1.27 +             * the alive range of local variables may be modified. Thus we need
    1.28 +             * all of them. For this reason assigning null to the given address
    1.29 +             * should be the last action to do.
    1.30 +             */
    1.31 +            lvar[adr] = null;
    1.32          }
    1.33          state.defined.excl(adr);
    1.34      }

mercurial