# HG changeset patch # User Jaroslav Tulach # Date 1360666013 -3600 # Node ID a84cb25dde7469a995f8169ebf20538b2b27f74d # Parent 4fe8b3dfc55f85d7ce67a0f7692db3c40e530f00# Parent 873df84db4f7a0b1bde592a00bb32eb432cab854 Merge of Lubo's fix for java.net bug #4649 diff -r 4fe8b3dfc55f -r a84cb25dde74 vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java --- a/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java Fri Feb 08 11:12:02 2013 +0100 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java Tue Feb 12 11:46:53 2013 +0100 @@ -632,7 +632,7 @@ final int varIndx = wide ? readUShort(byteCodes, i++) : readUByte(byteCodes, i); ++i; - final int incrBy = wide ? readIntArg(byteCodes, i++) + final int incrBy = wide ? readShort(byteCodes, i++) : byteCodes[i]; wide = false; if (incrBy == 1) { @@ -1353,20 +1353,25 @@ final int indxLo = byteCodes[offsetInstruction + 2]; return (indxHi & 0xffffff00) | (indxLo & 0xff); } - private int readInt4(byte[] byteCodes, int offsetInstruction) { - final int d = byteCodes[offsetInstruction + 0] << 24; - final int c = byteCodes[offsetInstruction + 1] << 16; - final int b = byteCodes[offsetInstruction + 2] << 8; - final int a = byteCodes[offsetInstruction + 3]; + private int readInt4(byte[] byteCodes, int offset) { + final int d = byteCodes[offset + 0] << 24; + final int c = byteCodes[offset + 1] << 16; + final int b = byteCodes[offset + 2] << 8; + final int a = byteCodes[offset + 3]; return (d & 0xff000000) | (c & 0xff0000) | (b & 0xff00) | (a & 0xff); } - private int readUByte(byte[] byteCodes, int offsetInstruction) { - return byteCodes[offsetInstruction] & 0xff; + private int readUByte(byte[] byteCodes, int offset) { + return byteCodes[offset] & 0xff; } - private int readUShort(byte[] byteCodes, int offsetInstruction) { - return ((byteCodes[offsetInstruction] & 0xff) << 8) - | (byteCodes[offsetInstruction + 1] & 0xff); + private int readUShort(byte[] byteCodes, int offset) { + return ((byteCodes[offset] & 0xff) << 8) + | (byteCodes[offset + 1] & 0xff); + } + + private int readShort(byte[] byteCodes, int offset) { + return (byteCodes[offset] << 8) + | (byteCodes[offset + 1] & 0xff); } private static void countArgs(String descriptor, char[] returnType, StringBuilder sig, StringBuilder cnt) {