< prev index next >

src/hotspot/share/classfile/stackMapTable.cpp

Print this page

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










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

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