49 * Construct object from input stream. |
49 * Construct object from input stream. |
50 * |
50 * |
51 * @param input Input stream |
51 * @param input Input stream |
52 * @throws IOException |
52 * @throws IOException |
53 */ |
53 */ |
54 StackMapEntry(final DataInput input, final ConstantPool constant_pool) throws IOException { |
54 StackMapEntry(final DataInput input, final ConstantPool constantPool) throws IOException { |
55 this(input.readByte() & 0xFF, -1, null, null, constant_pool); |
55 this(input.readByte() & 0xFF, -1, null, null, constantPool); |
56 |
56 |
57 if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) { |
57 if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) { |
58 byte_code_offset = frame_type - Const.SAME_FRAME; |
58 byte_code_offset = frame_type - Const.SAME_FRAME; |
59 } else if (frame_type >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME && |
59 } else if (frame_type >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME && |
60 frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) { |
60 frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) { |
61 byte_code_offset = frame_type - Const.SAME_LOCALS_1_STACK_ITEM_FRAME; |
61 byte_code_offset = frame_type - Const.SAME_LOCALS_1_STACK_ITEM_FRAME; |
62 types_of_stack_items = new StackMapType[1]; |
62 types_of_stack_items = new StackMapType[1]; |
63 types_of_stack_items[0] = new StackMapType(input, constant_pool); |
63 types_of_stack_items[0] = new StackMapType(input, constantPool); |
64 } else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) { |
64 } else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) { |
65 byte_code_offset = input.readShort(); |
65 byte_code_offset = input.readShort(); |
66 types_of_stack_items = new StackMapType[1]; |
66 types_of_stack_items = new StackMapType[1]; |
67 types_of_stack_items[0] = new StackMapType(input, constant_pool); |
67 types_of_stack_items[0] = new StackMapType(input, constantPool); |
68 } else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) { |
68 } else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) { |
69 byte_code_offset = input.readShort(); |
69 byte_code_offset = input.readShort(); |
70 } else if (frame_type == Const.SAME_FRAME_EXTENDED) { |
70 } else if (frame_type == Const.SAME_FRAME_EXTENDED) { |
71 byte_code_offset = input.readShort(); |
71 byte_code_offset = input.readShort(); |
72 } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) { |
72 } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) { |
73 byte_code_offset = input.readShort(); |
73 byte_code_offset = input.readShort(); |
74 final int number_of_locals = frame_type - 251; |
74 final int number_of_locals = frame_type - 251; |
75 types_of_locals = new StackMapType[number_of_locals]; |
75 types_of_locals = new StackMapType[number_of_locals]; |
76 for (int i = 0; i < number_of_locals; i++) { |
76 for (int i = 0; i < number_of_locals; i++) { |
77 types_of_locals[i] = new StackMapType(input, constant_pool); |
77 types_of_locals[i] = new StackMapType(input, constantPool); |
78 } |
78 } |
79 } else if (frame_type == Const.FULL_FRAME) { |
79 } else if (frame_type == Const.FULL_FRAME) { |
80 byte_code_offset = input.readShort(); |
80 byte_code_offset = input.readShort(); |
81 final int number_of_locals = input.readShort(); |
81 final int number_of_locals = input.readShort(); |
82 types_of_locals = new StackMapType[number_of_locals]; |
82 types_of_locals = new StackMapType[number_of_locals]; |
83 for (int i = 0; i < number_of_locals; i++) { |
83 for (int i = 0; i < number_of_locals; i++) { |
84 types_of_locals[i] = new StackMapType(input, constant_pool); |
84 types_of_locals[i] = new StackMapType(input, constantPool); |
85 } |
85 } |
86 final int number_of_stack_items = input.readShort(); |
86 final int number_of_stack_items = input.readShort(); |
87 types_of_stack_items = new StackMapType[number_of_stack_items]; |
87 types_of_stack_items = new StackMapType[number_of_stack_items]; |
88 for (int i = 0; i < number_of_stack_items; i++) { |
88 for (int i = 0; i < number_of_stack_items; i++) { |
89 types_of_stack_items[i] = new StackMapType(input, constant_pool); |
89 types_of_stack_items[i] = new StackMapType(input, constantPool); |
90 } |
90 } |
91 } else { |
91 } else { |
92 /* Can't happen */ |
92 /* Can't happen */ |
93 throw new ClassFormatException ("Invalid frame type found while parsing stack map table: " + frame_type); |
93 throw new ClassFormatException ("Invalid frame type found while parsing stack map table: " + frame_type); |
94 } |
94 } |
95 } |
95 } |
96 |
96 |
97 /** |
97 /** |
98 * DO NOT USE |
98 * DO NOT USE |
99 * |
99 * |
100 * @param byte_code_offset |
100 * @param byteCodeOffset |
101 * @param number_of_locals NOT USED |
101 * @param numberOfLocals NOT USED |
102 * @param types_of_locals array of {@link StackMapType}s of locals |
102 * @param typesOfLocals array of {@link StackMapType}s of locals |
103 * @param number_of_stack_items NOT USED |
103 * @param numberOfStackItems NOT USED |
104 * @param types_of_stack_items array ot {@link StackMapType}s of stack items |
104 * @param typesOfStackItems array ot {@link StackMapType}s of stack items |
105 * @param constant_pool the constant pool |
105 * @param constantPool the constant pool |
106 * @deprecated Since 6.0, use {@link #StackMapEntry(int, int, StackMapType[], StackMapType[], ConstantPool)} |
106 * @deprecated Since 6.0, use {@link #StackMapEntry(int, int, StackMapType[], StackMapType[], ConstantPool)} |
107 * instead |
107 * instead |
108 */ |
108 */ |
109 @java.lang.Deprecated |
109 @java.lang.Deprecated |
110 public StackMapEntry(final int byte_code_offset, final int number_of_locals, |
110 public StackMapEntry(final int byteCodeOffset, final int numberOfLocals, |
111 final StackMapType[] types_of_locals, final int number_of_stack_items, |
111 final StackMapType[] typesOfLocals, final int numberOfStackItems, |
112 final StackMapType[] types_of_stack_items, final ConstantPool constant_pool) { |
112 final StackMapType[] typesOfStackItems, final ConstantPool constantPool) { |
113 this.byte_code_offset = byte_code_offset; |
113 this.byte_code_offset = byteCodeOffset; |
114 this.types_of_locals = types_of_locals != null ? types_of_locals : new StackMapType[0]; |
114 this.types_of_locals = typesOfLocals != null ? typesOfLocals : new StackMapType[0]; |
115 this.types_of_stack_items = types_of_stack_items != null ? types_of_stack_items : new StackMapType[0]; |
115 this.types_of_stack_items = typesOfStackItems != null ? typesOfStackItems : new StackMapType[0]; |
116 this.constant_pool = constant_pool; |
116 this.constant_pool = constantPool; |
117 } |
117 } |
118 |
118 |
119 /** |
119 /** |
120 * Create an instance |
120 * Create an instance |
121 * |
121 * |
122 * @param tag the frame_type to use |
122 * @param tag the frame_type to use |
123 * @param byte_code_offset |
123 * @param byteCodeOffset |
124 * @param types_of_locals array of {@link StackMapType}s of locals |
124 * @param typesOfLocals array of {@link StackMapType}s of locals |
125 * @param types_of_stack_items array ot {@link StackMapType}s of stack items |
125 * @param typesOfStackItems array ot {@link StackMapType}s of stack items |
126 * @param constant_pool the constant pool |
126 * @param constantPool the constant pool |
127 */ |
127 */ |
128 public StackMapEntry(final int tag, final int byte_code_offset, |
128 public StackMapEntry(final int tag, final int byteCodeOffset, |
129 final StackMapType[] types_of_locals, |
129 final StackMapType[] typesOfLocals, |
130 final StackMapType[] types_of_stack_items, final ConstantPool constant_pool) { |
130 final StackMapType[] typesOfStackItems, final ConstantPool constantPool) { |
131 this.frame_type = tag; |
131 this.frame_type = tag; |
132 this.byte_code_offset = byte_code_offset; |
132 this.byte_code_offset = byteCodeOffset; |
133 this.types_of_locals = types_of_locals != null ? types_of_locals : new StackMapType[0]; |
133 this.types_of_locals = typesOfLocals != null ? typesOfLocals : new StackMapType[0]; |
134 this.types_of_stack_items = types_of_stack_items != null ? types_of_stack_items : new StackMapType[0]; |
134 this.types_of_stack_items = typesOfStackItems != null ? typesOfStackItems : new StackMapType[0]; |
135 this.constant_pool = constant_pool; |
135 this.constant_pool = constantPool; |
136 } |
136 } |
137 |
137 |
138 |
138 |
139 /** |
139 /** |
140 * Dump stack map entry |
140 * Dump stack map entry |