1182 int label = readUnsignedShort(v + 10);
1183 if (labels[label] == null) {
1184 readLabel(label, labels).status |= Label.DEBUG;
1185 }
1186 label += readUnsignedShort(v + 12);
1187 if (labels[label] == null) {
1188 readLabel(label, labels).status |= Label.DEBUG;
1189 }
1190 v += 10;
1191 }
1192 }
1193 } else if ("LocalVariableTypeTable".equals(attrName)) {
1194 varTypeTable = u + 8;
1195 } else if ("LineNumberTable".equals(attrName)) {
1196 if ((context.flags & SKIP_DEBUG) == 0) {
1197 for (int j = readUnsignedShort(u + 8), v = u; j > 0; --j) {
1198 int label = readUnsignedShort(v + 10);
1199 if (labels[label] == null) {
1200 readLabel(label, labels).status |= Label.DEBUG;
1201 }
1202 labels[label].line = readUnsignedShort(v + 12);
1203 v += 4;
1204 }
1205 }
1206 } else if (ANNOTATIONS
1207 && "RuntimeVisibleTypeAnnotations".equals(attrName)) {
1208 tanns = readTypeAnnotations(mv, context, u + 8, true);
1209 ntoff = tanns.length == 0 || readByte(tanns[0]) < 0x43 ? -1
1210 : readUnsignedShort(tanns[0] + 1);
1211 } else if (ANNOTATIONS
1212 && "RuntimeInvisibleTypeAnnotations".equals(attrName)) {
1213 itanns = readTypeAnnotations(mv, context, u + 8, false);
1214 nitoff = itanns.length == 0 || readByte(itanns[0]) < 0x43 ? -1
1215 : readUnsignedShort(itanns[0] + 1);
1216 } else if (FRAMES && "StackMapTable".equals(attrName)) {
1217 if ((context.flags & SKIP_FRAMES) == 0) {
1218 stackMap = u + 10;
1219 stackMapSize = readInt(u + 4);
1220 frameCount = readUnsignedShort(u + 8);
1221 }
1222 /*
1297 for (int i = stackMap; i < stackMap + stackMapSize - 2; ++i) {
1298 if (b[i] == 8) { // UNINITIALIZED FRAME TYPE
1299 int v = readUnsignedShort(i + 1);
1300 if (v >= 0 && v < codeLength) {
1301 if ((b[codeStart + v] & 0xFF) == Opcodes.NEW) {
1302 readLabel(v, labels);
1303 }
1304 }
1305 }
1306 }
1307 }
1308
1309 // visits the instructions
1310 u = codeStart;
1311 while (u < codeEnd) {
1312 int offset = u - codeStart;
1313
1314 // visits the label and line number for this offset, if any
1315 Label l = labels[offset];
1316 if (l != null) {
1317 mv.visitLabel(l);
1318 if ((context.flags & SKIP_DEBUG) == 0 && l.line > 0) {
1319 mv.visitLineNumber(l.line, l);
1320 }
1321 }
1322
1323 // visits the frame for this offset, if any
1324 while (FRAMES && frame != null
1325 && (frame.offset == offset || frame.offset == -1)) {
1326 // if there is a frame for this offset, makes the visitor visit
1327 // it, and reads the next frame if there is one.
1328 if (frame.offset != -1) {
1329 if (!zip || unzip) {
1330 mv.visitFrame(Opcodes.F_NEW, frame.localCount,
1331 frame.local, frame.stackCount, frame.stack);
1332 } else {
1333 mv.visitFrame(frame.mode, frame.localDiff, frame.local,
1334 frame.stackCount, frame.stack);
1335 }
1336 }
1337 if (frameCount > 0) {
1338 stackMap = readFrame(stackMap, zip, unzip, frame);
1339 --frameCount;
1340 } else {
1341 frame = null;
1840 switch (b[v] & 0xFF) {
1841 case 'e': // enum_const_value
1842 return v + 5;
1843 case '@': // annotation_value
1844 return readAnnotationValues(v + 3, buf, true, null);
1845 case '[': // array_value
1846 return readAnnotationValues(v + 1, buf, false, null);
1847 default:
1848 return v + 3;
1849 }
1850 }
1851 switch (b[v++] & 0xFF) {
1852 case 'I': // pointer to CONSTANT_Integer
1853 case 'J': // pointer to CONSTANT_Long
1854 case 'F': // pointer to CONSTANT_Float
1855 case 'D': // pointer to CONSTANT_Double
1856 av.visit(name, readConst(readUnsignedShort(v), buf));
1857 v += 2;
1858 break;
1859 case 'B': // pointer to CONSTANT_Byte
1860 av.visit(name,
1861 (byte) readInt(items[readUnsignedShort(v)]));
1862 v += 2;
1863 break;
1864 case 'Z': // pointer to CONSTANT_Boolean
1865 av.visit(name,
1866 readInt(items[readUnsignedShort(v)]) == 0 ? Boolean.FALSE
1867 : Boolean.TRUE);
1868 v += 2;
1869 break;
1870 case 'S': // pointer to CONSTANT_Short
1871 av.visit(name,
1872 (short) readInt(items[readUnsignedShort(v)]));
1873 v += 2;
1874 break;
1875 case 'C': // pointer to CONSTANT_Char
1876 av.visit(name,
1877 (char) readInt(items[readUnsignedShort(v)]));
1878 v += 2;
1879 break;
1880 case 's': // pointer to CONSTANT_Utf8
1881 av.visit(name, readUTF8(v, buf));
1882 v += 2;
1883 break;
1884 case 'e': // enum_const_value
1885 av.visitEnum(name, readUTF8(v, buf), readUTF8(v + 2, buf));
1886 v += 4;
1887 break;
1888 case 'c': // class_info
1889 av.visit(name, Type.getType(readUTF8(v, buf)));
1890 v += 2;
1891 break;
1892 case '@': // annotation_value
1893 v = readAnnotationValues(v + 2, buf, true,
1894 av.visitAnnotation(name, readUTF8(v, buf)));
1895 break;
1896 case '[': // array_value
1897 int size = readUnsignedShort(v);
2498 int index = items[item];
2499 switch (b[index - 1]) {
2500 case ClassWriter.INT:
2501 return readInt(index);
2502 case ClassWriter.FLOAT:
2503 return Float.intBitsToFloat(readInt(index));
2504 case ClassWriter.LONG:
2505 return readLong(index);
2506 case ClassWriter.DOUBLE:
2507 return Double.longBitsToDouble(readLong(index));
2508 case ClassWriter.CLASS:
2509 return Type.getObjectType(readUTF8(index, buf));
2510 case ClassWriter.STR:
2511 return readUTF8(index, buf);
2512 case ClassWriter.MTYPE:
2513 return Type.getMethodType(readUTF8(index, buf));
2514 default: // case ClassWriter.HANDLE_BASE + [1..9]:
2515 int tag = readByte(index);
2516 int[] items = this.items;
2517 int cpIndex = items[readUnsignedShort(index + 1)];
2518 String owner = readClass(cpIndex, buf);
2519 cpIndex = items[readUnsignedShort(cpIndex + 2)];
2520 String name = readUTF8(cpIndex, buf);
2521 String desc = readUTF8(cpIndex + 2, buf);
2522 return new Handle(tag, owner, name, desc);
2523 }
2524 }
2525 }
|
1182 int label = readUnsignedShort(v + 10);
1183 if (labels[label] == null) {
1184 readLabel(label, labels).status |= Label.DEBUG;
1185 }
1186 label += readUnsignedShort(v + 12);
1187 if (labels[label] == null) {
1188 readLabel(label, labels).status |= Label.DEBUG;
1189 }
1190 v += 10;
1191 }
1192 }
1193 } else if ("LocalVariableTypeTable".equals(attrName)) {
1194 varTypeTable = u + 8;
1195 } else if ("LineNumberTable".equals(attrName)) {
1196 if ((context.flags & SKIP_DEBUG) == 0) {
1197 for (int j = readUnsignedShort(u + 8), v = u; j > 0; --j) {
1198 int label = readUnsignedShort(v + 10);
1199 if (labels[label] == null) {
1200 readLabel(label, labels).status |= Label.DEBUG;
1201 }
1202 Label l = labels[label];
1203 while (l.line > 0) {
1204 if (l.next == null) {
1205 l.next = new Label();
1206 }
1207 l = l.next;
1208 }
1209 l.line = readUnsignedShort(v + 12);
1210 v += 4;
1211 }
1212 }
1213 } else if (ANNOTATIONS
1214 && "RuntimeVisibleTypeAnnotations".equals(attrName)) {
1215 tanns = readTypeAnnotations(mv, context, u + 8, true);
1216 ntoff = tanns.length == 0 || readByte(tanns[0]) < 0x43 ? -1
1217 : readUnsignedShort(tanns[0] + 1);
1218 } else if (ANNOTATIONS
1219 && "RuntimeInvisibleTypeAnnotations".equals(attrName)) {
1220 itanns = readTypeAnnotations(mv, context, u + 8, false);
1221 nitoff = itanns.length == 0 || readByte(itanns[0]) < 0x43 ? -1
1222 : readUnsignedShort(itanns[0] + 1);
1223 } else if (FRAMES && "StackMapTable".equals(attrName)) {
1224 if ((context.flags & SKIP_FRAMES) == 0) {
1225 stackMap = u + 10;
1226 stackMapSize = readInt(u + 4);
1227 frameCount = readUnsignedShort(u + 8);
1228 }
1229 /*
1304 for (int i = stackMap; i < stackMap + stackMapSize - 2; ++i) {
1305 if (b[i] == 8) { // UNINITIALIZED FRAME TYPE
1306 int v = readUnsignedShort(i + 1);
1307 if (v >= 0 && v < codeLength) {
1308 if ((b[codeStart + v] & 0xFF) == Opcodes.NEW) {
1309 readLabel(v, labels);
1310 }
1311 }
1312 }
1313 }
1314 }
1315
1316 // visits the instructions
1317 u = codeStart;
1318 while (u < codeEnd) {
1319 int offset = u - codeStart;
1320
1321 // visits the label and line number for this offset, if any
1322 Label l = labels[offset];
1323 if (l != null) {
1324 Label next = l.next;
1325 l.next = null;
1326 mv.visitLabel(l);
1327 if ((context.flags & SKIP_DEBUG) == 0 && l.line > 0) {
1328 mv.visitLineNumber(l.line, l);
1329 while (next != null) {
1330 mv.visitLineNumber(next.line, l);
1331 next = next.next;
1332 }
1333 }
1334 }
1335
1336 // visits the frame for this offset, if any
1337 while (FRAMES && frame != null
1338 && (frame.offset == offset || frame.offset == -1)) {
1339 // if there is a frame for this offset, makes the visitor visit
1340 // it, and reads the next frame if there is one.
1341 if (frame.offset != -1) {
1342 if (!zip || unzip) {
1343 mv.visitFrame(Opcodes.F_NEW, frame.localCount,
1344 frame.local, frame.stackCount, frame.stack);
1345 } else {
1346 mv.visitFrame(frame.mode, frame.localDiff, frame.local,
1347 frame.stackCount, frame.stack);
1348 }
1349 }
1350 if (frameCount > 0) {
1351 stackMap = readFrame(stackMap, zip, unzip, frame);
1352 --frameCount;
1353 } else {
1354 frame = null;
1853 switch (b[v] & 0xFF) {
1854 case 'e': // enum_const_value
1855 return v + 5;
1856 case '@': // annotation_value
1857 return readAnnotationValues(v + 3, buf, true, null);
1858 case '[': // array_value
1859 return readAnnotationValues(v + 1, buf, false, null);
1860 default:
1861 return v + 3;
1862 }
1863 }
1864 switch (b[v++] & 0xFF) {
1865 case 'I': // pointer to CONSTANT_Integer
1866 case 'J': // pointer to CONSTANT_Long
1867 case 'F': // pointer to CONSTANT_Float
1868 case 'D': // pointer to CONSTANT_Double
1869 av.visit(name, readConst(readUnsignedShort(v), buf));
1870 v += 2;
1871 break;
1872 case 'B': // pointer to CONSTANT_Byte
1873 av.visit(name, (byte) readInt(items[readUnsignedShort(v)]));
1874 v += 2;
1875 break;
1876 case 'Z': // pointer to CONSTANT_Boolean
1877 av.visit(name,
1878 readInt(items[readUnsignedShort(v)]) == 0 ? Boolean.FALSE
1879 : Boolean.TRUE);
1880 v += 2;
1881 break;
1882 case 'S': // pointer to CONSTANT_Short
1883 av.visit(name, (short) readInt(items[readUnsignedShort(v)]));
1884 v += 2;
1885 break;
1886 case 'C': // pointer to CONSTANT_Char
1887 av.visit(name, (char) readInt(items[readUnsignedShort(v)]));
1888 v += 2;
1889 break;
1890 case 's': // pointer to CONSTANT_Utf8
1891 av.visit(name, readUTF8(v, buf));
1892 v += 2;
1893 break;
1894 case 'e': // enum_const_value
1895 av.visitEnum(name, readUTF8(v, buf), readUTF8(v + 2, buf));
1896 v += 4;
1897 break;
1898 case 'c': // class_info
1899 av.visit(name, Type.getType(readUTF8(v, buf)));
1900 v += 2;
1901 break;
1902 case '@': // annotation_value
1903 v = readAnnotationValues(v + 2, buf, true,
1904 av.visitAnnotation(name, readUTF8(v, buf)));
1905 break;
1906 case '[': // array_value
1907 int size = readUnsignedShort(v);
2508 int index = items[item];
2509 switch (b[index - 1]) {
2510 case ClassWriter.INT:
2511 return readInt(index);
2512 case ClassWriter.FLOAT:
2513 return Float.intBitsToFloat(readInt(index));
2514 case ClassWriter.LONG:
2515 return readLong(index);
2516 case ClassWriter.DOUBLE:
2517 return Double.longBitsToDouble(readLong(index));
2518 case ClassWriter.CLASS:
2519 return Type.getObjectType(readUTF8(index, buf));
2520 case ClassWriter.STR:
2521 return readUTF8(index, buf);
2522 case ClassWriter.MTYPE:
2523 return Type.getMethodType(readUTF8(index, buf));
2524 default: // case ClassWriter.HANDLE_BASE + [1..9]:
2525 int tag = readByte(index);
2526 int[] items = this.items;
2527 int cpIndex = items[readUnsignedShort(index + 1)];
2528 boolean itf = b[cpIndex - 1] == ClassWriter.IMETH;
2529 String owner = readClass(cpIndex, buf);
2530 cpIndex = items[readUnsignedShort(cpIndex + 2)];
2531 String name = readUTF8(cpIndex, buf);
2532 String desc = readUTF8(cpIndex + 2, buf);
2533 return new Handle(tag, owner, name, desc, itf);
2534 }
2535 }
2536 }
|