< prev index next >

src/hotspot/share/classfile/stackMapTable.cpp

Print this page

172   }
173   return pos+1;
174 }
175 
176 #define CHECK_NT CHECK_(VerificationType::bogus_type())
177 
178 VerificationType StackMapReader::parse_verification_type(u1* flags, TRAPS) {
179   u1 tag = _stream->get_u1(CHECK_NT);
180   if (tag < (u1)ITEM_UninitializedThis) {
181     return VerificationType::from_tag(tag);
182   }
183   if (tag == ITEM_Object) {
184     u2 class_index = _stream->get_u2(CHECK_NT);
185     int nconstants = _cp->length();
186     if ((class_index <= 0 || class_index >= nconstants) ||
187         (!_cp->tag_at(class_index).is_klass() &&
188          !_cp->tag_at(class_index).is_unresolved_klass())) {
189       _stream->stackmap_format_error("bad class index", THREAD);
190       return VerificationType::bogus_type();
191     }
192     return VerificationType::reference_type(_cp->klass_name_at(class_index));










193   }
194   if (tag == ITEM_UninitializedThis) {
195     if (flags != nullptr) {
196       *flags |= FLAG_THIS_UNINIT;
197     }
198     return VerificationType::uninitialized_this_type();
199   }
200   if (tag == ITEM_Uninitialized) {
201     u2 offset = _stream->get_u2(CHECK_NT);
202     if (offset >= _code_length ||
203         _code_data[offset] != ClassVerifier::NEW_OFFSET) {
204       _verifier->class_format_error(
205         "StackMapTable format error: bad offset for Uninitialized");
206       return VerificationType::bogus_type();
207     }
208     return VerificationType::uninitialized_type(offset);
209   }
210   _stream->stackmap_format_error("bad verification type", THREAD);
211   return VerificationType::bogus_type();
212 }

172   }
173   return pos+1;
174 }
175 
176 #define CHECK_NT CHECK_(VerificationType::bogus_type())
177 
178 VerificationType StackMapReader::parse_verification_type(u1* flags, TRAPS) {
179   u1 tag = _stream->get_u1(CHECK_NT);
180   if (tag < (u1)ITEM_UninitializedThis) {
181     return VerificationType::from_tag(tag);
182   }
183   if (tag == ITEM_Object) {
184     u2 class_index = _stream->get_u2(CHECK_NT);
185     int nconstants = _cp->length();
186     if ((class_index <= 0 || class_index >= nconstants) ||
187         (!_cp->tag_at(class_index).is_klass() &&
188          !_cp->tag_at(class_index).is_unresolved_klass())) {
189       _stream->stackmap_format_error("bad class index", THREAD);
190       return VerificationType::bogus_type();
191     }
192     Symbol* klass_name = _cp->klass_name_at(class_index);
193     if (klass_name->is_Q_signature()) {
194       Symbol* fund_name = klass_name->fundamental_name(THREAD);
195       if (fund_name == nullptr) {
196         _stream->stackmap_format_error("TBD something bad happened", THREAD);
197         return VerificationType::bogus_type();
198       }
199       return VerificationType::inline_type(fund_name);
200     } else {
201       return VerificationType::reference_type(klass_name);
202     }
203   }
204   if (tag == ITEM_UninitializedThis) {
205     if (flags != nullptr) {
206       *flags |= FLAG_THIS_UNINIT;
207     }
208     return VerificationType::uninitialized_this_type();
209   }
210   if (tag == ITEM_Uninitialized) {
211     u2 offset = _stream->get_u2(CHECK_NT);
212     if (offset >= _code_length ||
213         _code_data[offset] != ClassVerifier::NEW_OFFSET) {
214       _verifier->class_format_error(
215         "StackMapTable format error: bad offset for Uninitialized");
216       return VerificationType::bogus_type();
217     }
218     return VerificationType::uninitialized_type(offset);
219   }
220   _stream->stackmap_format_error("bad verification type", THREAD);
221   return VerificationType::bogus_type();
222 }
< prev index next >