vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java
branchregisters
changeset 697 873df84db4f7
parent 639 960ecf7cea5d
child 712 a84cb25dde74
     1.1 --- a/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Fri Feb 01 15:19:16 2013 +0100
     1.2 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Thu Feb 07 14:07:52 2013 +0100
     1.3 @@ -631,7 +631,7 @@
     1.4                      final int varIndx = wide ? readUShort(byteCodes, i++)
     1.5                                               : readUByte(byteCodes, i);
     1.6                      ++i;
     1.7 -                    final int incrBy = wide ? readIntArg(byteCodes, i++)
     1.8 +                    final int incrBy = wide ? readShort(byteCodes, i++)
     1.9                                              : byteCodes[i];
    1.10                      wide = false;
    1.11                      if (incrBy == 1) {
    1.12 @@ -1344,20 +1344,25 @@
    1.13          final int indxLo = byteCodes[offsetInstruction + 2];
    1.14          return (indxHi & 0xffffff00) | (indxLo & 0xff);
    1.15      }
    1.16 -    private int readInt4(byte[] byteCodes, int offsetInstruction) {
    1.17 -        final int d = byteCodes[offsetInstruction + 0] << 24;
    1.18 -        final int c = byteCodes[offsetInstruction + 1] << 16;
    1.19 -        final int b = byteCodes[offsetInstruction + 2] << 8;
    1.20 -        final int a = byteCodes[offsetInstruction + 3];
    1.21 +    private int readInt4(byte[] byteCodes, int offset) {
    1.22 +        final int d = byteCodes[offset + 0] << 24;
    1.23 +        final int c = byteCodes[offset + 1] << 16;
    1.24 +        final int b = byteCodes[offset + 2] << 8;
    1.25 +        final int a = byteCodes[offset + 3];
    1.26          return (d & 0xff000000) | (c & 0xff0000) | (b & 0xff00) | (a & 0xff);
    1.27      }
    1.28 -    private int readUByte(byte[] byteCodes, int offsetInstruction) {
    1.29 -        return byteCodes[offsetInstruction] & 0xff;
    1.30 +    private int readUByte(byte[] byteCodes, int offset) {
    1.31 +        return byteCodes[offset] & 0xff;
    1.32      }
    1.33  
    1.34 -    private int readUShort(byte[] byteCodes, int offsetInstruction) {
    1.35 -        return ((byteCodes[offsetInstruction] & 0xff) << 8)
    1.36 -                    | (byteCodes[offsetInstruction + 1] & 0xff);
    1.37 +    private int readUShort(byte[] byteCodes, int offset) {
    1.38 +        return ((byteCodes[offset] & 0xff) << 8)
    1.39 +                    | (byteCodes[offset + 1] & 0xff);
    1.40 +    }
    1.41 +
    1.42 +    private int readShort(byte[] byteCodes, int offset) {
    1.43 +        return (byteCodes[offset] << 8)
    1.44 +                    | (byteCodes[offset + 1] & 0xff);
    1.45      }
    1.46  
    1.47      private static void countArgs(String descriptor, char[] returnType, StringBuilder sig, StringBuilder cnt) {