MCPcopy Index your code
hub / github.com/clojure/clojure / readCode

Method readCode

src/jvm/clojure/asm/ClassReader.java:1294–2429  ·  view source on GitHub ↗

Reads a JVMS 'Code' attribute and makes the given visitor visit it. @param methodVisitor the visitor that must visit the Code attribute. @param context information about the class being parsed. @param codeOffset the start offset in #b of the Code attribute, excluding its attribute_name_

(
      final MethodVisitor methodVisitor, final Context context, final int codeOffset)

Source from the content-addressed store, hash-verified

1292 * attribute_name_index and attribute_length fields.
1293 */
1294 private void readCode(
1295 final MethodVisitor methodVisitor, final Context context, final int codeOffset) {
1296 int currentOffset = codeOffset;
1297
1298 // Read the max_stack, max_locals and code_length fields.
1299 final byte[] classFileBuffer = b;
1300 final char[] charBuffer = context.charBuffer;
1301 final int maxStack = readUnsignedShort(currentOffset);
1302 final int maxLocals = readUnsignedShort(currentOffset + 2);
1303 final int codeLength = readInt(currentOffset + 4);
1304 currentOffset += 8;
1305
1306 // Read the bytecode 'code' array to create a label for each referenced instruction.
1307 final int bytecodeStartOffset = currentOffset;
1308 final int bytecodeEndOffset = currentOffset + codeLength;
1309 final Label[] labels = context.currentMethodLabels = new Label[codeLength + 1];
1310 while (currentOffset < bytecodeEndOffset) {
1311 final int bytecodeOffset = currentOffset - bytecodeStartOffset;
1312 final int opcode = classFileBuffer[currentOffset] & 0xFF;
1313 switch (opcode) {
1314 case Constants.NOP:
1315 case Constants.ACONST_NULL:
1316 case Constants.ICONST_M1:
1317 case Constants.ICONST_0:
1318 case Constants.ICONST_1:
1319 case Constants.ICONST_2:
1320 case Constants.ICONST_3:
1321 case Constants.ICONST_4:
1322 case Constants.ICONST_5:
1323 case Constants.LCONST_0:
1324 case Constants.LCONST_1:
1325 case Constants.FCONST_0:
1326 case Constants.FCONST_1:
1327 case Constants.FCONST_2:
1328 case Constants.DCONST_0:
1329 case Constants.DCONST_1:
1330 case Constants.IALOAD:
1331 case Constants.LALOAD:
1332 case Constants.FALOAD:
1333 case Constants.DALOAD:
1334 case Constants.AALOAD:
1335 case Constants.BALOAD:
1336 case Constants.CALOAD:
1337 case Constants.SALOAD:
1338 case Constants.IASTORE:
1339 case Constants.LASTORE:
1340 case Constants.FASTORE:
1341 case Constants.DASTORE:
1342 case Constants.AASTORE:
1343 case Constants.BASTORE:
1344 case Constants.CASTORE:
1345 case Constants.SASTORE:
1346 case Constants.POP:
1347 case Constants.POP2:
1348 case Constants.DUP:
1349 case Constants.DUP_X1:
1350 case Constants.DUP_X2:
1351 case Constants.DUP2:

Callers 1

readMethodMethod · 0.95

Calls 15

readUnsignedShortMethod · 0.95
readIntMethod · 0.95
createLabelMethod · 0.95
readShortMethod · 0.95
readUTF8Method · 0.95
createDebugLabelMethod · 0.95
readTypeAnnotationsMethod · 0.95
readAttributeMethod · 0.95
computeImplicitFrameMethod · 0.95
acceptMethod · 0.95
readStackMapFrameMethod · 0.95

Tested by

no test coverage detected