| File: | jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp |
| Warning: | line 782, column 5 Value stored to 'count' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* |
| 2 | * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | * accompanied this code). |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License version |
| 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | * or visit www.oracle.com if you need additional information or have any |
| 21 | * questions. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #ifndef SHARE_CLASSFILE_STACKMAPTABLEFORMAT_HPP |
| 26 | #define SHARE_CLASSFILE_STACKMAPTABLEFORMAT_HPP |
| 27 | |
| 28 | #include "classfile/verificationType.hpp" |
| 29 | |
| 30 | // These classes represent the stack-map substructures described in the JVMS |
| 31 | // (hence the non-conforming naming scheme). |
| 32 | |
| 33 | // These classes work with the types in their compressed form in-place (as they |
| 34 | // would appear in the classfile). No virtual methods or fields allowed. |
| 35 | |
| 36 | class verification_type_info { |
| 37 | private: |
| 38 | // u1 tag |
| 39 | // u2 cpool_index || u2 bci (for ITEM_Object & ITEM_Uninitailized only) |
| 40 | |
| 41 | address tag_addr() const { return (address)this; } |
| 42 | address cpool_index_addr() const { return tag_addr() + sizeof(u1); } |
| 43 | address bci_addr() const { return cpool_index_addr(); } |
| 44 | NONCOPYABLE(verification_type_info)verification_type_info(verification_type_info const&) = delete ; verification_type_info& operator=(verification_type_info const&) = delete; |
| 45 | |
| 46 | protected: |
| 47 | // No constructors - should be 'private', but GCC issues a warning if it is |
| 48 | verification_type_info() {} |
| 49 | |
| 50 | public: |
| 51 | |
| 52 | static verification_type_info* at(address addr) { |
| 53 | return (verification_type_info*)addr; |
| 54 | } |
| 55 | |
| 56 | static verification_type_info* create_at(address addr, u1 tag) { |
| 57 | verification_type_info* vti = (verification_type_info*)addr; |
| 58 | vti->set_tag(tag); |
| 59 | return vti; |
| 60 | } |
| 61 | |
| 62 | static verification_type_info* create_object_at(address addr, u2 cp_idx) { |
| 63 | verification_type_info* vti = (verification_type_info*)addr; |
| 64 | vti->set_tag(ITEM_Object); |
| 65 | vti->set_cpool_index(cp_idx); |
| 66 | return vti; |
| 67 | } |
| 68 | |
| 69 | static verification_type_info* create_uninit_at(address addr, u2 bci) { |
| 70 | verification_type_info* vti = (verification_type_info*)addr; |
| 71 | vti->set_tag(ITEM_Uninitialized); |
| 72 | vti->set_bci(bci); |
| 73 | return vti; |
| 74 | } |
| 75 | |
| 76 | static size_t calculate_size(u1 tag) { |
| 77 | if (tag == ITEM_Object || tag == ITEM_Uninitialized) { |
| 78 | return sizeof(u1) + sizeof(u2); |
| 79 | } else { |
| 80 | return sizeof(u1); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | static size_t max_size() { return sizeof(u1) + sizeof(u2); } |
| 85 | |
| 86 | u1 tag() const { return *(u1*)tag_addr(); } |
| 87 | void set_tag(u1 tag) { *((u1*)tag_addr()) = tag; } |
| 88 | |
| 89 | bool is_object() const { return tag() == ITEM_Object; } |
| 90 | bool is_uninitialized() const { return tag() == ITEM_Uninitialized; } |
| 91 | |
| 92 | u2 cpool_index() const { |
| 93 | assert(is_object(), "This type has no cp_index")do { if (!(is_object())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 93, "assert(" "is_object()" ") failed", "This type has no cp_index" ); ::breakpoint(); } } while (0); |
| 94 | return Bytes::get_Java_u2(cpool_index_addr()); |
| 95 | } |
| 96 | void set_cpool_index(u2 idx) { |
| 97 | assert(is_object(), "This type has no cp_index")do { if (!(is_object())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 97, "assert(" "is_object()" ") failed", "This type has no cp_index" ); ::breakpoint(); } } while (0); |
| 98 | Bytes::put_Java_u2(cpool_index_addr(), idx); |
| 99 | } |
| 100 | |
| 101 | u2 bci() const { |
| 102 | assert(is_uninitialized(), "This type has no bci")do { if (!(is_uninitialized())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 102, "assert(" "is_uninitialized()" ") failed", "This type has no bci" ); ::breakpoint(); } } while (0); |
| 103 | return Bytes::get_Java_u2(bci_addr()); |
| 104 | } |
| 105 | |
| 106 | void set_bci(u2 bci) { |
| 107 | assert(is_uninitialized(), "This type has no bci")do { if (!(is_uninitialized())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 107, "assert(" "is_uninitialized()" ") failed", "This type has no bci" ); ::breakpoint(); } } while (0); |
| 108 | Bytes::put_Java_u2(bci_addr(), bci); |
| 109 | } |
| 110 | |
| 111 | void copy_from(verification_type_info* from) { |
| 112 | set_tag(from->tag()); |
| 113 | if (from->is_object()) { |
| 114 | set_cpool_index(from->cpool_index()); |
| 115 | } else if (from->is_uninitialized()) { |
| 116 | set_bci(from->bci()); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | size_t size() const { |
| 121 | return calculate_size(tag()); |
| 122 | } |
| 123 | |
| 124 | verification_type_info* next() { |
| 125 | return (verification_type_info*)((address)this + size()); |
| 126 | } |
| 127 | |
| 128 | // This method is used when reading unverified data in order to ensure |
| 129 | // that we don't read past a particular memory limit. It returns false |
| 130 | // if any part of the data structure is outside the specified memory bounds. |
| 131 | bool verify(address start, address end) { |
| 132 | return ((address)this >= start && |
| 133 | (address)this < end && |
| 134 | (bci_addr() + sizeof(u2) <= end || |
| 135 | (!is_object() && !is_uninitialized()))); |
| 136 | } |
| 137 | |
| 138 | void print_on(outputStream* st) { |
| 139 | switch (tag()) { |
| 140 | case ITEM_Top: st->print("Top"); break; |
| 141 | case ITEM_Integer: st->print("Integer"); break; |
| 142 | case ITEM_Float: st->print("Float"); break; |
| 143 | case ITEM_Double: st->print("Double"); break; |
| 144 | case ITEM_Long: st->print("Long"); break; |
| 145 | case ITEM_Null: st->print("Null"); break; |
| 146 | case ITEM_UninitializedThis: |
| 147 | st->print("UninitializedThis"); break; |
| 148 | case ITEM_Uninitialized: |
| 149 | st->print("Uninitialized[#%d]", bci()); break; |
| 150 | case ITEM_Object: |
| 151 | st->print("Object[#%d]", cpool_index()); break; |
| 152 | default: |
| 153 | st->print("BAD:%d", tag()); break; |
| 154 | } |
| 155 | } |
| 156 | }; |
| 157 | |
| 158 | #define FOR_EACH_STACKMAP_FRAME_TYPE(macro, arg1, arg2) \ |
| 159 | macro(same_frame, arg1, arg2) \ |
| 160 | macro(same_frame_extended, arg1, arg2) \ |
| 161 | macro(same_locals_1_stack_item_frame, arg1, arg2) \ |
| 162 | macro(same_locals_1_stack_item_extended, arg1, arg2) \ |
| 163 | macro(chop_frame, arg1, arg2) \ |
| 164 | macro(append_frame, arg1, arg2) \ |
| 165 | macro(full_frame, arg1, arg2) |
| 166 | |
| 167 | #define SM_FORWARD_DECL(type, arg1, arg2) class type; |
| 168 | FOR_EACH_STACKMAP_FRAME_TYPE(SM_FORWARD_DECL, x, x) |
| 169 | #undef SM_FORWARD_DECL |
| 170 | |
| 171 | class stack_map_frame { |
| 172 | NONCOPYABLE(stack_map_frame)stack_map_frame(stack_map_frame const&) = delete; stack_map_frame & operator=(stack_map_frame const&) = delete; |
| 173 | |
| 174 | protected: |
| 175 | address frame_type_addr() const { return (address)this; } |
| 176 | |
| 177 | // No constructors - should be 'private', but GCC issues a warning if it is |
| 178 | stack_map_frame() {} |
| 179 | |
| 180 | public: |
| 181 | |
| 182 | static stack_map_frame* at(address addr) { |
| 183 | return (stack_map_frame*)addr; |
| 184 | } |
| 185 | |
| 186 | stack_map_frame* next() const { |
| 187 | return at((address)this + size()); |
| 188 | } |
| 189 | |
| 190 | u1 frame_type() const { return *(u1*)frame_type_addr(); } |
| 191 | void set_frame_type(u1 type) { *((u1*)frame_type_addr()) = type; } |
| 192 | |
| 193 | // pseudo-virtual methods |
| 194 | inline size_t size() const; |
| 195 | inline int offset_delta() const; |
| 196 | inline void set_offset_delta(int offset_delta); |
| 197 | inline int number_of_types() const; // number of types contained in the frame |
| 198 | inline verification_type_info* types() const; // pointer to first type |
| 199 | inline bool is_valid_offset(int offset_delta) const; |
| 200 | |
| 201 | // This method must be used when reading unverified data in order to ensure |
| 202 | // that we don't read past a particular memory limit. It returns false |
| 203 | // if any part of the data structure is outside the specified memory bounds. |
| 204 | inline bool verify(address start, address end) const; |
| 205 | |
| 206 | inline void print_on(outputStream* st, int current_offset) const; |
| 207 | inline void print_truncated(outputStream* st, int current_offset) const; |
| 208 | |
| 209 | // Create as_xxx and is_xxx methods for the subtypes |
| 210 | #define FRAME_TYPE_DECL(stackmap_frame_type, arg1, arg2) \ |
| 211 | inline stackmap_frame_type* as_##stackmap_frame_type() const; \ |
| 212 | bool is_##stackmap_frame_type() { \ |
| 213 | return as_##stackmap_frame_type() != NULL__null; \ |
| 214 | } |
| 215 | |
| 216 | FOR_EACH_STACKMAP_FRAME_TYPE(FRAME_TYPE_DECL, x, x) |
| 217 | #undef FRAME_TYPE_DECL |
| 218 | }; |
| 219 | |
| 220 | class same_frame : public stack_map_frame { |
| 221 | private: |
| 222 | static int frame_type_to_offset_delta(u1 frame_type) { |
| 223 | return frame_type + 1; } |
| 224 | static u1 offset_delta_to_frame_type(int offset_delta) { |
| 225 | return (u1)(offset_delta - 1); } |
| 226 | |
| 227 | public: |
| 228 | |
| 229 | static bool is_frame_type(u1 tag) { |
| 230 | return tag < 64; |
| 231 | } |
| 232 | |
| 233 | static same_frame* at(address addr) { |
| 234 | assert(is_frame_type(*addr), "Wrong frame id")do { if (!(is_frame_type(*addr))) { (*g_assert_poison) = 'X'; ; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 234, "assert(" "is_frame_type(*addr)" ") failed", "Wrong frame id" ); ::breakpoint(); } } while (0); |
| 235 | return (same_frame*)addr; |
| 236 | } |
| 237 | |
| 238 | static same_frame* create_at(address addr, int offset_delta) { |
| 239 | same_frame* sm = (same_frame*)addr; |
| 240 | sm->set_offset_delta(offset_delta); |
| 241 | return sm; |
| 242 | } |
| 243 | |
| 244 | static size_t calculate_size() { return sizeof(u1); } |
| 245 | |
| 246 | size_t size() const { return calculate_size(); } |
| 247 | int offset_delta() const { return frame_type_to_offset_delta(frame_type()); } |
| 248 | |
| 249 | void set_offset_delta(int offset_delta) { |
| 250 | assert(offset_delta <= 64, "Offset too large for same_frame")do { if (!(offset_delta <= 64)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 250, "assert(" "offset_delta <= 64" ") failed", "Offset too large for same_frame" ); ::breakpoint(); } } while (0); |
| 251 | set_frame_type(offset_delta_to_frame_type(offset_delta)); |
| 252 | } |
| 253 | |
| 254 | int number_of_types() const { return 0; } |
| 255 | verification_type_info* types() const { return NULL__null; } |
| 256 | |
| 257 | bool is_valid_offset(int offset_delta) const { |
| 258 | return is_frame_type(offset_delta_to_frame_type(offset_delta)); |
| 259 | } |
| 260 | |
| 261 | bool verify_subtype(address start, address end) const { |
| 262 | return true; |
| 263 | } |
| 264 | |
| 265 | void print_on(outputStream* st, int current_offset = -1) const { |
| 266 | st->print("same_frame(@%d)", offset_delta() + current_offset); |
| 267 | } |
| 268 | |
| 269 | void print_truncated(outputStream* st, int current_offset = -1) const { |
| 270 | print_on(st, current_offset); |
| 271 | } |
| 272 | }; |
| 273 | |
| 274 | class same_frame_extended : public stack_map_frame { |
| 275 | private: |
| 276 | enum { _frame_id = 251 }; |
| 277 | address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); } |
| 278 | |
| 279 | public: |
| 280 | static bool is_frame_type(u1 tag) { |
| 281 | return tag == _frame_id; |
| 282 | } |
| 283 | |
| 284 | static same_frame_extended* at(address addr) { |
| 285 | assert(is_frame_type(*addr), "Wrong frame type")do { if (!(is_frame_type(*addr))) { (*g_assert_poison) = 'X'; ; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 285, "assert(" "is_frame_type(*addr)" ") failed", "Wrong frame type" ); ::breakpoint(); } } while (0); |
| 286 | return (same_frame_extended*)addr; |
| 287 | } |
| 288 | |
| 289 | static same_frame_extended* create_at(address addr, u2 offset_delta) { |
| 290 | same_frame_extended* sm = (same_frame_extended*)addr; |
| 291 | sm->set_frame_type(_frame_id); |
| 292 | sm->set_offset_delta(offset_delta); |
| 293 | return sm; |
| 294 | } |
| 295 | |
| 296 | static size_t calculate_size() { return sizeof(u1) + sizeof(u2); } |
| 297 | |
| 298 | size_t size() const { return calculate_size(); } |
| 299 | int offset_delta() const { |
| 300 | return Bytes::get_Java_u2(offset_delta_addr()) + 1; |
| 301 | } |
| 302 | |
| 303 | void set_offset_delta(int offset_delta) { |
| 304 | Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1); |
| 305 | } |
| 306 | |
| 307 | int number_of_types() const { return 0; } |
| 308 | verification_type_info* types() const { return NULL__null; } |
| 309 | bool is_valid_offset(int offset) const { return true; } |
| 310 | |
| 311 | bool verify_subtype(address start, address end) const { |
| 312 | return frame_type_addr() + size() <= end; |
| 313 | } |
| 314 | |
| 315 | void print_on(outputStream* st, int current_offset = -1) const { |
| 316 | st->print("same_frame_extended(@%d)", offset_delta() + current_offset); |
| 317 | } |
| 318 | |
| 319 | void print_truncated(outputStream* st, int current_offset = -1) const { |
| 320 | print_on(st, current_offset); |
| 321 | } |
| 322 | }; |
| 323 | |
| 324 | class same_locals_1_stack_item_frame : public stack_map_frame { |
| 325 | private: |
| 326 | address type_addr() const { return frame_type_addr() + sizeof(u1); } |
| 327 | |
| 328 | static int frame_type_to_offset_delta(u1 frame_type) { |
| 329 | return frame_type - 63; } |
| 330 | static u1 offset_delta_to_frame_type(int offset_delta) { |
| 331 | return (u1)(offset_delta + 63); } |
| 332 | |
| 333 | public: |
| 334 | static bool is_frame_type(u1 tag) { |
| 335 | return tag >= 64 && tag < 128; |
| 336 | } |
| 337 | |
| 338 | static same_locals_1_stack_item_frame* at(address addr) { |
| 339 | assert(is_frame_type(*addr), "Wrong frame id")do { if (!(is_frame_type(*addr))) { (*g_assert_poison) = 'X'; ; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 339, "assert(" "is_frame_type(*addr)" ") failed", "Wrong frame id" ); ::breakpoint(); } } while (0); |
| 340 | return (same_locals_1_stack_item_frame*)addr; |
| 341 | } |
| 342 | |
| 343 | static same_locals_1_stack_item_frame* create_at( |
| 344 | address addr, int offset_delta, verification_type_info* vti) { |
| 345 | same_locals_1_stack_item_frame* sm = (same_locals_1_stack_item_frame*)addr; |
| 346 | sm->set_offset_delta(offset_delta); |
| 347 | if (vti != NULL__null) { |
| 348 | sm->set_type(vti); |
| 349 | } |
| 350 | return sm; |
| 351 | } |
| 352 | |
| 353 | static size_t calculate_size(verification_type_info* vti) { |
| 354 | return sizeof(u1) + vti->size(); |
| 355 | } |
| 356 | |
| 357 | static size_t max_size() { |
| 358 | return sizeof(u1) + verification_type_info::max_size(); |
| 359 | } |
| 360 | |
| 361 | size_t size() const { return calculate_size(types()); } |
| 362 | int offset_delta() const { return frame_type_to_offset_delta(frame_type()); } |
| 363 | |
| 364 | void set_offset_delta(int offset_delta) { |
| 365 | assert(offset_delta > 0 && offset_delta <= 64,do { if (!(offset_delta > 0 && offset_delta <= 64 )) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 366, "assert(" "offset_delta > 0 && offset_delta <= 64" ") failed", "Offset too large for this frame type"); ::breakpoint (); } } while (0) |
| 366 | "Offset too large for this frame type")do { if (!(offset_delta > 0 && offset_delta <= 64 )) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 366, "assert(" "offset_delta > 0 && offset_delta <= 64" ") failed", "Offset too large for this frame type"); ::breakpoint (); } } while (0); |
| 367 | set_frame_type(offset_delta_to_frame_type(offset_delta)); |
| 368 | } |
| 369 | |
| 370 | void set_type(verification_type_info* vti) { |
| 371 | verification_type_info* cur = types(); |
| 372 | cur->copy_from(vti); |
| 373 | } |
| 374 | |
| 375 | int number_of_types() const { return 1; } |
| 376 | verification_type_info* types() const { |
| 377 | return verification_type_info::at(type_addr()); |
| 378 | } |
| 379 | |
| 380 | bool is_valid_offset(int offset_delta) const { |
| 381 | return is_frame_type(offset_delta_to_frame_type(offset_delta)); |
| 382 | } |
| 383 | |
| 384 | bool verify_subtype(address start, address end) const { |
| 385 | return types()->verify(start, end); |
| 386 | } |
| 387 | |
| 388 | void print_on(outputStream* st, int current_offset = -1) const { |
| 389 | st->print("same_locals_1_stack_item_frame(@%d,", |
| 390 | offset_delta() + current_offset); |
| 391 | types()->print_on(st); |
| 392 | st->print(")"); |
| 393 | } |
| 394 | |
| 395 | void print_truncated(outputStream* st, int current_offset = -1) const { |
| 396 | st->print("same_locals_1_stack_item_frame(@%d), output truncated, Stackmap exceeds table size.", |
| 397 | offset_delta() + current_offset); |
| 398 | } |
| 399 | }; |
| 400 | |
| 401 | class same_locals_1_stack_item_extended : public stack_map_frame { |
| 402 | private: |
| 403 | address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); } |
| 404 | address type_addr() const { return offset_delta_addr() + sizeof(u2); } |
| 405 | |
| 406 | enum { _frame_id = 247 }; |
| 407 | |
| 408 | public: |
| 409 | static bool is_frame_type(u1 tag) { |
| 410 | return tag == _frame_id; |
| 411 | } |
| 412 | |
| 413 | static same_locals_1_stack_item_extended* at(address addr) { |
| 414 | assert(is_frame_type(*addr), "Wrong frame id")do { if (!(is_frame_type(*addr))) { (*g_assert_poison) = 'X'; ; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 414, "assert(" "is_frame_type(*addr)" ") failed", "Wrong frame id" ); ::breakpoint(); } } while (0); |
| 415 | return (same_locals_1_stack_item_extended*)addr; |
| 416 | } |
| 417 | |
| 418 | static same_locals_1_stack_item_extended* create_at( |
| 419 | address addr, int offset_delta, verification_type_info* vti) { |
| 420 | same_locals_1_stack_item_extended* sm = |
| 421 | (same_locals_1_stack_item_extended*)addr; |
| 422 | sm->set_frame_type(_frame_id); |
| 423 | sm->set_offset_delta(offset_delta); |
| 424 | if (vti != NULL__null) { |
| 425 | sm->set_type(vti); |
| 426 | } |
| 427 | return sm; |
| 428 | } |
| 429 | |
| 430 | static size_t calculate_size(verification_type_info* vti) { |
| 431 | return sizeof(u1) + sizeof(u2) + vti->size(); |
| 432 | } |
| 433 | |
| 434 | size_t size() const { return calculate_size(types()); } |
| 435 | int offset_delta() const { |
| 436 | return Bytes::get_Java_u2(offset_delta_addr()) + 1; |
| 437 | } |
| 438 | |
| 439 | void set_offset_delta(int offset_delta) { |
| 440 | Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1); |
| 441 | } |
| 442 | |
| 443 | void set_type(verification_type_info* vti) { |
| 444 | verification_type_info* cur = types(); |
| 445 | cur->copy_from(vti); |
| 446 | } |
| 447 | |
| 448 | int number_of_types() const { return 1; } |
| 449 | verification_type_info* types() const { |
| 450 | return verification_type_info::at(type_addr()); |
| 451 | } |
| 452 | bool is_valid_offset(int offset) { return true; } |
| 453 | |
| 454 | bool verify_subtype(address start, address end) const { |
| 455 | return type_addr() < end && types()->verify(start, end); |
| 456 | } |
| 457 | |
| 458 | void print_on(outputStream* st, int current_offset = -1) const { |
| 459 | st->print("same_locals_1_stack_item_extended(@%d,", |
| 460 | offset_delta() + current_offset); |
| 461 | types()->print_on(st); |
| 462 | st->print(")"); |
| 463 | } |
| 464 | |
| 465 | void print_truncated(outputStream* st, int current_offset = -1) const { |
| 466 | st->print("same_locals_1_stack_item_extended(@%d), output truncated, Stackmap exceeds table size.", |
| 467 | offset_delta() + current_offset); |
| 468 | } |
| 469 | }; |
| 470 | |
| 471 | class chop_frame : public stack_map_frame { |
| 472 | private: |
| 473 | address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); } |
| 474 | |
| 475 | static int frame_type_to_chops(u1 frame_type) { |
| 476 | int chop = 251 - frame_type; |
| 477 | return chop; |
| 478 | } |
| 479 | |
| 480 | static u1 chops_to_frame_type(int chop) { |
| 481 | return 251 - chop; |
| 482 | } |
| 483 | |
| 484 | public: |
| 485 | static bool is_frame_type(u1 tag) { |
| 486 | return frame_type_to_chops(tag) > 0 && frame_type_to_chops(tag) < 4; |
| 487 | } |
| 488 | |
| 489 | static chop_frame* at(address addr) { |
| 490 | assert(is_frame_type(*addr), "Wrong frame id")do { if (!(is_frame_type(*addr))) { (*g_assert_poison) = 'X'; ; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 490, "assert(" "is_frame_type(*addr)" ") failed", "Wrong frame id" ); ::breakpoint(); } } while (0); |
| 491 | return (chop_frame*)addr; |
| 492 | } |
| 493 | |
| 494 | static chop_frame* create_at(address addr, int offset_delta, int chops) { |
| 495 | chop_frame* sm = (chop_frame*)addr; |
| 496 | sm->set_chops(chops); |
| 497 | sm->set_offset_delta(offset_delta); |
| 498 | return sm; |
| 499 | } |
| 500 | |
| 501 | static size_t calculate_size() { |
| 502 | return sizeof(u1) + sizeof(u2); |
| 503 | } |
| 504 | |
| 505 | size_t size() const { return calculate_size(); } |
| 506 | int offset_delta() const { |
| 507 | return Bytes::get_Java_u2(offset_delta_addr()) + 1; |
| 508 | } |
| 509 | void set_offset_delta(int offset_delta) { |
| 510 | Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1); |
| 511 | } |
| 512 | |
| 513 | int chops() const { |
| 514 | int chops = frame_type_to_chops(frame_type()); |
| 515 | assert(chops > 0 && chops < 4, "Invalid number of chops in frame")do { if (!(chops > 0 && chops < 4)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 515, "assert(" "chops > 0 && chops < 4" ") failed" , "Invalid number of chops in frame"); ::breakpoint(); } } while (0); |
| 516 | return chops; |
| 517 | } |
| 518 | void set_chops(int chops) { |
| 519 | assert(chops > 0 && chops <= 3, "Bad number of chops")do { if (!(chops > 0 && chops <= 3)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 519, "assert(" "chops > 0 && chops <= 3" ") failed" , "Bad number of chops"); ::breakpoint(); } } while (0); |
| 520 | set_frame_type(chops_to_frame_type(chops)); |
| 521 | } |
| 522 | |
| 523 | int number_of_types() const { return 0; } |
| 524 | verification_type_info* types() const { return NULL__null; } |
| 525 | bool is_valid_offset(int offset) { return true; } |
| 526 | |
| 527 | bool verify_subtype(address start, address end) const { |
| 528 | return frame_type_addr() + size() <= end; |
| 529 | } |
| 530 | |
| 531 | void print_on(outputStream* st, int current_offset = -1) const { |
| 532 | st->print("chop_frame(@%d,%d)", offset_delta() + current_offset, chops()); |
| 533 | } |
| 534 | |
| 535 | void print_truncated(outputStream* st, int current_offset = -1) const { |
| 536 | print_on(st, current_offset); |
| 537 | } |
| 538 | }; |
| 539 | |
| 540 | class append_frame : public stack_map_frame { |
| 541 | private: |
| 542 | address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); } |
| 543 | address types_addr() const { return offset_delta_addr() + sizeof(u2); } |
| 544 | |
| 545 | static int frame_type_to_appends(u1 frame_type) { |
| 546 | int append = frame_type - 251; |
| 547 | return append; |
| 548 | } |
| 549 | |
| 550 | static u1 appends_to_frame_type(int appends) { |
| 551 | assert(appends > 0 && appends < 4, "Invalid append amount")do { if (!(appends > 0 && appends < 4)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 551, "assert(" "appends > 0 && appends < 4" ") failed" , "Invalid append amount"); ::breakpoint(); } } while (0); |
| 552 | return 251 + appends; |
| 553 | } |
| 554 | |
| 555 | public: |
| 556 | static bool is_frame_type(u1 tag) { |
| 557 | return frame_type_to_appends(tag) > 0 && frame_type_to_appends(tag) < 4; |
| 558 | } |
| 559 | |
| 560 | static append_frame* at(address addr) { |
| 561 | assert(is_frame_type(*addr), "Wrong frame id")do { if (!(is_frame_type(*addr))) { (*g_assert_poison) = 'X'; ; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 561, "assert(" "is_frame_type(*addr)" ") failed", "Wrong frame id" ); ::breakpoint(); } } while (0); |
| 562 | return (append_frame*)addr; |
| 563 | } |
| 564 | |
| 565 | static append_frame* create_at( |
| 566 | address addr, int offset_delta, int appends, |
| 567 | verification_type_info* types) { |
| 568 | append_frame* sm = (append_frame*)addr; |
| 569 | sm->set_appends(appends); |
| 570 | sm->set_offset_delta(offset_delta); |
| 571 | if (types != NULL__null) { |
| 572 | verification_type_info* cur = sm->types(); |
| 573 | for (int i = 0; i < appends; ++i) { |
| 574 | cur->copy_from(types); |
| 575 | cur = cur->next(); |
| 576 | types = types->next(); |
| 577 | } |
| 578 | } |
| 579 | return sm; |
| 580 | } |
| 581 | |
| 582 | static size_t calculate_size(int appends, verification_type_info* types) { |
| 583 | size_t sz = sizeof(u1) + sizeof(u2); |
| 584 | for (int i = 0; i < appends; ++i) { |
| 585 | sz += types->size(); |
| 586 | types = types->next(); |
| 587 | } |
| 588 | return sz; |
| 589 | } |
| 590 | |
| 591 | static size_t max_size() { |
| 592 | return sizeof(u1) + sizeof(u2) + 3 * verification_type_info::max_size(); |
| 593 | } |
| 594 | |
| 595 | size_t size() const { return calculate_size(number_of_types(), types()); } |
| 596 | int offset_delta() const { |
| 597 | return Bytes::get_Java_u2(offset_delta_addr()) + 1; |
| 598 | } |
| 599 | |
| 600 | void set_offset_delta(int offset_delta) { |
| 601 | Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1); |
| 602 | } |
| 603 | |
| 604 | void set_appends(int appends) { |
| 605 | assert(appends > 0 && appends < 4, "Bad number of appends")do { if (!(appends > 0 && appends < 4)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 605, "assert(" "appends > 0 && appends < 4" ") failed" , "Bad number of appends"); ::breakpoint(); } } while (0); |
| 606 | set_frame_type(appends_to_frame_type(appends)); |
| 607 | } |
| 608 | |
| 609 | int number_of_types() const { |
| 610 | int appends = frame_type_to_appends(frame_type()); |
| 611 | assert(appends > 0 && appends < 4, "Invalid number of appends in frame")do { if (!(appends > 0 && appends < 4)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 611, "assert(" "appends > 0 && appends < 4" ") failed" , "Invalid number of appends in frame"); ::breakpoint(); } } while (0); |
| 612 | return appends; |
| 613 | } |
| 614 | verification_type_info* types() const { |
| 615 | return verification_type_info::at(types_addr()); |
| 616 | } |
| 617 | bool is_valid_offset(int offset) const { return true; } |
| 618 | |
| 619 | bool verify_subtype(address start, address end) const { |
| 620 | verification_type_info* vti = types(); |
| 621 | if ((address)vti < end && vti->verify(start, end)) { |
| 622 | int nof = number_of_types(); |
| 623 | vti = vti->next(); |
| 624 | if (nof < 2 || vti->verify(start, end)) { |
| 625 | vti = vti->next(); |
| 626 | if (nof < 3 || vti->verify(start, end)) { |
| 627 | return true; |
| 628 | } |
| 629 | } |
| 630 | } |
| 631 | return false; |
| 632 | } |
| 633 | |
| 634 | void print_on(outputStream* st, int current_offset = -1) const { |
| 635 | st->print("append_frame(@%d,", offset_delta() + current_offset); |
| 636 | verification_type_info* vti = types(); |
| 637 | for (int i = 0; i < number_of_types(); ++i) { |
| 638 | vti->print_on(st); |
| 639 | if (i != number_of_types() - 1) { |
| 640 | st->print(","); |
| 641 | } |
| 642 | vti = vti->next(); |
| 643 | } |
| 644 | st->print(")"); |
| 645 | } |
| 646 | |
| 647 | void print_truncated(outputStream* st, int current_offset = -1) const { |
| 648 | st->print("append_frame(@%d), output truncated, Stackmap exceeds table size.", |
| 649 | offset_delta() + current_offset); |
| 650 | } |
| 651 | }; |
| 652 | |
| 653 | class full_frame : public stack_map_frame { |
| 654 | private: |
| 655 | address offset_delta_addr() const { return frame_type_addr() + sizeof(u1); } |
| 656 | address num_locals_addr() const { return offset_delta_addr() + sizeof(u2); } |
| 657 | address locals_addr() const { return num_locals_addr() + sizeof(u2); } |
| 658 | address stack_slots_addr(address end_of_locals) const { |
| 659 | return end_of_locals; } |
| 660 | address stack_addr(address end_of_locals) const { |
| 661 | return stack_slots_addr(end_of_locals) + sizeof(u2); } |
| 662 | |
| 663 | enum { _frame_id = 255 }; |
| 664 | |
| 665 | public: |
| 666 | static bool is_frame_type(u1 tag) { |
| 667 | return tag == _frame_id; |
| 668 | } |
| 669 | |
| 670 | static full_frame* at(address addr) { |
| 671 | assert(is_frame_type(*addr), "Wrong frame id")do { if (!(is_frame_type(*addr))) { (*g_assert_poison) = 'X'; ; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/classfile/stackMapTableFormat.hpp" , 671, "assert(" "is_frame_type(*addr)" ") failed", "Wrong frame id" ); ::breakpoint(); } } while (0); |
| 672 | return (full_frame*)addr; |
| 673 | } |
| 674 | |
| 675 | static full_frame* create_at( |
| 676 | address addr, int offset_delta, int num_locals, |
| 677 | verification_type_info* locals, |
| 678 | int stack_slots, verification_type_info* stack) { |
| 679 | full_frame* sm = (full_frame*)addr; |
| 680 | sm->set_frame_type(_frame_id); |
| 681 | sm->set_offset_delta(offset_delta); |
| 682 | sm->set_num_locals(num_locals); |
| 683 | if (locals != NULL__null) { |
| 684 | verification_type_info* cur = sm->locals(); |
| 685 | for (int i = 0; i < num_locals; ++i) { |
| 686 | cur->copy_from(locals); |
| 687 | cur = cur->next(); |
| 688 | locals = locals->next(); |
| 689 | } |
| 690 | address end_of_locals = (address)cur; |
| 691 | sm->set_stack_slots(end_of_locals, stack_slots); |
| 692 | cur = sm->stack(end_of_locals); |
| 693 | for (int i = 0; i < stack_slots; ++i) { |
| 694 | cur->copy_from(stack); |
| 695 | cur = cur->next(); |
| 696 | stack = stack->next(); |
| 697 | } |
| 698 | } |
| 699 | return sm; |
| 700 | } |
| 701 | |
| 702 | static size_t calculate_size( |
| 703 | int num_locals, verification_type_info* locals, |
| 704 | int stack_slots, verification_type_info* stack) { |
| 705 | size_t sz = sizeof(u1) + sizeof(u2) + sizeof(u2) + sizeof(u2); |
| 706 | verification_type_info* vti = locals; |
| 707 | for (int i = 0; i < num_locals; ++i) { |
| 708 | sz += vti->size(); |
| 709 | vti = vti->next(); |
| 710 | } |
| 711 | vti = stack; |
| 712 | for (int i = 0; i < stack_slots; ++i) { |
| 713 | sz += vti->size(); |
| 714 | vti = vti->next(); |
| 715 | } |
| 716 | return sz; |
| 717 | } |
| 718 | |
| 719 | static size_t max_size(int locals, int stack) { |
| 720 | return sizeof(u1) + 3 * sizeof(u2) + |
| 721 | (locals + stack) * verification_type_info::max_size(); |
| 722 | } |
| 723 | |
| 724 | size_t size() const { |
| 725 | address eol = end_of_locals(); |
| 726 | return calculate_size(num_locals(), locals(), stack_slots(eol), stack(eol)); |
| 727 | } |
| 728 | |
| 729 | int offset_delta() const { |
| 730 | return Bytes::get_Java_u2(offset_delta_addr()) + 1; |
| 731 | } |
| 732 | int num_locals() const { return Bytes::get_Java_u2(num_locals_addr()); } |
| 733 | verification_type_info* locals() const { |
| 734 | return verification_type_info::at(locals_addr()); |
| 735 | } |
| 736 | address end_of_locals() const { |
| 737 | verification_type_info* vti = locals(); |
| 738 | for (int i = 0; i < num_locals(); ++i) { |
| 739 | vti = vti->next(); |
| 740 | } |
| 741 | return (address)vti; |
| 742 | } |
| 743 | int stack_slots(address end_of_locals) const { |
| 744 | return Bytes::get_Java_u2(stack_slots_addr(end_of_locals)); |
| 745 | } |
| 746 | verification_type_info* stack(address end_of_locals) const { |
| 747 | return verification_type_info::at(stack_addr(end_of_locals)); |
| 748 | } |
| 749 | |
| 750 | void set_offset_delta(int offset_delta) { |
| 751 | Bytes::put_Java_u2(offset_delta_addr(), offset_delta - 1); |
| 752 | } |
| 753 | void set_num_locals(int num_locals) { |
| 754 | Bytes::put_Java_u2(num_locals_addr(), num_locals); |
| 755 | } |
| 756 | void set_stack_slots(address end_of_locals, int stack_slots) { |
| 757 | Bytes::put_Java_u2(stack_slots_addr(end_of_locals), stack_slots); |
| 758 | } |
| 759 | |
| 760 | // These return only the locals. Extra processing is required for stack |
| 761 | // types of full frames. |
| 762 | int number_of_types() const { return num_locals(); } |
| 763 | verification_type_info* types() const { return locals(); } |
| 764 | bool is_valid_offset(int offset) { return true; } |
| 765 | |
| 766 | bool verify_subtype(address start, address end) const { |
| 767 | verification_type_info* vti = types(); |
| 768 | if ((address)vti >= end) { |
| 769 | return false; |
| 770 | } |
| 771 | int count = number_of_types(); |
| 772 | for (int i = 0; i < count; ++i) { |
| 773 | if (!vti->verify(start, end)) { |
| 774 | return false; |
| 775 | } |
| 776 | vti = vti->next(); |
| 777 | } |
| 778 | address eol = (address)vti; |
| 779 | if (eol + sizeof(u2) > end) { |
| 780 | return false; |
| 781 | } |
| 782 | count = stack_slots(eol); |
Value stored to 'count' is never read | |
| 783 | vti = stack(eol); |
| 784 | for (int i = 0; i < stack_slots(eol); ++i) { |
| 785 | if (!vti->verify(start, end)) { |
| 786 | return false; |
| 787 | } |
| 788 | vti = vti->next(); |
| 789 | } |
| 790 | return true; |
| 791 | } |
| 792 | |
| 793 | void print_on(outputStream* st, int current_offset = -1) const { |
| 794 | st->print("full_frame(@%d,{", offset_delta() + current_offset); |
| 795 | verification_type_info* vti = locals(); |
| 796 | for (int i = 0; i < num_locals(); ++i) { |
| 797 | vti->print_on(st); |
| 798 | if (i != num_locals() - 1) { |
| 799 | st->print(","); |
| 800 | } |
| 801 | vti = vti->next(); |
| 802 | } |
| 803 | st->print("},{"); |
| 804 | address end_of_locals = (address)vti; |
| 805 | vti = stack(end_of_locals); |
| 806 | int ss = stack_slots(end_of_locals); |
| 807 | for (int i = 0; i < ss; ++i) { |
| 808 | vti->print_on(st); |
| 809 | if (i != ss - 1) { |
| 810 | st->print(","); |
| 811 | } |
| 812 | vti = vti->next(); |
| 813 | } |
| 814 | st->print("})"); |
| 815 | } |
| 816 | |
| 817 | void print_truncated(outputStream* st, int current_offset = -1) const { |
| 818 | st->print("full_frame(@%d), output truncated, Stackmap exceeds table size.", |
| 819 | offset_delta() + current_offset); |
| 820 | } |
| 821 | }; |
| 822 | |
| 823 | #define VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \ |
| 824 | stack_frame_type* item_##stack_frame_type = as_##stack_frame_type(); \ |
| 825 | if (item_##stack_frame_type != NULL__null) { \ |
| 826 | return item_##stack_frame_type->func_name args; \ |
| 827 | } |
| 828 | |
| 829 | #define VOID_VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \ |
| 830 | stack_frame_type* item_##stack_frame_type = as_##stack_frame_type(); \ |
| 831 | if (item_##stack_frame_type != NULL__null) { \ |
| 832 | item_##stack_frame_type->func_name args; \ |
| 833 | return; \ |
| 834 | } |
| 835 | |
| 836 | size_t stack_map_frame::size() const { |
| 837 | FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, size, ()); |
| 838 | return 0; |
| 839 | } |
| 840 | |
| 841 | int stack_map_frame::offset_delta() const { |
| 842 | FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, offset_delta, ()); |
| 843 | return 0; |
| 844 | } |
| 845 | |
| 846 | void stack_map_frame::set_offset_delta(int offset_delta) { |
| 847 | FOR_EACH_STACKMAP_FRAME_TYPE( |
| 848 | VOID_VIRTUAL_DISPATCH, set_offset_delta, (offset_delta)); |
| 849 | } |
| 850 | |
| 851 | int stack_map_frame::number_of_types() const { |
| 852 | FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, number_of_types, ()); |
| 853 | return 0; |
| 854 | } |
| 855 | |
| 856 | verification_type_info* stack_map_frame::types() const { |
| 857 | FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, types, ()); |
| 858 | return NULL__null; |
| 859 | } |
| 860 | |
| 861 | bool stack_map_frame::is_valid_offset(int offset) const { |
| 862 | FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, is_valid_offset, (offset)); |
| 863 | return true; |
| 864 | } |
| 865 | |
| 866 | bool stack_map_frame::verify(address start, address end) const { |
| 867 | if (frame_type_addr() >= start && frame_type_addr() < end) { |
| 868 | FOR_EACH_STACKMAP_FRAME_TYPE( |
| 869 | VIRTUAL_DISPATCH, verify_subtype, (start, end)); |
| 870 | } |
| 871 | return false; |
| 872 | } |
| 873 | |
| 874 | void stack_map_frame::print_on(outputStream* st, int offs = -1) const { |
| 875 | FOR_EACH_STACKMAP_FRAME_TYPE(VOID_VIRTUAL_DISPATCH, print_on, (st, offs)); |
| 876 | } |
| 877 | |
| 878 | void stack_map_frame::print_truncated(outputStream* st, int offs = -1) const { |
| 879 | FOR_EACH_STACKMAP_FRAME_TYPE(VOID_VIRTUAL_DISPATCH, print_truncated, (st, offs)); |
| 880 | } |
| 881 | |
| 882 | #undef VIRTUAL_DISPATCH |
| 883 | #undef VOID_VIRTUAL_DISPATCH |
| 884 | |
| 885 | #define AS_SUBTYPE_DEF(stack_frame_type, arg1, arg2) \ |
| 886 | stack_frame_type* stack_map_frame::as_##stack_frame_type() const { \ |
| 887 | if (stack_frame_type::is_frame_type(frame_type())) { \ |
| 888 | return (stack_frame_type*)this; \ |
| 889 | } else { \ |
| 890 | return NULL__null; \ |
| 891 | } \ |
| 892 | } |
| 893 | |
| 894 | FOR_EACH_STACKMAP_FRAME_TYPE(AS_SUBTYPE_DEF, x, x) |
| 895 | #undef AS_SUBTYPE_DEF |
| 896 | |
| 897 | class stack_map_table { |
| 898 | private: |
| 899 | address number_of_entries_addr() const { |
| 900 | return (address)this; |
| 901 | } |
| 902 | address entries_addr() const { |
| 903 | return number_of_entries_addr() + sizeof(u2); |
| 904 | } |
| 905 | NONCOPYABLE(stack_map_table)stack_map_table(stack_map_table const&) = delete; stack_map_table & operator=(stack_map_table const&) = delete; |
| 906 | |
| 907 | protected: |
| 908 | // No constructors - should be 'private', but GCC issues a warning if it is |
| 909 | stack_map_table() {} |
| 910 | |
| 911 | public: |
| 912 | |
| 913 | static stack_map_table* at(address addr) { |
| 914 | return (stack_map_table*)addr; |
| 915 | } |
| 916 | |
| 917 | u2 number_of_entries() const { |
| 918 | return Bytes::get_Java_u2(number_of_entries_addr()); |
| 919 | } |
| 920 | stack_map_frame* entries() const { |
| 921 | return stack_map_frame::at(entries_addr()); |
| 922 | } |
| 923 | |
| 924 | void set_number_of_entries(u2 num) { |
| 925 | Bytes::put_Java_u2(number_of_entries_addr(), num); |
| 926 | } |
| 927 | }; |
| 928 | |
| 929 | class stack_map_table_attribute { |
| 930 | private: |
| 931 | address name_index_addr() const { |
| 932 | return (address)this; } |
| 933 | address attribute_length_addr() const { |
| 934 | return name_index_addr() + sizeof(u2); } |
| 935 | address stack_map_table_addr() const { |
| 936 | return attribute_length_addr() + sizeof(u4); } |
| 937 | NONCOPYABLE(stack_map_table_attribute)stack_map_table_attribute(stack_map_table_attribute const& ) = delete; stack_map_table_attribute& operator=(stack_map_table_attribute const&) = delete; |
| 938 | |
| 939 | protected: |
| 940 | // No constructors - should be 'private', but GCC issues a warning if it is |
| 941 | stack_map_table_attribute() {} |
| 942 | |
| 943 | public: |
| 944 | |
| 945 | static stack_map_table_attribute* at(address addr) { |
| 946 | return (stack_map_table_attribute*)addr; |
| 947 | } |
| 948 | |
| 949 | u2 name_index() const { |
| 950 | return Bytes::get_Java_u2(name_index_addr()); } |
| 951 | u4 attribute_length() const { |
| 952 | return Bytes::get_Java_u4(attribute_length_addr()); } |
| 953 | stack_map_table* table() const { |
| 954 | return stack_map_table::at(stack_map_table_addr()); |
| 955 | } |
| 956 | |
| 957 | void set_name_index(u2 idx) { |
| 958 | Bytes::put_Java_u2(name_index_addr(), idx); |
| 959 | } |
| 960 | void set_attribute_length(u4 len) { |
| 961 | Bytes::put_Java_u4(attribute_length_addr(), len); |
| 962 | } |
| 963 | }; |
| 964 | |
| 965 | #undef FOR_EACH_STACKMAP_FRAME_TYPE |
| 966 | |
| 967 | #endif // SHARE_CLASSFILE_STACKMAPTABLEFORMAT_HPP |