127 bool match = match_stackmap( 128 frame, target, true, false, &ctx, CHECK_VERIFY(frame->verifier())); 129 if (!match || (target < 0 || target >= _code_length)) { 130 frame->verifier()->verify_error(ctx, 131 "Inconsistent stackmap frames at branch target %d", target); 132 } 133 } 134 135 void StackMapTable::print_on(outputStream* str) const { 136 str->indent().print_cr("StackMapTable: frame_count = %d", _frame_count); 137 str->indent().print_cr("table = { "); 138 { 139 streamIndentor si(str); 140 for (int32_t i = 0; i < _frame_count; ++i) { 141 _frame_array[i]->print_on(str); 142 } 143 } 144 str->print_cr(" }"); 145 } 146 147 int32_t StackMapReader::chop( 148 VerificationType* locals, int32_t length, int32_t chops) { 149 if (locals == NULL) return -1; 150 int32_t pos = length - 1; 151 for (int32_t i=0; i<chops; i++) { 152 if (locals[pos].is_category2_2nd()) { 153 pos -= 2; 154 } else { 155 pos --; 156 } 157 if (pos<0 && i<(chops-1)) return -1; 158 } 159 return pos+1; 160 } 161 162 VerificationType StackMapReader::parse_verification_type(u1* flags, TRAPS) { 163 u1 tag = _stream->get_u1(THREAD); 164 if (tag < (u1)ITEM_UninitializedThis) { 165 return VerificationType::from_tag(tag); 166 } | 127 bool match = match_stackmap( 128 frame, target, true, false, &ctx, CHECK_VERIFY(frame->verifier())); 129 if (!match || (target < 0 || target >= _code_length)) { 130 frame->verifier()->verify_error(ctx, 131 "Inconsistent stackmap frames at branch target %d", target); 132 } 133 } 134 135 void StackMapTable::print_on(outputStream* str) const { 136 str->indent().print_cr("StackMapTable: frame_count = %d", _frame_count); 137 str->indent().print_cr("table = { "); 138 { 139 streamIndentor si(str); 140 for (int32_t i = 0; i < _frame_count; ++i) { 141 _frame_array[i]->print_on(str); 142 } 143 } 144 str->print_cr(" }"); 145 } 146 147 StackMapReader::StackMapReader(ClassVerifier* v, StackMapStream* stream, char* code_data, 148 int32_t code_len, TRAPS) : 149 _verifier(v), _stream(stream), 150 _code_data(code_data), _code_length(code_len) { 151 methodHandle m = v->method(); 152 if (m->has_stackmap_table()) { 153 _cp = constantPoolHandle(THREAD, m->constants()); 154 _frame_count = _stream->get_u2(CHECK); 155 } else { 156 // There's no stackmap table present. Frame count and size are 0. 157 _frame_count = 0; 158 } 159 } 160 161 int32_t StackMapReader::chop( 162 VerificationType* locals, int32_t length, int32_t chops) { 163 if (locals == NULL) return -1; 164 int32_t pos = length - 1; 165 for (int32_t i=0; i<chops; i++) { 166 if (locals[pos].is_category2_2nd()) { 167 pos -= 2; 168 } else { 169 pos --; 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 } |