Saving some space by using single letter variable instead of 'stack'
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 29 Nov 2012 11:07:05 +0100
changeset 2207c26f96bba59
parent 219 f395bd3e477c
child 222 1f4a029d2826
child 224 7aa36c48c634
Saving some space by using single letter variable instead of 'stack'
vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java
     1.1 --- a/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Thu Nov 29 10:47:49 2012 +0100
     1.2 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Thu Nov 29 11:07:05 2012 +0100
     1.3 @@ -163,7 +163,7 @@
     1.4                  out.append("  var ");
     1.5                  out.append("arg").append(String.valueOf(i)).append(";\n");
     1.6              }
     1.7 -            out.append("  var stack = new Array();\n");
     1.8 +            out.append("  var s = new Array();\n");
     1.9              produceCode(code);
    1.10          } else {
    1.11              out.append("  /* no code found for ").append(m.getInternalSig()).append(" */\n");
    1.12 @@ -197,7 +197,7 @@
    1.13                  out.append("  var ");
    1.14                  out.append("arg").append(String.valueOf(i + 1)).append(";\n");
    1.15              }
    1.16 -            out.append(";\n  var stack = new Array();\n");
    1.17 +            out.append(";\n  var s = new Array();\n");
    1.18              produceCode(code);
    1.19          } else {
    1.20              out.append("  /* no code found for ").append(m.getInternalSig()).append(" */\n");
    1.21 @@ -217,28 +217,28 @@
    1.22                  case opc_lload_0:
    1.23                  case opc_fload_0:
    1.24                  case opc_dload_0:
    1.25 -                    out.append("stack.push(arg0);");
    1.26 +                    out.append("s.push(arg0);");
    1.27                      break;
    1.28                  case opc_aload_1:
    1.29                  case opc_iload_1:
    1.30                  case opc_lload_1:
    1.31                  case opc_fload_1:
    1.32                  case opc_dload_1:
    1.33 -                    out.append("stack.push(arg1);");
    1.34 +                    out.append("s.push(arg1);");
    1.35                      break;
    1.36                  case opc_aload_2:
    1.37                  case opc_iload_2:
    1.38                  case opc_lload_2:
    1.39                  case opc_fload_2:
    1.40                  case opc_dload_2:
    1.41 -                    out.append("stack.push(arg2);");
    1.42 +                    out.append("s.push(arg2);");
    1.43                      break;
    1.44                  case opc_aload_3:
    1.45                  case opc_iload_3:
    1.46                  case opc_lload_3:
    1.47                  case opc_fload_3:
    1.48                  case opc_dload_3:
    1.49 -                    out.append("stack.push(arg3);");
    1.50 +                    out.append("s.push(arg3);");
    1.51                      break;
    1.52                  case opc_iload:
    1.53                  case opc_lload:
    1.54 @@ -246,7 +246,7 @@
    1.55                  case opc_dload:
    1.56                  case opc_aload: {
    1.57                      final int indx = readByte(byteCodes, ++i);
    1.58 -                    out.append("stack.push(arg").append(indx + ");");
    1.59 +                    out.append("s.push(arg").append(indx + ");");
    1.60                      break;
    1.61                  }
    1.62                  case opc_istore:
    1.63 @@ -255,7 +255,7 @@
    1.64                  case opc_dstore:
    1.65                  case opc_astore: {
    1.66                      final int indx = readByte(byteCodes, ++i);
    1.67 -                    out.append("arg" + indx).append(" = stack.pop();");
    1.68 +                    out.append("arg" + indx).append(" = s.pop();");
    1.69                      break;
    1.70                  }
    1.71                  case opc_astore_0:
    1.72 @@ -263,90 +263,90 @@
    1.73                  case opc_lstore_0:
    1.74                  case opc_fstore_0:
    1.75                  case opc_dstore_0:
    1.76 -                    out.append("arg0 = stack.pop();");
    1.77 +                    out.append("arg0 = s.pop();");
    1.78                      break;
    1.79                  case opc_astore_1:
    1.80                  case opc_istore_1:
    1.81                  case opc_lstore_1:
    1.82                  case opc_fstore_1:
    1.83                  case opc_dstore_1:
    1.84 -                    out.append("arg1 = stack.pop();");
    1.85 +                    out.append("arg1 = s.pop();");
    1.86                      break;
    1.87                  case opc_astore_2:
    1.88                  case opc_istore_2:
    1.89                  case opc_lstore_2:
    1.90                  case opc_fstore_2:
    1.91                  case opc_dstore_2:
    1.92 -                    out.append("arg2 = stack.pop();");
    1.93 +                    out.append("arg2 = s.pop();");
    1.94                      break;
    1.95                  case opc_astore_3:
    1.96                  case opc_istore_3:
    1.97                  case opc_lstore_3:
    1.98                  case opc_fstore_3:
    1.99                  case opc_dstore_3:
   1.100 -                    out.append("arg3 = stack.pop();");
   1.101 +                    out.append("arg3 = s.pop();");
   1.102                      break;
   1.103                  case opc_iadd:
   1.104                  case opc_ladd:
   1.105                  case opc_fadd:
   1.106                  case opc_dadd:
   1.107 -                    out.append("stack.push(stack.pop() + stack.pop());");
   1.108 +                    out.append("s.push(s.pop() + s.pop());");
   1.109                      break;
   1.110                  case opc_isub:
   1.111                  case opc_lsub:
   1.112                  case opc_fsub:
   1.113                  case opc_dsub:
   1.114 -                    out.append("{ var tmp = stack.pop(); stack.push(stack.pop() - tmp); }");
   1.115 +                    out.append("{ var tmp = s.pop(); s.push(s.pop() - tmp); }");
   1.116                      break;
   1.117                  case opc_imul:
   1.118                  case opc_lmul:
   1.119                  case opc_fmul:
   1.120                  case opc_dmul:
   1.121 -                    out.append("stack.push(stack.pop() * stack.pop());");
   1.122 +                    out.append("s.push(s.pop() * s.pop());");
   1.123                      break;
   1.124                  case opc_idiv:
   1.125                  case opc_ldiv:
   1.126 -                    out.append("{ var tmp = stack.pop(); stack.push(Math.floor(stack.pop() / tmp)); }");
   1.127 +                    out.append("{ var tmp = s.pop(); s.push(Math.floor(s.pop() / tmp)); }");
   1.128                      break;
   1.129                  case opc_fdiv:
   1.130                  case opc_ddiv:
   1.131 -                    out.append("{ var tmp = stack.pop(); stack.push(stack.pop() / tmp); }");
   1.132 +                    out.append("{ var tmp = s.pop(); s.push(s.pop() / tmp); }");
   1.133                      break;
   1.134                  case opc_irem:
   1.135                  case opc_lrem:
   1.136                  case opc_frem:
   1.137                  case opc_drem:
   1.138 -                    out.append("{ var d = stack.pop(); stack.push(stack.pop() % d); }");
   1.139 +                    out.append("{ var d = s.pop(); s.push(s.pop() % d); }");
   1.140                      break;
   1.141                  case opc_iand:
   1.142                  case opc_land:
   1.143 -                    out.append("stack.push(stack.pop() & stack.pop());");
   1.144 +                    out.append("s.push(s.pop() & s.pop());");
   1.145                      break;
   1.146                  case opc_ior:
   1.147                  case opc_lor:
   1.148 -                    out.append("stack.push(stack.pop() | stack.pop());");
   1.149 +                    out.append("s.push(s.pop() | s.pop());");
   1.150                      break;
   1.151                  case opc_ixor:
   1.152                  case opc_lxor:
   1.153 -                    out.append("stack.push(stack.pop() ^ stack.pop());");
   1.154 +                    out.append("s.push(s.pop() ^ s.pop());");
   1.155                      break;
   1.156                  case opc_ineg:
   1.157                  case opc_lneg:
   1.158                  case opc_fneg:
   1.159                  case opc_dneg:
   1.160 -                    out.append("stack.push(- stack.pop());");
   1.161 +                    out.append("s.push(- s.pop());");
   1.162                      break;
   1.163                  case opc_ishl:
   1.164                  case opc_lshl:
   1.165 -                    out.append("{ var v = stack.pop(); stack.push(stack.pop() << v); }");
   1.166 +                    out.append("{ var v = s.pop(); s.push(s.pop() << v); }");
   1.167                      break;
   1.168                  case opc_ishr:
   1.169                  case opc_lshr:
   1.170 -                    out.append("{ var v = stack.pop(); stack.push(stack.pop() >> v); }");
   1.171 +                    out.append("{ var v = s.pop(); s.push(s.pop() >> v); }");
   1.172                      break;
   1.173                  case opc_iushr:
   1.174                  case opc_lushr:
   1.175 -                    out.append("{ var v = stack.pop(); stack.push(stack.pop() >>> v); }");
   1.176 +                    out.append("{ var v = s.pop(); s.push(s.pop() >>> v); }");
   1.177                      break;
   1.178                  case opc_iinc: {
   1.179                      final int varIndx = readByte(byteCodes, ++i);
   1.180 @@ -366,7 +366,7 @@
   1.181                  case opc_freturn:
   1.182                  case opc_dreturn:
   1.183                  case opc_areturn:
   1.184 -                    out.append("return stack.pop();");
   1.185 +                    out.append("return s.pop();");
   1.186                      break;
   1.187                  case opc_i2l:
   1.188                  case opc_i2f:
   1.189 @@ -383,7 +383,7 @@
   1.190                  case opc_f2l:
   1.191                  case opc_d2i:
   1.192                  case opc_d2l:
   1.193 -                    out.append("stack.push(Math.floor(stack.pop()));");
   1.194 +                    out.append("s.push(Math.floor(s.pop()));");
   1.195                      break;
   1.196                  case opc_i2b:
   1.197                  case opc_i2c:
   1.198 @@ -391,40 +391,40 @@
   1.199                      out.append("/* number conversion */");
   1.200                      break;
   1.201                  case opc_aconst_null:
   1.202 -                    out.append("stack.push(null);");
   1.203 +                    out.append("s.push(null);");
   1.204                      break;
   1.205                  case opc_iconst_m1:
   1.206 -                    out.append("stack.push(-1);");
   1.207 +                    out.append("s.push(-1);");
   1.208                      break;
   1.209                  case opc_iconst_0:
   1.210                  case opc_dconst_0:
   1.211                  case opc_lconst_0:
   1.212                  case opc_fconst_0:
   1.213 -                    out.append("stack.push(0);");
   1.214 +                    out.append("s.push(0);");
   1.215                      break;
   1.216                  case opc_iconst_1:
   1.217                  case opc_lconst_1:
   1.218                  case opc_fconst_1:
   1.219                  case opc_dconst_1:
   1.220 -                    out.append("stack.push(1);");
   1.221 +                    out.append("s.push(1);");
   1.222                      break;
   1.223                  case opc_iconst_2:
   1.224                  case opc_fconst_2:
   1.225 -                    out.append("stack.push(2);");
   1.226 +                    out.append("s.push(2);");
   1.227                      break;
   1.228                  case opc_iconst_3:
   1.229 -                    out.append("stack.push(3);");
   1.230 +                    out.append("s.push(3);");
   1.231                      break;
   1.232                  case opc_iconst_4:
   1.233 -                    out.append("stack.push(4);");
   1.234 +                    out.append("s.push(4);");
   1.235                      break;
   1.236                  case opc_iconst_5:
   1.237 -                    out.append("stack.push(5);");
   1.238 +                    out.append("s.push(5);");
   1.239                      break;
   1.240                  case opc_ldc: {
   1.241                      int indx = readByte(byteCodes, ++i);
   1.242                      String v = encodeConstant(indx);
   1.243 -                    out.append("stack.push(").append(v).append(");");
   1.244 +                    out.append("s.push(").append(v).append(");");
   1.245                      break;
   1.246                  }
   1.247                  case opc_ldc_w:
   1.248 @@ -432,7 +432,7 @@
   1.249                      int indx = readIntArg(byteCodes, i);
   1.250                      i += 2;
   1.251                      String v = encodeConstant(indx);
   1.252 -                    out.append("stack.push(").append(v).append(");");
   1.253 +                    out.append("s.push(").append(v).append(");");
   1.254                      break;
   1.255                  }
   1.256                  case opc_lcmp:
   1.257 @@ -440,7 +440,7 @@
   1.258                  case opc_fcmpg:
   1.259                  case opc_dcmpl:
   1.260                  case opc_dcmpg: {
   1.261 -                    out.append("{ var delta = stack.pop() - stack.pop(); stack.push(delta < 0 ?-1 : (delta == 0 ? 0 : 1)); }");
   1.262 +                    out.append("{ var delta = s.pop() - s.pop(); s.push(delta < 0 ?-1 : (delta == 0 ? 0 : 1)); }");
   1.263                      break;
   1.264                  }
   1.265                  case opc_if_acmpeq:
   1.266 @@ -455,56 +455,56 @@
   1.267                  }
   1.268                  case opc_ifeq: {
   1.269                      int indx = i + readIntArg(byteCodes, i);
   1.270 -                    out.append("if (stack.pop() == 0) { gt = " + indx);
   1.271 +                    out.append("if (s.pop() == 0) { gt = " + indx);
   1.272                      out.append("; continue; }");
   1.273                      i += 2;
   1.274                      break;
   1.275                  }
   1.276                  case opc_ifne: {
   1.277                      int indx = i + readIntArg(byteCodes, i);
   1.278 -                    out.append("if (stack.pop() != 0) { gt = " + indx);
   1.279 +                    out.append("if (s.pop() != 0) { gt = " + indx);
   1.280                      out.append("; continue; }");
   1.281                      i += 2;
   1.282                      break;
   1.283                  }
   1.284                  case opc_iflt: {
   1.285                      int indx = i + readIntArg(byteCodes, i);
   1.286 -                    out.append("if (stack.pop() < 0) { gt = " + indx);
   1.287 +                    out.append("if (s.pop() < 0) { gt = " + indx);
   1.288                      out.append("; continue; }");
   1.289                      i += 2;
   1.290                      break;
   1.291                  }
   1.292                  case opc_ifle: {
   1.293                      int indx = i + readIntArg(byteCodes, i);
   1.294 -                    out.append("if (stack.pop() <= 0) { gt = " + indx);
   1.295 +                    out.append("if (s.pop() <= 0) { gt = " + indx);
   1.296                      out.append("; continue; }");
   1.297                      i += 2;
   1.298                      break;
   1.299                  }
   1.300                  case opc_ifgt: {
   1.301                      int indx = i + readIntArg(byteCodes, i);
   1.302 -                    out.append("if (stack.pop() > 0) { gt = " + indx);
   1.303 +                    out.append("if (s.pop() > 0) { gt = " + indx);
   1.304                      out.append("; continue; }");
   1.305                      i += 2;
   1.306                      break;
   1.307                  }
   1.308                  case opc_ifge: {
   1.309                      int indx = i + readIntArg(byteCodes, i);
   1.310 -                    out.append("if (stack.pop() >= 0) { gt = " + indx);
   1.311 +                    out.append("if (s.pop() >= 0) { gt = " + indx);
   1.312                      out.append("; continue; }");
   1.313                      i += 2;
   1.314                      break;
   1.315                  }
   1.316                  case opc_ifnonnull: {
   1.317                      int indx = i + readIntArg(byteCodes, i);
   1.318 -                    out.append("if (stack.pop() !== null) { gt = " + indx);
   1.319 +                    out.append("if (s.pop() !== null) { gt = " + indx);
   1.320                      out.append("; continue; }");
   1.321                      i += 2;
   1.322                      break;
   1.323                  }
   1.324                  case opc_ifnull: {
   1.325                      int indx = i + readIntArg(byteCodes, i);
   1.326 -                    out.append("if (stack.pop() === null) { gt = " + indx);
   1.327 +                    out.append("if (s.pop() === null) { gt = " + indx);
   1.328                      out.append("; continue; }");
   1.329                      i += 2;
   1.330                      break;
   1.331 @@ -536,7 +536,7 @@
   1.332                      table += 4;
   1.333                      int n = readInt4(byteCodes, table);
   1.334                      table += 4;
   1.335 -                    out.append("switch (stack.pop()) {\n");
   1.336 +                    out.append("switch (s.pop()) {\n");
   1.337                      while (n-- > 0) {
   1.338                          int cnstnt = readInt4(byteCodes, table);
   1.339                          table += 4;
   1.340 @@ -556,7 +556,7 @@
   1.341                      table += 4;
   1.342                      int high = readInt4(byteCodes, table);
   1.343                      table += 4;
   1.344 -                    out.append("switch (stack.pop()) {\n");
   1.345 +                    out.append("switch (s.pop()) {\n");
   1.346                      while (low <= high) {
   1.347                          int offset = i + readInt4(byteCodes, table);
   1.348                          table += 4;
   1.349 @@ -583,7 +583,7 @@
   1.350                  case opc_new: {
   1.351                      int indx = readIntArg(byteCodes, i);
   1.352                      String ci = jc.getClassName(indx);
   1.353 -                    out.append("stack.push(");
   1.354 +                    out.append("s.push(");
   1.355                      out.append("new ").append(ci.replace('/','_'));
   1.356                      out.append(");");
   1.357                      addReference(ci);
   1.358 @@ -592,20 +592,20 @@
   1.359                  }
   1.360                  case opc_newarray: {
   1.361                      int type = byteCodes[i++];
   1.362 -                    out.append("stack.push(new Array(stack.pop()).fillNulls());");
   1.363 +                    out.append("s.push(new Array(s.pop()).fillNulls());");
   1.364                      break;
   1.365                  }
   1.366                  case opc_anewarray: {
   1.367                      i += 2; // skip type of array
   1.368 -                    out.append("stack.push(new Array(stack.pop()).fillNulls());");
   1.369 +                    out.append("s.push(new Array(s.pop()).fillNulls());");
   1.370                      break;
   1.371                  }
   1.372                  case opc_multianewarray: {
   1.373                      i += 2;
   1.374                      int dim = readByte(byteCodes, ++i);
   1.375 -                    out.append("{ var a0 = new Array(stack.pop()).fillNulls();");
   1.376 +                    out.append("{ var a0 = new Array(s.pop()).fillNulls();");
   1.377                      for (int d = 1; d < dim; d++) {
   1.378 -                        out.append("\n  var l" + d).append(" = stack.pop();");
   1.379 +                        out.append("\n  var l" + d).append(" = s.pop();");
   1.380                          out.append("\n  for (var i" + d).append (" = 0; i" + d).
   1.381                              append(" < a" + (d - 1)).
   1.382                              append(".length; i" + d).append("++) {");
   1.383 @@ -617,11 +617,11 @@
   1.384                      for (int d = 1; d < dim; d++) {
   1.385                          out.append("\n  }");
   1.386                      }
   1.387 -                    out.append("\nstack.push(a0); }");
   1.388 +                    out.append("\ns.push(a0); }");
   1.389                      break;
   1.390                  }
   1.391                  case opc_arraylength:
   1.392 -                    out.append("stack.push(stack.pop().length);");
   1.393 +                    out.append("s.push(s.pop().length);");
   1.394                      break;
   1.395                  case opc_iastore:
   1.396                  case opc_lastore:
   1.397 @@ -631,7 +631,7 @@
   1.398                  case opc_bastore:
   1.399                  case opc_castore:
   1.400                  case opc_sastore: {
   1.401 -                    out.append("{ var value = stack.pop(); var indx = stack.pop(); stack.pop()[indx] = value; }");
   1.402 +                    out.append("{ var value = s.pop(); var indx = s.pop(); s.pop()[indx] = value; }");
   1.403                      break;
   1.404                  }
   1.405                  case opc_iaload:
   1.406 @@ -642,34 +642,34 @@
   1.407                  case opc_baload:
   1.408                  case opc_caload:
   1.409                  case opc_saload: {
   1.410 -                    out.append("{ var indx = stack.pop(); stack.push(stack.pop()[indx]); }");
   1.411 +                    out.append("{ var indx = s.pop(); s.push(s.pop()[indx]); }");
   1.412                      break;
   1.413                  }
   1.414                  case opc_pop2:
   1.415 -                    out.append("stack.pop();");
   1.416 +                    out.append("s.pop();");
   1.417                  case opc_pop:
   1.418 -                    out.append("stack.pop();");
   1.419 +                    out.append("s.pop();");
   1.420                      break;
   1.421                  case opc_dup:
   1.422 -                    out.append("stack.push(stack[stack.length - 1]);");
   1.423 +                    out.append("s.push(s[s.length - 1]);");
   1.424                      break;
   1.425                  case opc_dup_x1:
   1.426 -                    out.append("{ var v1 = stack.pop(); var v2 = stack.pop(); stack.push(v1); stack.push(v2); stack.push(v1); }");
   1.427 +                    out.append("{ var v1 = s.pop(); var v2 = s.pop(); s.push(v1); s.push(v2); s.push(v1); }");
   1.428                      break;
   1.429                  case opc_dup_x2:
   1.430 -                    out.append("{ var v1 = stack.pop(); var v2 = stack.pop(); var v3 = stack.pop(); stack.push(v1); stack.push(v3); stack.push(v2); stack.push(v1); }");
   1.431 +                    out.append("{ var v1 = s.pop(); var v2 = s.pop(); var v3 = s.pop(); s.push(v1); s.push(v3); s.push(v2); s.push(v1); }");
   1.432                      break;
   1.433                  case opc_bipush:
   1.434 -                    out.append("stack.push(" + byteCodes[++i] + ");");
   1.435 +                    out.append("s.push(" + byteCodes[++i] + ");");
   1.436                      break;
   1.437                  case opc_sipush:
   1.438 -                    out.append("stack.push(" + readIntArg(byteCodes, i) + ");");
   1.439 +                    out.append("s.push(" + readIntArg(byteCodes, i) + ");");
   1.440                      i += 2;
   1.441                      break;
   1.442                  case opc_getfield: {
   1.443                      int indx = readIntArg(byteCodes, i);
   1.444                      String[] fi = jc.getFieldInfoName(indx);
   1.445 -                    out.append("stack.push(stack.pop().fld_").
   1.446 +                    out.append("s.push(s.pop().fld_").
   1.447                          append(fi[1]).append(");");
   1.448                      i += 2;
   1.449                      break;
   1.450 @@ -677,7 +677,7 @@
   1.451                  case opc_getstatic: {
   1.452                      int indx = readIntArg(byteCodes, i);
   1.453                      String[] fi = jc.getFieldInfoName(indx);
   1.454 -                    out.append("stack.push(").append(fi[0].replace('/', '_'));
   1.455 +                    out.append("s.push(").append(fi[0].replace('/', '_'));
   1.456                      out.append('.').append(fi[1]).append(");");
   1.457                      i += 2;
   1.458                      addReference(fi[0]);
   1.459 @@ -687,7 +687,7 @@
   1.460                      int indx = readIntArg(byteCodes, i);
   1.461                      String[] fi = jc.getFieldInfoName(indx);
   1.462                      out.append(fi[0].replace('/', '_'));
   1.463 -                    out.append('.').append(fi[1]).append(" = stack.pop();");
   1.464 +                    out.append('.').append(fi[1]).append(" = s.pop();");
   1.465                      i += 2;
   1.466                      addReference(fi[0]);
   1.467                      break;
   1.468 @@ -695,7 +695,7 @@
   1.469                  case opc_putfield: {
   1.470                      int indx = readIntArg(byteCodes, i);
   1.471                      String[] fi = jc.getFieldInfoName(indx);
   1.472 -                    out.append("{ var v = stack.pop(); stack.pop().fld_")
   1.473 +                    out.append("{ var v = s.pop(); s.pop().fld_")
   1.474                         .append(fi[1]).append(" = v; }");
   1.475                      i += 2;
   1.476                      break;
   1.477 @@ -705,7 +705,7 @@
   1.478                      final String type = jc.getClassName(indx);
   1.479                      if (!type.startsWith("[")) {
   1.480                          // no way to check arrays right now
   1.481 -                        out.append("if(stack[stack.length - 1].$instOf_")
   1.482 +                        out.append("if(s[s.length - 1].$instOf_")
   1.483                             .append(type.replace('/', '_'))
   1.484                             .append(" != 1) throw {};"); // XXX proper exception
   1.485                      }
   1.486 @@ -715,14 +715,14 @@
   1.487                  case opc_instanceof: {
   1.488                      int indx = readIntArg(byteCodes, i);
   1.489                      final String type = jc.getClassName(indx);
   1.490 -                    out.append("stack.push(stack.pop().$instOf_")
   1.491 +                    out.append("s.push(s.pop().$instOf_")
   1.492                         .append(type.replace('/', '_'))
   1.493                         .append(" ? 1 : 0);");
   1.494                      i += 2;
   1.495                      break;
   1.496                  }
   1.497                  case opc_athrow: {
   1.498 -                    out.append("{ var t = stack.pop(); stack = new Array(1); stack[0] = t; throw t; }");
   1.499 +                    out.append("{ var t = s.pop(); s = new Array(1); s[0] = t; throw t; }");
   1.500                      break;
   1.501                  }
   1.502                  default: {
   1.503 @@ -743,7 +743,7 @@
   1.504  
   1.505      private int generateIf(byte[] byteCodes, int i, final String test) throws IOException {
   1.506          int indx = i + readIntArg(byteCodes, i);
   1.507 -        out.append("if (stack.pop() ").append(test).append(" stack.pop()) { gt = " + indx);
   1.508 +        out.append("if (s.pop() ").append(test).append(" s.pop()) { gt = " + indx);
   1.509          out.append("; continue; }");
   1.510          return i + 2;
   1.511      }
   1.512 @@ -878,11 +878,11 @@
   1.513          String mn = findMethodName(mi, cnt, hasReturn);
   1.514          out.append("{ ");
   1.515          for (int j = cnt.length() - 1; j >= 0; j--) {
   1.516 -            out.append("var v" + j).append(" = stack.pop(); ");
   1.517 +            out.append("var v" + j).append(" = s.pop(); ");
   1.518          }
   1.519          
   1.520          if (hasReturn[0]) {
   1.521 -            out.append("stack.push(");
   1.522 +            out.append("s.push(");
   1.523          }
   1.524          final String in = mi[0];
   1.525          out.append(in.replace('/', '_'));
   1.526 @@ -891,7 +891,7 @@
   1.527          out.append('(');
   1.528          String sep = "";
   1.529          if (!isStatic) {
   1.530 -            out.append("stack.pop()");
   1.531 +            out.append("s.pop()");
   1.532              sep = ", ";
   1.533          }
   1.534          for (int j = 0; j < cnt.length(); j++) {
   1.535 @@ -917,11 +917,11 @@
   1.536          String mn = findMethodName(mi, cnt, hasReturn);
   1.537          out.append("{ ");
   1.538          for (int j = cnt.length() - 1; j >= 0; j--) {
   1.539 -            out.append("var v" + j).append(" = stack.pop(); ");
   1.540 +            out.append("var v" + j).append(" = s.pop(); ");
   1.541          }
   1.542 -        out.append("var self = stack.pop(); ");
   1.543 +        out.append("var self = s.pop(); ");
   1.544          if (hasReturn[0]) {
   1.545 -            out.append("stack.push(");
   1.546 +            out.append("s.push(");
   1.547          }
   1.548          out.append("self.");
   1.549          out.append(mn);