1.1 --- a/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java Mon Feb 11 19:55:00 2013 +0100
1.2 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java Fri Feb 15 21:14:49 2013 +0100
1.3 @@ -600,7 +600,7 @@
1.4 emit(out, "@1 = @1.xor64(@2);", smapper.getL(1), smapper.popL());
1.5 break;
1.6 case opc_ineg:
1.7 - emit(out, "@1 = -@1;", smapper.getI(0));
1.8 + emit(out, "@1 = @1.neg32();", smapper.getI(0));
1.9 break;
1.10 case opc_lneg:
1.11 emit(out, "@1 = @1.neg64();", smapper.getL(0));
1.12 @@ -634,7 +634,7 @@
1.13 final int varIndx = wide ? readUShort(byteCodes, i++)
1.14 : readUByte(byteCodes, i);
1.15 ++i;
1.16 - final int incrBy = wide ? readIntArg(byteCodes, i++)
1.17 + final int incrBy = wide ? readShort(byteCodes, i++)
1.18 : byteCodes[i];
1.19 wide = false;
1.20 if (incrBy == 1) {
1.21 @@ -1355,20 +1355,25 @@
1.22 final int indxLo = byteCodes[offsetInstruction + 2];
1.23 return (indxHi & 0xffffff00) | (indxLo & 0xff);
1.24 }
1.25 - private int readInt4(byte[] byteCodes, int offsetInstruction) {
1.26 - final int d = byteCodes[offsetInstruction + 0] << 24;
1.27 - final int c = byteCodes[offsetInstruction + 1] << 16;
1.28 - final int b = byteCodes[offsetInstruction + 2] << 8;
1.29 - final int a = byteCodes[offsetInstruction + 3];
1.30 + private int readInt4(byte[] byteCodes, int offset) {
1.31 + final int d = byteCodes[offset + 0] << 24;
1.32 + final int c = byteCodes[offset + 1] << 16;
1.33 + final int b = byteCodes[offset + 2] << 8;
1.34 + final int a = byteCodes[offset + 3];
1.35 return (d & 0xff000000) | (c & 0xff0000) | (b & 0xff00) | (a & 0xff);
1.36 }
1.37 - private int readUByte(byte[] byteCodes, int offsetInstruction) {
1.38 - return byteCodes[offsetInstruction] & 0xff;
1.39 + private int readUByte(byte[] byteCodes, int offset) {
1.40 + return byteCodes[offset] & 0xff;
1.41 }
1.42
1.43 - private int readUShort(byte[] byteCodes, int offsetInstruction) {
1.44 - return ((byteCodes[offsetInstruction] & 0xff) << 8)
1.45 - | (byteCodes[offsetInstruction + 1] & 0xff);
1.46 + private int readUShort(byte[] byteCodes, int offset) {
1.47 + return ((byteCodes[offset] & 0xff) << 8)
1.48 + | (byteCodes[offset + 1] & 0xff);
1.49 + }
1.50 +
1.51 + private int readShort(byte[] byteCodes, int offset) {
1.52 + return (byteCodes[offset] << 8)
1.53 + | (byteCodes[offset + 1] & 0xff);
1.54 }
1.55
1.56 private static void countArgs(String descriptor, char[] returnType, StringBuilder sig, StringBuilder cnt) {