Makes the given MethodWriter visit the input frame of this Frame. The visit is done with the MethodWriter#visitFrameStart, MethodWriter#visitAbstractType and MethodWriter#visitFrameEnd methods. @param methodWriter the MethodWriter that should visit th
(final MethodWriter methodWriter)
| 1345 | * Frame}. |
| 1346 | */ |
| 1347 | final void accept(final MethodWriter methodWriter) { |
| 1348 | // Compute the number of locals, ignoring TOP types that are just after a LONG or a DOUBLE, and |
| 1349 | // all trailing TOP types. |
| 1350 | int[] localTypes = inputLocals; |
| 1351 | int nLocal = 0; |
| 1352 | int nTrailingTop = 0; |
| 1353 | int i = 0; |
| 1354 | while (i < localTypes.length) { |
| 1355 | int localType = localTypes[i]; |
| 1356 | i += (localType == LONG || localType == DOUBLE) ? 2 : 1; |
| 1357 | if (localType == TOP) { |
| 1358 | nTrailingTop++; |
| 1359 | } else { |
| 1360 | nLocal += nTrailingTop + 1; |
| 1361 | nTrailingTop = 0; |
| 1362 | } |
| 1363 | } |
| 1364 | // Compute the stack size, ignoring TOP types that are just after a LONG or a DOUBLE. |
| 1365 | int[] stackTypes = inputStack; |
| 1366 | int nStack = 0; |
| 1367 | i = 0; |
| 1368 | while (i < stackTypes.length) { |
| 1369 | int stackType = stackTypes[i]; |
| 1370 | i += (stackType == LONG || stackType == DOUBLE) ? 2 : 1; |
| 1371 | nStack++; |
| 1372 | } |
| 1373 | // Visit the frame and its content. |
| 1374 | int frameIndex = methodWriter.visitFrameStart(owner.bytecodeOffset, nLocal, nStack); |
| 1375 | i = 0; |
| 1376 | while (nLocal-- > 0) { |
| 1377 | int localType = localTypes[i]; |
| 1378 | i += (localType == LONG || localType == DOUBLE) ? 2 : 1; |
| 1379 | methodWriter.visitAbstractType(frameIndex++, localType); |
| 1380 | } |
| 1381 | i = 0; |
| 1382 | while (nStack-- > 0) { |
| 1383 | int stackType = stackTypes[i]; |
| 1384 | i += (stackType == LONG || stackType == DOUBLE) ? 2 : 1; |
| 1385 | methodWriter.visitAbstractType(frameIndex++, stackType); |
| 1386 | } |
| 1387 | methodWriter.visitFrameEnd(); |
| 1388 | } |
| 1389 | |
| 1390 | /** |
| 1391 | * Put the given abstract type in the given ByteVector, using the JVMS verification_type_info |
no test coverage detected