Reads a JVMS 'stack_map_frame' structure and stores the result in the given Context object. This method can also be used to read a full_frame structure, excluding its frame_type field (this is used to parse the legacy StackMap attributes). @param stackMapFrameOffset the start offset in {@li
(
final int stackMapFrameOffset,
final boolean compressed,
final boolean expand,
final Context context)
| 3034 | * @return the end offset of the JVMS 'stack_map_frame' or 'full_frame' structure. |
| 3035 | */ |
| 3036 | private int readStackMapFrame( |
| 3037 | final int stackMapFrameOffset, |
| 3038 | final boolean compressed, |
| 3039 | final boolean expand, |
| 3040 | final Context context) { |
| 3041 | int currentOffset = stackMapFrameOffset; |
| 3042 | final char[] charBuffer = context.charBuffer; |
| 3043 | final Label[] labels = context.currentMethodLabels; |
| 3044 | int frameType; |
| 3045 | if (compressed) { |
| 3046 | // Read the frame_type field. |
| 3047 | frameType = b[currentOffset++] & 0xFF; |
| 3048 | } else { |
| 3049 | frameType = Frame.FULL_FRAME; |
| 3050 | context.currentFrameOffset = -1; |
| 3051 | } |
| 3052 | int offsetDelta; |
| 3053 | context.currentFrameLocalCountDelta = 0; |
| 3054 | if (frameType < Frame.SAME_LOCALS_1_STACK_ITEM_FRAME) { |
| 3055 | offsetDelta = frameType; |
| 3056 | context.currentFrameType = Opcodes.F_SAME; |
| 3057 | context.currentFrameStackCount = 0; |
| 3058 | } else if (frameType < Frame.RESERVED) { |
| 3059 | offsetDelta = frameType - Frame.SAME_LOCALS_1_STACK_ITEM_FRAME; |
| 3060 | currentOffset = |
| 3061 | readVerificationTypeInfo( |
| 3062 | currentOffset, context.currentFrameStackTypes, 0, charBuffer, labels); |
| 3063 | context.currentFrameType = Opcodes.F_SAME1; |
| 3064 | context.currentFrameStackCount = 1; |
| 3065 | } else if (frameType >= Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) { |
| 3066 | offsetDelta = readUnsignedShort(currentOffset); |
| 3067 | currentOffset += 2; |
| 3068 | if (frameType == Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) { |
| 3069 | currentOffset = |
| 3070 | readVerificationTypeInfo( |
| 3071 | currentOffset, context.currentFrameStackTypes, 0, charBuffer, labels); |
| 3072 | context.currentFrameType = Opcodes.F_SAME1; |
| 3073 | context.currentFrameStackCount = 1; |
| 3074 | } else if (frameType >= Frame.CHOP_FRAME && frameType < Frame.SAME_FRAME_EXTENDED) { |
| 3075 | context.currentFrameType = Opcodes.F_CHOP; |
| 3076 | context.currentFrameLocalCountDelta = Frame.SAME_FRAME_EXTENDED - frameType; |
| 3077 | context.currentFrameLocalCount -= context.currentFrameLocalCountDelta; |
| 3078 | context.currentFrameStackCount = 0; |
| 3079 | } else if (frameType == Frame.SAME_FRAME_EXTENDED) { |
| 3080 | context.currentFrameType = Opcodes.F_SAME; |
| 3081 | context.currentFrameStackCount = 0; |
| 3082 | } else if (frameType < Frame.FULL_FRAME) { |
| 3083 | int local = expand ? context.currentFrameLocalCount : 0; |
| 3084 | for (int k = frameType - Frame.SAME_FRAME_EXTENDED; k > 0; k--) { |
| 3085 | currentOffset = |
| 3086 | readVerificationTypeInfo( |
| 3087 | currentOffset, context.currentFrameLocalTypes, local++, charBuffer, labels); |
| 3088 | } |
| 3089 | context.currentFrameType = Opcodes.F_APPEND; |
| 3090 | context.currentFrameLocalCountDelta = frameType - Frame.SAME_FRAME_EXTENDED; |
| 3091 | context.currentFrameLocalCount += context.currentFrameLocalCountDelta; |
| 3092 | context.currentFrameStackCount = 0; |
| 3093 | } else { |
no test coverage detected