121 }
122 return result;
123 }
124
125 void StackMapTable::check_jump_target(
126 StackMapFrame* frame, int32_t target, TRAPS) const {
127 ErrorContext ctx;
128 bool match = match_stackmap(
129 frame, target, true, false, false, &ctx, CHECK_VERIFY(frame->verifier()));
130 if (!match || (target < 0 || target >= _code_length)) {
131 frame->verifier()->verify_error(ctx,
132 "Inconsistent stackmap frames at branch target %d", target);
133 return;
134 }
135 // check if uninitialized objects exist on backward branches
136 check_new_object(frame, target, CHECK_VERIFY(frame->verifier()));
137 }
138
139 void StackMapTable::check_new_object(
140 const StackMapFrame* frame, int32_t target, TRAPS) const {
141 if (frame->offset() > target && frame->has_new_object()) {
142 frame->verifier()->verify_error(
143 ErrorContext::bad_code(frame->offset()),
144 "Uninitialized object exists on backward branch %d", target);
145 return;
146 }
147 }
148
149 void StackMapTable::print_on(outputStream* str) const {
150 str->indent().print_cr("StackMapTable: frame_count = %d", _frame_count);
151 str->indent().print_cr("table = { ");
152 {
153 streamIndentor si(str);
154 for (int32_t i = 0; i < _frame_count; ++i) {
155 _frame_array[i]->print_on(str);
156 }
157 }
158 str->print_cr(" }");
159 }
160
161 int32_t StackMapReader::chop(
|
121 }
122 return result;
123 }
124
125 void StackMapTable::check_jump_target(
126 StackMapFrame* frame, int32_t target, TRAPS) const {
127 ErrorContext ctx;
128 bool match = match_stackmap(
129 frame, target, true, false, false, &ctx, CHECK_VERIFY(frame->verifier()));
130 if (!match || (target < 0 || target >= _code_length)) {
131 frame->verifier()->verify_error(ctx,
132 "Inconsistent stackmap frames at branch target %d", target);
133 return;
134 }
135 // check if uninitialized objects exist on backward branches
136 check_new_object(frame, target, CHECK_VERIFY(frame->verifier()));
137 }
138
139 void StackMapTable::check_new_object(
140 const StackMapFrame* frame, int32_t target, TRAPS) const {
141 int frame_index = get_index_from_offset(target);
142 assert(frame_index >= 0 && frame_index < _frame_count, "bad frame index");
143 if (frame->offset() > target &&
144 frame->has_unique_new_object(_frame_array[frame_index])) {
145 frame->verifier()->verify_error(
146 ErrorContext::bad_code(frame->offset()),
147 "Uninitialized object exists on backward branch %d", target);
148 return;
149 }
150 }
151
152 void StackMapTable::print_on(outputStream* str) const {
153 str->indent().print_cr("StackMapTable: frame_count = %d", _frame_count);
154 str->indent().print_cr("table = { ");
155 {
156 streamIndentor si(str);
157 for (int32_t i = 0; i < _frame_count; ++i) {
158 _frame_array[i]->print_on(str);
159 }
160 }
161 str->print_cr(" }");
162 }
163
164 int32_t StackMapReader::chop(
|