111 // information about the class and method
112 constantPoolHandle _cp;
113 ClassVerifier* _verifier;
114 StackMapStream* _stream;
115 char* _code_data;
116 int32_t _code_length;
117
118 // information from the attribute
119 int32_t _frame_count;
120
121 // Number of frames parsed
122 int32_t _parsed_frame_count;
123
124 // Previous frame buffer
125 StackMapFrame* _prev_frame;
126
127 // information from method
128 u2 _max_locals;
129 u2 _max_stack;
130
131 // Check if reading first entry
132 bool _first;
133
134 StackMapFrame* next_helper(TRAPS);
135 void check_offset(StackMapFrame* frame);
136 void check_size(TRAPS);
137 int32_t chop(VerificationType* locals, int32_t length, int32_t chops);
138 VerificationType parse_verification_type(u1* flags, TRAPS);
139 void check_verification_type_array_size(
140 int32_t size, int32_t max_size, TRAPS) {
141 if (size < 0 || size > max_size) {
142 // Since this error could be caused someone rewriting the method
143 // but not knowing to update the stackmap data, we call the
144 // verifier's error method, which may not throw an exception and
145 // failover to the old verifier instead.
146 _verifier->class_format_error(
147 "StackMapTable format error: bad type array size");
148 }
149 }
150
151 enum {
152 SAME_FRAME_START = 0,
153 SAME_FRAME_END = 63,
154 SAME_LOCALS_1_STACK_ITEM_FRAME_START = 64,
155 SAME_LOCALS_1_STACK_ITEM_FRAME_END = 127,
156 RESERVED_START = 128,
157 RESERVED_END = 246,
158 SAME_LOCALS_1_STACK_ITEM_EXTENDED = 247,
159 CHOP_FRAME_START = 248,
160 CHOP_FRAME_END = 250,
161 SAME_FRAME_EXTENDED = 251,
162 APPEND_FRAME_START = 252,
163 APPEND_FRAME_END = 254,
164 FULL_FRAME = 255
165 };
166
167 public:
168 // Constructor
169 StackMapReader(ClassVerifier* v, StackMapStream* stream,
170 char* code_data, int32_t code_len,
171 StackMapFrame* init_frame,
172 u2 max_locals, u2 max_stack, TRAPS);
173
174 inline int32_t get_frame_count() const { return _frame_count; }
175 inline StackMapFrame* prev_frame() const { return _prev_frame; }
176 inline char* code_data() const { return _code_data; }
177 inline int32_t code_length() const { return _code_length; }
178 inline bool at_end() const { return _stream->at_end(); }
179
180 StackMapFrame* next(TRAPS);
181 void check_end(TRAPS);
182 };
183
184 #endif // SHARE_CLASSFILE_STACKMAPTABLE_HPP
|
111 // information about the class and method
112 constantPoolHandle _cp;
113 ClassVerifier* _verifier;
114 StackMapStream* _stream;
115 char* _code_data;
116 int32_t _code_length;
117
118 // information from the attribute
119 int32_t _frame_count;
120
121 // Number of frames parsed
122 int32_t _parsed_frame_count;
123
124 // Previous frame buffer
125 StackMapFrame* _prev_frame;
126
127 // information from method
128 u2 _max_locals;
129 u2 _max_stack;
130
131 // Contains assert_unset_fields generated from classfile
132 StackMapFrame::AssertUnsetFieldTable* _assert_unset_fields_buffer;
133
134 // Check if reading first entry
135 bool _first;
136
137 StackMapFrame* next_helper(TRAPS);
138 void check_offset(StackMapFrame* frame);
139 void check_size(TRAPS);
140 int32_t chop(VerificationType* locals, int32_t length, int32_t chops);
141 VerificationType parse_verification_type(u1* flags, TRAPS);
142 void check_verification_type_array_size(
143 int32_t size, int32_t max_size, TRAPS) {
144 if (size < 0 || size > max_size) {
145 // Since this error could be caused someone rewriting the method
146 // but not knowing to update the stackmap data, we call the
147 // verifier's error method, which may not throw an exception and
148 // failover to the old verifier instead.
149 _verifier->class_format_error(
150 "StackMapTable format error: bad type array size");
151 }
152 }
153
154 enum {
155 SAME_FRAME_START = 0,
156 SAME_FRAME_END = 63,
157 SAME_LOCALS_1_STACK_ITEM_FRAME_START = 64,
158 SAME_LOCALS_1_STACK_ITEM_FRAME_END = 127,
159 RESERVED_START = 128,
160 RESERVED_END = 245,
161 EARLY_LARVAL = 246,
162 SAME_LOCALS_1_STACK_ITEM_EXTENDED = 247,
163 CHOP_FRAME_START = 248,
164 CHOP_FRAME_END = 250,
165 SAME_FRAME_EXTENDED = 251,
166 APPEND_FRAME_START = 252,
167 APPEND_FRAME_END = 254,
168 FULL_FRAME = 255
169 };
170
171 public:
172 // Constructor
173 StackMapReader(ClassVerifier* v, StackMapStream* stream,
174 char* code_data, int32_t code_len,
175 StackMapFrame* init_frame,
176 u2 max_locals, u2 max_stack,
177 StackMapFrame::AssertUnsetFieldTable* initial_strict_fields, TRAPS);
178
179 inline int32_t get_frame_count() const { return _frame_count; }
180 inline StackMapFrame* prev_frame() const { return _prev_frame; }
181 inline char* code_data() const { return _code_data; }
182 inline int32_t code_length() const { return _code_length; }
183 inline bool at_end() const { return _stream->at_end(); }
184
185 StackMapFrame* next(TRAPS);
186 void check_end(TRAPS);
187 };
188
189 #endif // SHARE_CLASSFILE_STACKMAPTABLE_HPP
|