110
111 enum {
112 cell_size = sizeof(intptr_t)
113 };
114
115 // Tag values
116 enum : u1 {
117 no_tag,
118 bit_data_tag,
119 counter_data_tag,
120 jump_data_tag,
121 receiver_type_data_tag,
122 virtual_call_data_tag,
123 ret_data_tag,
124 branch_data_tag,
125 multi_branch_data_tag,
126 arg_info_data_tag,
127 call_type_data_tag,
128 virtual_call_type_data_tag,
129 parameters_type_data_tag,
130 speculative_trap_data_tag
131 };
132
133 enum {
134 // The trap state breaks down as [recompile:1 | reason:31].
135 // This further breakdown is defined in deoptimization.cpp.
136 // See Deoptimization::trap_state_reason for an assert that
137 // trap_bits is big enough to hold reasons < Reason_RECORDED_LIMIT.
138 //
139 // The trap_state is collected only if ProfileTraps is true.
140 trap_bits = 1+31, // 31: enough to distinguish [0..Reason_RECORDED_LIMIT].
141 trap_mask = -1,
142 first_flag = 0
143 };
144
145 // Size computation
146 static int header_size_in_bytes() {
147 return header_size_in_cells() * cell_size;
148 }
149 static int header_size_in_cells() {
150 return LP64_ONLY(1) NOT_LP64(2);
270
271 int size_in_bytes() {
272 int cells = cell_count();
273 assert(cells >= 0, "invalid number of cells");
274 return DataLayout::compute_size_in_bytes(cells);
275 }
276 int cell_count();
277
278 // GC support
279 void clean_weak_klass_links(bool always_clean);
280 };
281
282
283 // ProfileData class hierarchy
284 class ProfileData;
285 class BitData;
286 class CounterData;
287 class ReceiverTypeData;
288 class VirtualCallData;
289 class VirtualCallTypeData;
290 class RetData;
291 class CallTypeData;
292 class JumpData;
293 class BranchData;
294 class ArrayData;
295 class MultiBranchData;
296 class ArgInfoData;
297 class ParametersTypeData;
298 class SpeculativeTrapData;
299
300 // ProfileData
301 //
302 // A ProfileData object is created to refer to a section of profiling
303 // data in a structured way.
304 class ProfileData : public ResourceObj {
305 friend class TypeEntries;
306 friend class ReturnTypeEntry;
307 friend class TypeStackSlotEntries;
308 private:
309 enum {
310 tab_width_one = 16,
311 tab_width_two = 36
312 };
313
314 // This is a pointer to a section of profiling data.
315 DataLayout* _data;
316
317 char* print_data_on_helper(const MethodData* md) const;
318
319 protected:
320 DataLayout* data() { return _data; }
321 const DataLayout* data() const { return _data; }
322
323 enum {
324 cell_size = DataLayout::cell_size
325 };
326
405 }
406 void set_trap_state(int new_state) {
407 data()->set_trap_state(new_state);
408 }
409
410 // Type checking
411 virtual bool is_BitData() const { return false; }
412 virtual bool is_CounterData() const { return false; }
413 virtual bool is_JumpData() const { return false; }
414 virtual bool is_ReceiverTypeData()const { return false; }
415 virtual bool is_VirtualCallData() const { return false; }
416 virtual bool is_RetData() const { return false; }
417 virtual bool is_BranchData() const { return false; }
418 virtual bool is_ArrayData() const { return false; }
419 virtual bool is_MultiBranchData() const { return false; }
420 virtual bool is_ArgInfoData() const { return false; }
421 virtual bool is_CallTypeData() const { return false; }
422 virtual bool is_VirtualCallTypeData()const { return false; }
423 virtual bool is_ParametersTypeData() const { return false; }
424 virtual bool is_SpeculativeTrapData()const { return false; }
425
426
427 BitData* as_BitData() const {
428 assert(is_BitData(), "wrong type");
429 return is_BitData() ? (BitData*) this : nullptr;
430 }
431 CounterData* as_CounterData() const {
432 assert(is_CounterData(), "wrong type");
433 return is_CounterData() ? (CounterData*) this : nullptr;
434 }
435 JumpData* as_JumpData() const {
436 assert(is_JumpData(), "wrong type");
437 return is_JumpData() ? (JumpData*) this : nullptr;
438 }
439 ReceiverTypeData* as_ReceiverTypeData() const {
440 assert(is_ReceiverTypeData(), "wrong type");
441 return is_ReceiverTypeData() ? (ReceiverTypeData*)this : nullptr;
442 }
443 VirtualCallData* as_VirtualCallData() const {
444 assert(is_VirtualCallData(), "wrong type");
463 ArgInfoData* as_ArgInfoData() const {
464 assert(is_ArgInfoData(), "wrong type");
465 return is_ArgInfoData() ? (ArgInfoData*)this : nullptr;
466 }
467 CallTypeData* as_CallTypeData() const {
468 assert(is_CallTypeData(), "wrong type");
469 return is_CallTypeData() ? (CallTypeData*)this : nullptr;
470 }
471 VirtualCallTypeData* as_VirtualCallTypeData() const {
472 assert(is_VirtualCallTypeData(), "wrong type");
473 return is_VirtualCallTypeData() ? (VirtualCallTypeData*)this : nullptr;
474 }
475 ParametersTypeData* as_ParametersTypeData() const {
476 assert(is_ParametersTypeData(), "wrong type");
477 return is_ParametersTypeData() ? (ParametersTypeData*)this : nullptr;
478 }
479 SpeculativeTrapData* as_SpeculativeTrapData() const {
480 assert(is_SpeculativeTrapData(), "wrong type");
481 return is_SpeculativeTrapData() ? (SpeculativeTrapData*)this : nullptr;
482 }
483
484
485 // Subclass specific initialization
486 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo) {}
487
488 // GC support
489 virtual void clean_weak_klass_links(bool always_clean) {}
490
491 // CDS support
492 virtual void metaspace_pointers_do(MetaspaceClosure* it) {}
493
494 // CI translation: ProfileData can represent both MethodDataOop data
495 // as well as CIMethodData data. This function is provided for translating
496 // an oop in a ProfileData to the ci equivalent. Generally speaking,
497 // most ProfileData don't require any translation, so we provide the null
498 // translation here, and the required translators are in the ci subclasses.
499 virtual void translate_from(const ProfileData* data) {}
500
501 virtual void print_data_on(outputStream* st, const char* extra = nullptr) const {
502 ShouldNotReachHere();
503 }
504
505 void print_data_on(outputStream* st, const MethodData* md) const;
506
507 void print_shared(outputStream* st, const char* name, const char* extra) const;
508 void tab(outputStream* st, bool first = false) const;
509 };
510
511 // BitData
512 //
513 // A BitData holds a flag or two in its header.
514 class BitData : public ProfileData {
515 friend class VMStructs;
516 protected:
517 enum : u1 {
518 // null_seen:
519 // saw a null operand (cast/aastore/instanceof)
520 null_seen_flag = DataLayout::first_flag + 0,
521 exception_handler_entered_flag = null_seen_flag + 1,
522 deprecated_method_callsite_flag = exception_handler_entered_flag + 1
523 };
524 enum { bit_cell_count = 0 }; // no additional data fields needed.
525 public:
526 BitData(DataLayout* layout) : ProfileData(layout) {
527 }
528
529 virtual bool is_BitData() const { return true; }
530
531 static int static_cell_count() {
532 return bit_cell_count;
533 }
534
535 virtual int cell_count() const {
536 return static_cell_count();
537 }
538
539 // Accessor
540
541 // The null_seen flag bit is specially known to the interpreter.
542 // Consulting it allows the compiler to avoid setting up null_check traps.
543 bool null_seen() { return flag_at(null_seen_flag); }
544 void set_null_seen() { set_flag_at(null_seen_flag); }
545 bool deprecated_method_call_site() const { return flag_at(deprecated_method_callsite_flag); }
546 bool set_deprecated_method_call_site() { return data()->set_flag_at(deprecated_method_callsite_flag); }
547 bool clear_deprecated_method_call_site() { return data()->clear_flag_at(deprecated_method_callsite_flag); }
548
549 // true if a ex handler block at this bci was entered
550 bool exception_handler_entered() { return flag_at(exception_handler_entered_flag); }
551 void set_exception_handler_entered() { set_flag_at(exception_handler_entered_flag); }
552
553 // Code generation support
554 static u1 null_seen_byte_constant() {
555 return flag_number_to_constant(null_seen_flag);
556 }
557
558 static ByteSize bit_data_size() {
559 return cell_offset(bit_cell_count);
560 }
561
562 void print_data_on(outputStream* st, const char* extra = nullptr) const;
563 };
616 // A JumpData is used to access profiling information for a direct
617 // branch. It is a counter, used for counting the number of branches,
618 // plus a data displacement, used for realigning the data pointer to
619 // the corresponding target bci.
620 class JumpData : public ProfileData {
621 friend class VMStructs;
622 protected:
623 enum {
624 taken_off_set,
625 displacement_off_set,
626 jump_cell_count
627 };
628
629 void set_displacement(int displacement) {
630 set_int_at(displacement_off_set, displacement);
631 }
632
633 public:
634 JumpData(DataLayout* layout) : ProfileData(layout) {
635 assert(layout->tag() == DataLayout::jump_data_tag ||
636 layout->tag() == DataLayout::branch_data_tag, "wrong type");
637 }
638
639 virtual bool is_JumpData() const { return true; }
640
641 static int static_cell_count() {
642 return jump_cell_count;
643 }
644
645 virtual int cell_count() const {
646 return static_cell_count();
647 }
648
649 // Direct accessor
650 uint taken() const {
651 return uint_at(taken_off_set);
652 }
653
654 void set_taken(uint cnt) {
655 set_uint_at(taken_off_set, cnt);
656 }
860
861 static int per_arg_count() {
862 return per_arg_cell_count;
863 }
864
865 ByteSize type_offset(int i) const {
866 return DataLayout::cell_offset(type_offset_in_cells(i));
867 }
868
869 // GC support
870 void clean_weak_klass_links(bool always_clean);
871
872 // CDS support
873 virtual void metaspace_pointers_do(MetaspaceClosure* it);
874
875 void print_data_on(outputStream* st) const;
876 };
877
878 // Type entry used for return from a call. A single cell to record the
879 // type.
880 class ReturnTypeEntry : public TypeEntries {
881
882 private:
883 enum {
884 cell_count = 1
885 };
886
887 public:
888 ReturnTypeEntry(int base_off)
889 : TypeEntries(base_off) {}
890
891 void post_initialize() {
892 set_type(type_none());
893 }
894
895 intptr_t type() const {
896 return _pd->intptr_at(_base_off);
897 }
898
899 intptr_t* type_adr() const {
900 return _pd->intptr_at_adr(_base_off);
901 }
902
903 void set_type(intptr_t k) {
904 _pd->set_intptr_at(_base_off, k);
905 }
906
907 static int static_cell_count() {
908 return cell_count;
909 }
910
911 static ByteSize size() {
912 return in_ByteSize(cell_count * DataLayout::cell_size);
913 }
914
915 ByteSize type_offset() {
916 return DataLayout::cell_offset(_base_off);
917 }
918
919 // GC support
920 void clean_weak_klass_links(bool always_clean);
921
922 // CDS support
923 virtual void metaspace_pointers_do(MetaspaceClosure* it);
924
925 void print_data_on(outputStream* st) const;
926 };
927
928 // Entries to collect type information at a call: contains arguments
929 // (TypeStackSlotEntries), a return type (ReturnTypeEntry) and a
930 // number of cells. Because the number of cells for the return type is
931 // smaller than the number of cells for the type of an arguments, the
932 // number of cells is used to tell how many arguments are profiled and
933 // whether a return value is profiled. See has_arguments() and
934 // has_return().
935 class TypeEntriesAtCall {
936 private:
937 static int stack_slot_local_offset(int i) {
938 return header_cell_count() + TypeStackSlotEntries::stack_slot_local_offset(i);
939 }
940
941 static int argument_type_local_offset(int i) {
942 return header_cell_count() + TypeStackSlotEntries::type_local_offset(i);
943 }
944
945 public:
946
947 static int header_cell_count() {
948 return 1;
949 }
963 static bool return_profiling_enabled();
964
965 // Code generation support
966 static ByteSize cell_count_offset() {
967 return in_ByteSize(cell_count_local_offset() * DataLayout::cell_size);
968 }
969
970 static ByteSize args_data_offset() {
971 return in_ByteSize(header_cell_count() * DataLayout::cell_size);
972 }
973
974 static ByteSize stack_slot_offset(int i) {
975 return in_ByteSize(stack_slot_local_offset(i) * DataLayout::cell_size);
976 }
977
978 static ByteSize argument_type_offset(int i) {
979 return in_ByteSize(argument_type_local_offset(i) * DataLayout::cell_size);
980 }
981
982 static ByteSize return_only_size() {
983 return ReturnTypeEntry::size() + in_ByteSize(header_cell_count() * DataLayout::cell_size);
984 }
985
986 };
987
988 // CallTypeData
989 //
990 // A CallTypeData is used to access profiling information about a non
991 // virtual call for which we collect type information about arguments
992 // and return value.
993 class CallTypeData : public CounterData {
994 private:
995 // entries for arguments if any
996 TypeStackSlotEntries _args;
997 // entry for return type if any
998 ReturnTypeEntry _ret;
999
1000 int cell_count_global_offset() const {
1001 return CounterData::static_cell_count() + TypeEntriesAtCall::cell_count_local_offset();
1002 }
1003
1004 // number of cells not counting the header
1005 int cell_count_no_header() const {
1006 return uint_at(cell_count_global_offset());
1007 }
1008
1009 void check_number_of_arguments(int total) {
1010 assert(number_of_arguments() == total, "should be set in DataLayout::initialize");
1011 }
1012
1013 public:
1014 CallTypeData(DataLayout* layout) :
1015 CounterData(layout),
1016 _args(CounterData::static_cell_count()+TypeEntriesAtCall::header_cell_count(), number_of_arguments()),
1017 _ret(cell_count() - ReturnTypeEntry::static_cell_count())
1018 {
1019 assert(layout->tag() == DataLayout::call_type_data_tag, "wrong type");
1020 // Some compilers (VC++) don't want this passed in member initialization list
1021 _args.set_profile_data(this);
1022 _ret.set_profile_data(this);
1023 }
1024
1025 const TypeStackSlotEntries* args() const {
1026 assert(has_arguments(), "no profiling of arguments");
1027 return &_args;
1028 }
1029
1030 const ReturnTypeEntry* ret() const {
1031 assert(has_return(), "no profiling of return value");
1032 return &_ret;
1033 }
1034
1035 virtual bool is_CallTypeData() const { return true; }
1036
1037 static int static_cell_count() {
1038 return -1;
1039 }
1040
1041 static int compute_cell_count(BytecodeStream* stream) {
1042 return CounterData::static_cell_count() + TypeEntriesAtCall::compute_cell_count(stream);
1043 }
1044
1045 static void initialize(DataLayout* dl, int cell_count) {
1046 TypeEntriesAtCall::initialize(dl, CounterData::static_cell_count(), cell_count);
1047 }
1048
1049 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo);
1050
1133 // pairs which are used to store a type profile for the receiver of
1134 // the check, the associated count is incremented every time the type
1135 // is seen. A per ReceiverTypeData counter is incremented on type
1136 // overflow (when there's no more room for a not yet profiled Klass*).
1137 //
1138 // Updated by platform-specific code, for example MacroAssembler::profile_receiver_type.
1139 //
1140 class ReceiverTypeData : public CounterData {
1141 friend class VMStructs;
1142 protected:
1143 enum {
1144 receiver0_offset = counter_cell_count,
1145 count0_offset,
1146 receiver_type_row_cell_count = (count0_offset + 1) - receiver0_offset
1147 };
1148
1149 public:
1150 ReceiverTypeData(DataLayout* layout) : CounterData(layout) {
1151 assert(layout->tag() == DataLayout::receiver_type_data_tag ||
1152 layout->tag() == DataLayout::virtual_call_data_tag ||
1153 layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
1154 }
1155
1156 virtual bool is_ReceiverTypeData() const { return true; }
1157
1158 static int static_cell_count() {
1159 return counter_cell_count + (uint) TypeProfileWidth * receiver_type_row_cell_count;
1160 }
1161
1162 virtual int cell_count() const {
1163 return static_cell_count();
1164 }
1165
1166 // Direct accessors
1167 static uint row_limit() {
1168 return (uint) TypeProfileWidth;
1169 }
1170 static int receiver_cell_index(uint row) {
1171 return receiver0_offset + row * receiver_type_row_cell_count;
1172 }
1173 static int receiver_count_cell_index(uint row) {
1265 }
1266
1267 // Direct accessors
1268 static ByteSize virtual_call_data_size() {
1269 return cell_offset(static_cell_count());
1270 }
1271
1272 void print_data_on(outputStream* st, const char* extra = nullptr) const;
1273 };
1274
1275 // VirtualCallTypeData
1276 //
1277 // A VirtualCallTypeData is used to access profiling information about
1278 // a virtual call for which we collect type information about
1279 // arguments and return value.
1280 class VirtualCallTypeData : public VirtualCallData {
1281 private:
1282 // entries for arguments if any
1283 TypeStackSlotEntries _args;
1284 // entry for return type if any
1285 ReturnTypeEntry _ret;
1286
1287 int cell_count_global_offset() const {
1288 return VirtualCallData::static_cell_count() + TypeEntriesAtCall::cell_count_local_offset();
1289 }
1290
1291 // number of cells not counting the header
1292 int cell_count_no_header() const {
1293 return uint_at(cell_count_global_offset());
1294 }
1295
1296 void check_number_of_arguments(int total) {
1297 assert(number_of_arguments() == total, "should be set in DataLayout::initialize");
1298 }
1299
1300 public:
1301 VirtualCallTypeData(DataLayout* layout) :
1302 VirtualCallData(layout),
1303 _args(VirtualCallData::static_cell_count()+TypeEntriesAtCall::header_cell_count(), number_of_arguments()),
1304 _ret(cell_count() - ReturnTypeEntry::static_cell_count())
1305 {
1306 assert(layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
1307 // Some compilers (VC++) don't want this passed in member initialization list
1308 _args.set_profile_data(this);
1309 _ret.set_profile_data(this);
1310 }
1311
1312 const TypeStackSlotEntries* args() const {
1313 assert(has_arguments(), "no profiling of arguments");
1314 return &_args;
1315 }
1316
1317 const ReturnTypeEntry* ret() const {
1318 assert(has_return(), "no profiling of return value");
1319 return &_ret;
1320 }
1321
1322 virtual bool is_VirtualCallTypeData() const { return true; }
1323
1324 static int static_cell_count() {
1325 return -1;
1326 }
1327
1328 static int compute_cell_count(BytecodeStream* stream) {
1329 return VirtualCallData::static_cell_count() + TypeEntriesAtCall::compute_cell_count(stream);
1330 }
1331
1332 static void initialize(DataLayout* dl, int cell_count) {
1333 TypeEntriesAtCall::initialize(dl, VirtualCallData::static_cell_count(), cell_count);
1334 }
1335
1336 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo);
1337
1509
1510 // BranchData
1511 //
1512 // A BranchData is used to access profiling data for a two-way branch.
1513 // It consists of taken and not_taken counts as well as a data displacement
1514 // for the taken case.
1515 class BranchData : public JumpData {
1516 friend class VMStructs;
1517 protected:
1518 enum {
1519 not_taken_off_set = jump_cell_count,
1520 branch_cell_count
1521 };
1522
1523 void set_displacement(int displacement) {
1524 set_int_at(displacement_off_set, displacement);
1525 }
1526
1527 public:
1528 BranchData(DataLayout* layout) : JumpData(layout) {
1529 assert(layout->tag() == DataLayout::branch_data_tag, "wrong type");
1530 }
1531
1532 virtual bool is_BranchData() const { return true; }
1533
1534 static int static_cell_count() {
1535 return branch_cell_count;
1536 }
1537
1538 virtual int cell_count() const {
1539 return static_cell_count();
1540 }
1541
1542 // Direct accessor
1543 uint not_taken() const {
1544 return uint_at(not_taken_off_set);
1545 }
1546
1547 void set_not_taken(uint cnt) {
1548 set_uint_at(not_taken_off_set, cnt);
1549 }
1868 // Direct accessor
1869 Method* method() const {
1870 return (Method*)intptr_at(speculative_trap_method);
1871 }
1872
1873 void set_method(Method* m) {
1874 assert(!m->is_old(), "cannot add old methods");
1875 set_intptr_at(speculative_trap_method, (intptr_t)m);
1876 }
1877
1878 static ByteSize method_offset() {
1879 return cell_offset(speculative_trap_method);
1880 }
1881
1882 // CDS support
1883 virtual void metaspace_pointers_do(MetaspaceClosure* it);
1884
1885 virtual void print_data_on(outputStream* st, const char* extra = nullptr) const;
1886 };
1887
1888 // MethodData*
1889 //
1890 // A MethodData* holds information which has been collected about
1891 // a method. Its layout looks like this:
1892 //
1893 // -----------------------------
1894 // | header |
1895 // | klass |
1896 // -----------------------------
1897 // | method |
1898 // | size of the MethodData* |
1899 // -----------------------------
1900 // | Data entries... |
1901 // | (variable size) |
1902 // | |
1903 // . .
1904 // . .
1905 // . .
1906 // | |
1907 // -----------------------------
|
110
111 enum {
112 cell_size = sizeof(intptr_t)
113 };
114
115 // Tag values
116 enum : u1 {
117 no_tag,
118 bit_data_tag,
119 counter_data_tag,
120 jump_data_tag,
121 receiver_type_data_tag,
122 virtual_call_data_tag,
123 ret_data_tag,
124 branch_data_tag,
125 multi_branch_data_tag,
126 arg_info_data_tag,
127 call_type_data_tag,
128 virtual_call_type_data_tag,
129 parameters_type_data_tag,
130 speculative_trap_data_tag,
131 array_store_data_tag,
132 array_load_data_tag,
133 acmp_data_tag
134 };
135
136 enum {
137 // The trap state breaks down as [recompile:1 | reason:31].
138 // This further breakdown is defined in deoptimization.cpp.
139 // See Deoptimization::trap_state_reason for an assert that
140 // trap_bits is big enough to hold reasons < Reason_RECORDED_LIMIT.
141 //
142 // The trap_state is collected only if ProfileTraps is true.
143 trap_bits = 1+31, // 31: enough to distinguish [0..Reason_RECORDED_LIMIT].
144 trap_mask = -1,
145 first_flag = 0
146 };
147
148 // Size computation
149 static int header_size_in_bytes() {
150 return header_size_in_cells() * cell_size;
151 }
152 static int header_size_in_cells() {
153 return LP64_ONLY(1) NOT_LP64(2);
273
274 int size_in_bytes() {
275 int cells = cell_count();
276 assert(cells >= 0, "invalid number of cells");
277 return DataLayout::compute_size_in_bytes(cells);
278 }
279 int cell_count();
280
281 // GC support
282 void clean_weak_klass_links(bool always_clean);
283 };
284
285
286 // ProfileData class hierarchy
287 class ProfileData;
288 class BitData;
289 class CounterData;
290 class ReceiverTypeData;
291 class VirtualCallData;
292 class VirtualCallTypeData;
293 class ArrayStoreData;
294 class RetData;
295 class CallTypeData;
296 class JumpData;
297 class BranchData;
298 class ACmpData;
299 class ArrayData;
300 class MultiBranchData;
301 class ArgInfoData;
302 class ParametersTypeData;
303 class SpeculativeTrapData;
304 class ArrayLoadData;
305
306 // ProfileData
307 //
308 // A ProfileData object is created to refer to a section of profiling
309 // data in a structured way.
310 class ProfileData : public ResourceObj {
311 friend class TypeEntries;
312 friend class SingleTypeEntry;
313 friend class TypeStackSlotEntries;
314 private:
315 enum {
316 tab_width_one = 16,
317 tab_width_two = 36
318 };
319
320 // This is a pointer to a section of profiling data.
321 DataLayout* _data;
322
323 char* print_data_on_helper(const MethodData* md) const;
324
325 protected:
326 DataLayout* data() { return _data; }
327 const DataLayout* data() const { return _data; }
328
329 enum {
330 cell_size = DataLayout::cell_size
331 };
332
411 }
412 void set_trap_state(int new_state) {
413 data()->set_trap_state(new_state);
414 }
415
416 // Type checking
417 virtual bool is_BitData() const { return false; }
418 virtual bool is_CounterData() const { return false; }
419 virtual bool is_JumpData() const { return false; }
420 virtual bool is_ReceiverTypeData()const { return false; }
421 virtual bool is_VirtualCallData() const { return false; }
422 virtual bool is_RetData() const { return false; }
423 virtual bool is_BranchData() const { return false; }
424 virtual bool is_ArrayData() const { return false; }
425 virtual bool is_MultiBranchData() const { return false; }
426 virtual bool is_ArgInfoData() const { return false; }
427 virtual bool is_CallTypeData() const { return false; }
428 virtual bool is_VirtualCallTypeData()const { return false; }
429 virtual bool is_ParametersTypeData() const { return false; }
430 virtual bool is_SpeculativeTrapData()const { return false; }
431 virtual bool is_ArrayStoreData() const { return false; }
432 virtual bool is_ArrayLoadData() const { return false; }
433 virtual bool is_ACmpData() const { return false; }
434
435
436 BitData* as_BitData() const {
437 assert(is_BitData(), "wrong type");
438 return is_BitData() ? (BitData*) this : nullptr;
439 }
440 CounterData* as_CounterData() const {
441 assert(is_CounterData(), "wrong type");
442 return is_CounterData() ? (CounterData*) this : nullptr;
443 }
444 JumpData* as_JumpData() const {
445 assert(is_JumpData(), "wrong type");
446 return is_JumpData() ? (JumpData*) this : nullptr;
447 }
448 ReceiverTypeData* as_ReceiverTypeData() const {
449 assert(is_ReceiverTypeData(), "wrong type");
450 return is_ReceiverTypeData() ? (ReceiverTypeData*)this : nullptr;
451 }
452 VirtualCallData* as_VirtualCallData() const {
453 assert(is_VirtualCallData(), "wrong type");
472 ArgInfoData* as_ArgInfoData() const {
473 assert(is_ArgInfoData(), "wrong type");
474 return is_ArgInfoData() ? (ArgInfoData*)this : nullptr;
475 }
476 CallTypeData* as_CallTypeData() const {
477 assert(is_CallTypeData(), "wrong type");
478 return is_CallTypeData() ? (CallTypeData*)this : nullptr;
479 }
480 VirtualCallTypeData* as_VirtualCallTypeData() const {
481 assert(is_VirtualCallTypeData(), "wrong type");
482 return is_VirtualCallTypeData() ? (VirtualCallTypeData*)this : nullptr;
483 }
484 ParametersTypeData* as_ParametersTypeData() const {
485 assert(is_ParametersTypeData(), "wrong type");
486 return is_ParametersTypeData() ? (ParametersTypeData*)this : nullptr;
487 }
488 SpeculativeTrapData* as_SpeculativeTrapData() const {
489 assert(is_SpeculativeTrapData(), "wrong type");
490 return is_SpeculativeTrapData() ? (SpeculativeTrapData*)this : nullptr;
491 }
492 ArrayStoreData* as_ArrayStoreData() const {
493 assert(is_ArrayStoreData(), "wrong type");
494 return is_ArrayStoreData() ? (ArrayStoreData*)this : nullptr;
495 }
496 ArrayLoadData* as_ArrayLoadData() const {
497 assert(is_ArrayLoadData(), "wrong type");
498 return is_ArrayLoadData() ? (ArrayLoadData*)this : nullptr;
499 }
500 ACmpData* as_ACmpData() const {
501 assert(is_ACmpData(), "wrong type");
502 return is_ACmpData() ? (ACmpData*)this : nullptr;
503 }
504
505
506 // Subclass specific initialization
507 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo) {}
508
509 // GC support
510 virtual void clean_weak_klass_links(bool always_clean) {}
511
512 // CDS support
513 virtual void metaspace_pointers_do(MetaspaceClosure* it) {}
514
515 // CI translation: ProfileData can represent both MethodDataOop data
516 // as well as CIMethodData data. This function is provided for translating
517 // an oop in a ProfileData to the ci equivalent. Generally speaking,
518 // most ProfileData don't require any translation, so we provide the null
519 // translation here, and the required translators are in the ci subclasses.
520 virtual void translate_from(const ProfileData* data) {}
521
522 virtual void print_data_on(outputStream* st, const char* extra = nullptr) const {
523 ShouldNotReachHere();
524 }
525
526 void print_data_on(outputStream* st, const MethodData* md) const;
527
528 void print_shared(outputStream* st, const char* name, const char* extra) const;
529 void tab(outputStream* st, bool first = false) const;
530 };
531
532 // BitData
533 //
534 // A BitData holds a flag or two in its header.
535 class BitData : public ProfileData {
536 friend class VMStructs;
537 protected:
538 enum : u1 {
539 // null_seen:
540 // saw a null operand (cast/aastore/instanceof)
541 null_seen_flag = DataLayout::first_flag + 0,
542 exception_handler_entered_flag = null_seen_flag + 1,
543 deprecated_method_callsite_flag = exception_handler_entered_flag + 1
544 , last_bit_data_flag
545 };
546 enum { bit_cell_count = 0 }; // no additional data fields needed.
547 public:
548 BitData(DataLayout* layout) : ProfileData(layout) {
549 }
550
551 virtual bool is_BitData() const { return true; }
552
553 static int static_cell_count() {
554 return bit_cell_count;
555 }
556
557 virtual int cell_count() const {
558 return static_cell_count();
559 }
560
561 // Accessor
562
563 // The null_seen flag bit is specially known to the interpreter.
564 // Consulting it allows the compiler to avoid setting up null_check traps.
565 bool null_seen() const { return flag_at(null_seen_flag); }
566 void set_null_seen() { set_flag_at(null_seen_flag); }
567 bool deprecated_method_call_site() const { return flag_at(deprecated_method_callsite_flag); }
568 bool set_deprecated_method_call_site() { return data()->set_flag_at(deprecated_method_callsite_flag); }
569 bool clear_deprecated_method_call_site() { return data()->clear_flag_at(deprecated_method_callsite_flag); }
570
571 // true if a ex handler block at this bci was entered
572 bool exception_handler_entered() { return flag_at(exception_handler_entered_flag); }
573 void set_exception_handler_entered() { set_flag_at(exception_handler_entered_flag); }
574
575 // Code generation support
576 static u1 null_seen_byte_constant() {
577 return flag_number_to_constant(null_seen_flag);
578 }
579
580 static ByteSize bit_data_size() {
581 return cell_offset(bit_cell_count);
582 }
583
584 void print_data_on(outputStream* st, const char* extra = nullptr) const;
585 };
638 // A JumpData is used to access profiling information for a direct
639 // branch. It is a counter, used for counting the number of branches,
640 // plus a data displacement, used for realigning the data pointer to
641 // the corresponding target bci.
642 class JumpData : public ProfileData {
643 friend class VMStructs;
644 protected:
645 enum {
646 taken_off_set,
647 displacement_off_set,
648 jump_cell_count
649 };
650
651 void set_displacement(int displacement) {
652 set_int_at(displacement_off_set, displacement);
653 }
654
655 public:
656 JumpData(DataLayout* layout) : ProfileData(layout) {
657 assert(layout->tag() == DataLayout::jump_data_tag ||
658 layout->tag() == DataLayout::branch_data_tag ||
659 layout->tag() == DataLayout::acmp_data_tag, "wrong type");
660 }
661
662 virtual bool is_JumpData() const { return true; }
663
664 static int static_cell_count() {
665 return jump_cell_count;
666 }
667
668 virtual int cell_count() const {
669 return static_cell_count();
670 }
671
672 // Direct accessor
673 uint taken() const {
674 return uint_at(taken_off_set);
675 }
676
677 void set_taken(uint cnt) {
678 set_uint_at(taken_off_set, cnt);
679 }
883
884 static int per_arg_count() {
885 return per_arg_cell_count;
886 }
887
888 ByteSize type_offset(int i) const {
889 return DataLayout::cell_offset(type_offset_in_cells(i));
890 }
891
892 // GC support
893 void clean_weak_klass_links(bool always_clean);
894
895 // CDS support
896 virtual void metaspace_pointers_do(MetaspaceClosure* it);
897
898 void print_data_on(outputStream* st) const;
899 };
900
901 // Type entry used for return from a call. A single cell to record the
902 // type.
903 class SingleTypeEntry : public TypeEntries {
904
905 private:
906 enum {
907 cell_count = 1
908 };
909
910 public:
911 SingleTypeEntry(int base_off)
912 : TypeEntries(base_off) {}
913
914 void post_initialize() {
915 set_type(type_none());
916 }
917
918 intptr_t type() const {
919 return _pd->intptr_at(_base_off);
920 }
921
922 intptr_t* type_adr() const {
923 return _pd->intptr_at_adr(_base_off);
924 }
925
926 void set_type(intptr_t k) {
927 _pd->set_intptr_at(_base_off, k);
928 }
929
930 static int static_cell_count() {
931 return cell_count;
932 }
933
934 static ByteSize size() {
935 return in_ByteSize(cell_count * DataLayout::cell_size);
936 }
937
938 ByteSize type_offset() {
939 return DataLayout::cell_offset(_base_off);
940 }
941
942 // GC support
943 void clean_weak_klass_links(bool always_clean);
944
945 // CDS support
946 virtual void metaspace_pointers_do(MetaspaceClosure* it);
947
948 void print_data_on(outputStream* st) const;
949 };
950
951 // Entries to collect type information at a call: contains arguments
952 // (TypeStackSlotEntries), a return type (SingleTypeEntry) and a
953 // number of cells. Because the number of cells for the return type is
954 // smaller than the number of cells for the type of an arguments, the
955 // number of cells is used to tell how many arguments are profiled and
956 // whether a return value is profiled. See has_arguments() and
957 // has_return().
958 class TypeEntriesAtCall {
959 private:
960 static int stack_slot_local_offset(int i) {
961 return header_cell_count() + TypeStackSlotEntries::stack_slot_local_offset(i);
962 }
963
964 static int argument_type_local_offset(int i) {
965 return header_cell_count() + TypeStackSlotEntries::type_local_offset(i);
966 }
967
968 public:
969
970 static int header_cell_count() {
971 return 1;
972 }
986 static bool return_profiling_enabled();
987
988 // Code generation support
989 static ByteSize cell_count_offset() {
990 return in_ByteSize(cell_count_local_offset() * DataLayout::cell_size);
991 }
992
993 static ByteSize args_data_offset() {
994 return in_ByteSize(header_cell_count() * DataLayout::cell_size);
995 }
996
997 static ByteSize stack_slot_offset(int i) {
998 return in_ByteSize(stack_slot_local_offset(i) * DataLayout::cell_size);
999 }
1000
1001 static ByteSize argument_type_offset(int i) {
1002 return in_ByteSize(argument_type_local_offset(i) * DataLayout::cell_size);
1003 }
1004
1005 static ByteSize return_only_size() {
1006 return SingleTypeEntry::size() + in_ByteSize(header_cell_count() * DataLayout::cell_size);
1007 }
1008
1009 };
1010
1011 // CallTypeData
1012 //
1013 // A CallTypeData is used to access profiling information about a non
1014 // virtual call for which we collect type information about arguments
1015 // and return value.
1016 class CallTypeData : public CounterData {
1017 private:
1018 // entries for arguments if any
1019 TypeStackSlotEntries _args;
1020 // entry for return type if any
1021 SingleTypeEntry _ret;
1022
1023 int cell_count_global_offset() const {
1024 return CounterData::static_cell_count() + TypeEntriesAtCall::cell_count_local_offset();
1025 }
1026
1027 // number of cells not counting the header
1028 int cell_count_no_header() const {
1029 return uint_at(cell_count_global_offset());
1030 }
1031
1032 void check_number_of_arguments(int total) {
1033 assert(number_of_arguments() == total, "should be set in DataLayout::initialize");
1034 }
1035
1036 public:
1037 CallTypeData(DataLayout* layout) :
1038 CounterData(layout),
1039 _args(CounterData::static_cell_count()+TypeEntriesAtCall::header_cell_count(), number_of_arguments()),
1040 _ret(cell_count() - SingleTypeEntry::static_cell_count())
1041 {
1042 assert(layout->tag() == DataLayout::call_type_data_tag, "wrong type");
1043 // Some compilers (VC++) don't want this passed in member initialization list
1044 _args.set_profile_data(this);
1045 _ret.set_profile_data(this);
1046 }
1047
1048 const TypeStackSlotEntries* args() const {
1049 assert(has_arguments(), "no profiling of arguments");
1050 return &_args;
1051 }
1052
1053 const SingleTypeEntry* ret() const {
1054 assert(has_return(), "no profiling of return value");
1055 return &_ret;
1056 }
1057
1058 virtual bool is_CallTypeData() const { return true; }
1059
1060 static int static_cell_count() {
1061 return -1;
1062 }
1063
1064 static int compute_cell_count(BytecodeStream* stream) {
1065 return CounterData::static_cell_count() + TypeEntriesAtCall::compute_cell_count(stream);
1066 }
1067
1068 static void initialize(DataLayout* dl, int cell_count) {
1069 TypeEntriesAtCall::initialize(dl, CounterData::static_cell_count(), cell_count);
1070 }
1071
1072 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo);
1073
1156 // pairs which are used to store a type profile for the receiver of
1157 // the check, the associated count is incremented every time the type
1158 // is seen. A per ReceiverTypeData counter is incremented on type
1159 // overflow (when there's no more room for a not yet profiled Klass*).
1160 //
1161 // Updated by platform-specific code, for example MacroAssembler::profile_receiver_type.
1162 //
1163 class ReceiverTypeData : public CounterData {
1164 friend class VMStructs;
1165 protected:
1166 enum {
1167 receiver0_offset = counter_cell_count,
1168 count0_offset,
1169 receiver_type_row_cell_count = (count0_offset + 1) - receiver0_offset
1170 };
1171
1172 public:
1173 ReceiverTypeData(DataLayout* layout) : CounterData(layout) {
1174 assert(layout->tag() == DataLayout::receiver_type_data_tag ||
1175 layout->tag() == DataLayout::virtual_call_data_tag ||
1176 layout->tag() == DataLayout::virtual_call_type_data_tag ||
1177 layout->tag() == DataLayout::array_store_data_tag, "wrong type");
1178 }
1179
1180 virtual bool is_ReceiverTypeData() const { return true; }
1181
1182 static int static_cell_count() {
1183 return counter_cell_count + (uint) TypeProfileWidth * receiver_type_row_cell_count;
1184 }
1185
1186 virtual int cell_count() const {
1187 return static_cell_count();
1188 }
1189
1190 // Direct accessors
1191 static uint row_limit() {
1192 return (uint) TypeProfileWidth;
1193 }
1194 static int receiver_cell_index(uint row) {
1195 return receiver0_offset + row * receiver_type_row_cell_count;
1196 }
1197 static int receiver_count_cell_index(uint row) {
1289 }
1290
1291 // Direct accessors
1292 static ByteSize virtual_call_data_size() {
1293 return cell_offset(static_cell_count());
1294 }
1295
1296 void print_data_on(outputStream* st, const char* extra = nullptr) const;
1297 };
1298
1299 // VirtualCallTypeData
1300 //
1301 // A VirtualCallTypeData is used to access profiling information about
1302 // a virtual call for which we collect type information about
1303 // arguments and return value.
1304 class VirtualCallTypeData : public VirtualCallData {
1305 private:
1306 // entries for arguments if any
1307 TypeStackSlotEntries _args;
1308 // entry for return type if any
1309 SingleTypeEntry _ret;
1310
1311 int cell_count_global_offset() const {
1312 return VirtualCallData::static_cell_count() + TypeEntriesAtCall::cell_count_local_offset();
1313 }
1314
1315 // number of cells not counting the header
1316 int cell_count_no_header() const {
1317 return uint_at(cell_count_global_offset());
1318 }
1319
1320 void check_number_of_arguments(int total) {
1321 assert(number_of_arguments() == total, "should be set in DataLayout::initialize");
1322 }
1323
1324 public:
1325 VirtualCallTypeData(DataLayout* layout) :
1326 VirtualCallData(layout),
1327 _args(VirtualCallData::static_cell_count()+TypeEntriesAtCall::header_cell_count(), number_of_arguments()),
1328 _ret(cell_count() - SingleTypeEntry::static_cell_count())
1329 {
1330 assert(layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
1331 // Some compilers (VC++) don't want this passed in member initialization list
1332 _args.set_profile_data(this);
1333 _ret.set_profile_data(this);
1334 }
1335
1336 const TypeStackSlotEntries* args() const {
1337 assert(has_arguments(), "no profiling of arguments");
1338 return &_args;
1339 }
1340
1341 const SingleTypeEntry* ret() const {
1342 assert(has_return(), "no profiling of return value");
1343 return &_ret;
1344 }
1345
1346 virtual bool is_VirtualCallTypeData() const { return true; }
1347
1348 static int static_cell_count() {
1349 return -1;
1350 }
1351
1352 static int compute_cell_count(BytecodeStream* stream) {
1353 return VirtualCallData::static_cell_count() + TypeEntriesAtCall::compute_cell_count(stream);
1354 }
1355
1356 static void initialize(DataLayout* dl, int cell_count) {
1357 TypeEntriesAtCall::initialize(dl, VirtualCallData::static_cell_count(), cell_count);
1358 }
1359
1360 virtual void post_initialize(BytecodeStream* stream, MethodData* mdo);
1361
1533
1534 // BranchData
1535 //
1536 // A BranchData is used to access profiling data for a two-way branch.
1537 // It consists of taken and not_taken counts as well as a data displacement
1538 // for the taken case.
1539 class BranchData : public JumpData {
1540 friend class VMStructs;
1541 protected:
1542 enum {
1543 not_taken_off_set = jump_cell_count,
1544 branch_cell_count
1545 };
1546
1547 void set_displacement(int displacement) {
1548 set_int_at(displacement_off_set, displacement);
1549 }
1550
1551 public:
1552 BranchData(DataLayout* layout) : JumpData(layout) {
1553 assert(layout->tag() == DataLayout::branch_data_tag || layout->tag() == DataLayout::acmp_data_tag, "wrong type");
1554 }
1555
1556 virtual bool is_BranchData() const { return true; }
1557
1558 static int static_cell_count() {
1559 return branch_cell_count;
1560 }
1561
1562 virtual int cell_count() const {
1563 return static_cell_count();
1564 }
1565
1566 // Direct accessor
1567 uint not_taken() const {
1568 return uint_at(not_taken_off_set);
1569 }
1570
1571 void set_not_taken(uint cnt) {
1572 set_uint_at(not_taken_off_set, cnt);
1573 }
1892 // Direct accessor
1893 Method* method() const {
1894 return (Method*)intptr_at(speculative_trap_method);
1895 }
1896
1897 void set_method(Method* m) {
1898 assert(!m->is_old(), "cannot add old methods");
1899 set_intptr_at(speculative_trap_method, (intptr_t)m);
1900 }
1901
1902 static ByteSize method_offset() {
1903 return cell_offset(speculative_trap_method);
1904 }
1905
1906 // CDS support
1907 virtual void metaspace_pointers_do(MetaspaceClosure* it);
1908
1909 virtual void print_data_on(outputStream* st, const char* extra = nullptr) const;
1910 };
1911
1912 class ArrayStoreData : public ReceiverTypeData {
1913 private:
1914 enum {
1915 flat_array_flag = BitData::last_bit_data_flag,
1916 null_free_array_flag = flat_array_flag + 1,
1917 };
1918
1919 SingleTypeEntry _array;
1920
1921 public:
1922 ArrayStoreData(DataLayout* layout) :
1923 ReceiverTypeData(layout),
1924 _array(ReceiverTypeData::static_cell_count()) {
1925 assert(layout->tag() == DataLayout::array_store_data_tag, "wrong type");
1926 _array.set_profile_data(this);
1927 }
1928
1929 const SingleTypeEntry* array() const {
1930 return &_array;
1931 }
1932
1933 virtual bool is_ArrayStoreData() const { return true; }
1934
1935 static int static_cell_count() {
1936 return ReceiverTypeData::static_cell_count() + SingleTypeEntry::static_cell_count();
1937 }
1938
1939 virtual int cell_count() const {
1940 return static_cell_count();
1941 }
1942
1943 void set_flat_array() { set_flag_at(flat_array_flag); }
1944 bool flat_array() const { return flag_at(flat_array_flag); }
1945
1946 void set_null_free_array() { set_flag_at(null_free_array_flag); }
1947 bool null_free_array() const { return flag_at(null_free_array_flag); }
1948
1949 // Code generation support
1950 static int flat_array_byte_constant() {
1951 return flag_number_to_constant(flat_array_flag);
1952 }
1953
1954 static int null_free_array_byte_constant() {
1955 return flag_number_to_constant(null_free_array_flag);
1956 }
1957
1958 static ByteSize array_offset() {
1959 return cell_offset(ReceiverTypeData::static_cell_count());
1960 }
1961
1962 virtual void clean_weak_klass_links(bool always_clean) {
1963 ReceiverTypeData::clean_weak_klass_links(always_clean);
1964 _array.clean_weak_klass_links(always_clean);
1965 }
1966
1967 virtual void metaspace_pointers_do(MetaspaceClosure* it) {
1968 ReceiverTypeData::metaspace_pointers_do(it);
1969 _array.metaspace_pointers_do(it);
1970 }
1971
1972 static ByteSize array_store_data_size() {
1973 return cell_offset(static_cell_count());
1974 }
1975
1976 virtual void print_data_on(outputStream* st, const char* extra = nullptr) const;
1977 };
1978
1979 class ArrayLoadData : public BitData {
1980 private:
1981 enum {
1982 flat_array_flag = BitData::last_bit_data_flag,
1983 null_free_array_flag = flat_array_flag + 1,
1984 };
1985
1986 SingleTypeEntry _array;
1987 SingleTypeEntry _element;
1988
1989 public:
1990 ArrayLoadData(DataLayout* layout) :
1991 BitData(layout),
1992 _array(0),
1993 _element(SingleTypeEntry::static_cell_count()) {
1994 assert(layout->tag() == DataLayout::array_load_data_tag, "wrong type");
1995 _array.set_profile_data(this);
1996 _element.set_profile_data(this);
1997 }
1998
1999 const SingleTypeEntry* array() const {
2000 return &_array;
2001 }
2002
2003 const SingleTypeEntry* element() const {
2004 return &_element;
2005 }
2006
2007 virtual bool is_ArrayLoadData() const { return true; }
2008
2009 static int static_cell_count() {
2010 return SingleTypeEntry::static_cell_count() * 2;
2011 }
2012
2013 virtual int cell_count() const {
2014 return static_cell_count();
2015 }
2016
2017 void set_flat_array() { set_flag_at(flat_array_flag); }
2018 bool flat_array() const { return flag_at(flat_array_flag); }
2019
2020 void set_null_free_array() { set_flag_at(null_free_array_flag); }
2021 bool null_free_array() const { return flag_at(null_free_array_flag); }
2022
2023 // Code generation support
2024 static int flat_array_byte_constant() {
2025 return flag_number_to_constant(flat_array_flag);
2026 }
2027
2028 static int null_free_array_byte_constant() {
2029 return flag_number_to_constant(null_free_array_flag);
2030 }
2031
2032 static ByteSize array_offset() {
2033 return cell_offset(0);
2034 }
2035
2036 static ByteSize element_offset() {
2037 return cell_offset(SingleTypeEntry::static_cell_count());
2038 }
2039
2040 virtual void clean_weak_klass_links(bool always_clean) {
2041 _array.clean_weak_klass_links(always_clean);
2042 _element.clean_weak_klass_links(always_clean);
2043 }
2044
2045 virtual void metaspace_pointers_do(MetaspaceClosure* it) {
2046 _array.metaspace_pointers_do(it);
2047 _element.metaspace_pointers_do(it);
2048 }
2049
2050 static ByteSize array_load_data_size() {
2051 return cell_offset(static_cell_count());
2052 }
2053
2054 virtual void print_data_on(outputStream* st, const char* extra = nullptr) const;
2055 };
2056
2057 class ACmpData : public BranchData {
2058 private:
2059 enum {
2060 left_inline_type_flag = DataLayout::first_flag,
2061 right_inline_type_flag
2062 };
2063
2064 SingleTypeEntry _left;
2065 SingleTypeEntry _right;
2066
2067 public:
2068 ACmpData(DataLayout* layout) :
2069 BranchData(layout),
2070 _left(BranchData::static_cell_count()),
2071 _right(BranchData::static_cell_count() + SingleTypeEntry::static_cell_count()) {
2072 assert(layout->tag() == DataLayout::acmp_data_tag, "wrong type");
2073 _left.set_profile_data(this);
2074 _right.set_profile_data(this);
2075 }
2076
2077 const SingleTypeEntry* left() const {
2078 return &_left;
2079 }
2080
2081 const SingleTypeEntry* right() const {
2082 return &_right;
2083 }
2084
2085 virtual bool is_ACmpData() const { return true; }
2086
2087 static int static_cell_count() {
2088 return BranchData::static_cell_count() + SingleTypeEntry::static_cell_count() * 2;
2089 }
2090
2091 virtual int cell_count() const {
2092 return static_cell_count();
2093 }
2094
2095 void set_left_inline_type() { set_flag_at(left_inline_type_flag); }
2096 bool left_inline_type() const { return flag_at(left_inline_type_flag); }
2097
2098 void set_right_inline_type() { set_flag_at(right_inline_type_flag); }
2099 bool right_inline_type() const { return flag_at(right_inline_type_flag); }
2100
2101 // Code generation support
2102 static int left_inline_type_byte_constant() {
2103 return flag_number_to_constant(left_inline_type_flag);
2104 }
2105
2106 static int right_inline_type_byte_constant() {
2107 return flag_number_to_constant(right_inline_type_flag);
2108 }
2109
2110 static ByteSize left_offset() {
2111 return cell_offset(BranchData::static_cell_count());
2112 }
2113
2114 static ByteSize right_offset() {
2115 return cell_offset(BranchData::static_cell_count() + SingleTypeEntry::static_cell_count());
2116 }
2117
2118 virtual void clean_weak_klass_links(bool always_clean) {
2119 _left.clean_weak_klass_links(always_clean);
2120 _right.clean_weak_klass_links(always_clean);
2121 }
2122
2123 virtual void metaspace_pointers_do(MetaspaceClosure* it) {
2124 _left.metaspace_pointers_do(it);
2125 _right.metaspace_pointers_do(it);
2126 }
2127
2128 static ByteSize acmp_data_size() {
2129 return cell_offset(static_cell_count());
2130 }
2131
2132 virtual void print_data_on(outputStream* st, const char* extra = nullptr) const;
2133 };
2134
2135 // MethodData*
2136 //
2137 // A MethodData* holds information which has been collected about
2138 // a method. Its layout looks like this:
2139 //
2140 // -----------------------------
2141 // | header |
2142 // | klass |
2143 // -----------------------------
2144 // | method |
2145 // | size of the MethodData* |
2146 // -----------------------------
2147 // | Data entries... |
2148 // | (variable size) |
2149 // | |
2150 // . .
2151 // . .
2152 // . .
2153 // | |
2154 // -----------------------------
|