1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/StackMapper.java Mon Feb 17 12:08:31 2014 +0100
1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/StackMapper.java Wed May 07 10:01:54 2014 +0200
1.3 @@ -23,6 +23,7 @@
1.4 final class StackMapper {
1.5 private final TypeArray stackTypeIndexPairs;
1.6 private final StringArray stackValues;
1.7 + private boolean dirty;
1.8
1.9 public StackMapper() {
1.10 stackTypeIndexPairs = new TypeArray();
1.11 @@ -32,6 +33,7 @@
1.12 public void clear() {
1.13 stackTypeIndexPairs.clear();
1.14 stackValues.clear();
1.15 + dirty = false;
1.16 }
1.17
1.18 public void syncWithFrameStack(final TypeArray frameStack) {
1.19 @@ -70,7 +72,7 @@
1.20 void assign(Appendable out, int varType, CharSequence s) throws IOException {
1.21 pushTypeAndValue(varType, s);
1.22 }
1.23 -
1.24 +
1.25 void replace(Appendable out, int varType, String format, CharSequence... arr)
1.26 throws IOException {
1.27 StringBuilder sb = new StringBuilder();
1.28 @@ -78,6 +80,7 @@
1.29 String[] values = stackValues.toArray();
1.30 final int last = stackTypeIndexPairs.getSize() - 1;
1.31 values[last] = sb.toString();
1.32 + dirty = true;
1.33 final int value = (last << 8) | (varType & 0xff);
1.34 stackTypeIndexPairs.set(last, value);
1.35 }
1.36 @@ -92,6 +95,11 @@
1.37 CharSequence var = getVariable(stackTypeIndexPairs.get(i));
1.38 ByteCodeToJavaScript.emitImpl(out, "var @1 = @2;", var, val);
1.39 }
1.40 + dirty = false;
1.41 + }
1.42 +
1.43 + public boolean isDirty() {
1.44 + return dirty;
1.45 }
1.46
1.47 public CharSequence popI() {
1.48 @@ -216,6 +224,7 @@
1.49 } else {
1.50 stackValues.add(val);
1.51 }
1.52 + dirty = true;
1.53 }
1.54
1.55 private void popImpl(final int count) {