< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page

 313       }
 314     } else {
 315       set_receiver(row, nullptr);
 316     }
 317   }
 318 }
 319 
 320 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
 321   for (int i = 0; i < number_of_entries(); i++) {
 322     intptr_t k = entries->type(i);
 323     Klass* klass = (Klass*)klass_part(k);
 324     if (klass != nullptr && !klass->is_loader_alive()) {
 325       // With concurrent class unloading, the MDO could have stale metadata; override it
 326       TypeStackSlotEntries::set_type(i, TypeStackSlotEntries::with_status((Klass*)nullptr, k));
 327     } else {
 328       TypeStackSlotEntries::set_type(i, translate_klass(k));
 329     }
 330   }
 331 }
 332 
 333 void ciReturnTypeEntry::translate_type_data_from(const ReturnTypeEntry* ret) {
 334   intptr_t k = ret->type();
 335   Klass* klass = (Klass*)klass_part(k);
 336   if (klass != nullptr && !klass->is_loader_alive()) {
 337     // With concurrent class unloading, the MDO could have stale metadata; override it
 338     set_type(ReturnTypeEntry::with_status((Klass*)nullptr, k));
 339   } else {
 340     set_type(translate_klass(k));
 341   }
 342 }
 343 
 344 void ciSpeculativeTrapData::translate_from(const ProfileData* data) {
 345   Method* m = data->as_SpeculativeTrapData()->method();
 346   ciMethod* ci_m = CURRENT_ENV->get_method(m);
 347   set_method(ci_m);
 348 }
 349 
 350 // Get the data at an arbitrary (sort of) data index.
 351 ciProfileData* ciMethodData::data_at(int data_index) {
 352   if (out_of_bounds(data_index)) {
 353     return nullptr;
 354   }
 355   DataLayout* data_layout = data_layout_at(data_index);
 356   return data_from(data_layout);
 357 }
 358 

 369   case DataLayout::jump_data_tag:
 370     return new ciJumpData(data_layout);
 371   case DataLayout::receiver_type_data_tag:
 372     return new ciReceiverTypeData(data_layout);
 373   case DataLayout::virtual_call_data_tag:
 374     return new ciVirtualCallData(data_layout);
 375   case DataLayout::ret_data_tag:
 376     return new ciRetData(data_layout);
 377   case DataLayout::branch_data_tag:
 378     return new ciBranchData(data_layout);
 379   case DataLayout::multi_branch_data_tag:
 380     return new ciMultiBranchData(data_layout);
 381   case DataLayout::arg_info_data_tag:
 382     return new ciArgInfoData(data_layout);
 383   case DataLayout::call_type_data_tag:
 384     return new ciCallTypeData(data_layout);
 385   case DataLayout::virtual_call_type_data_tag:
 386     return new ciVirtualCallTypeData(data_layout);
 387   case DataLayout::parameters_type_data_tag:
 388     return new ciParametersTypeData(data_layout);






 389   };
 390 }
 391 
 392 // Iteration over data.
 393 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
 394   int current_index = dp_to_di(current->dp());
 395   int next_index = current_index + current->size_in_bytes();
 396   ciProfileData* next = data_at(next_index);
 397   return next;
 398 }
 399 
 400 DataLayout* ciMethodData::next_data_layout_helper(DataLayout* current, bool extra) {
 401   int current_index = dp_to_di((address)current);
 402   int next_index = current_index + current->size_in_bytes();
 403   if (extra ? out_of_bounds_extra(next_index) : out_of_bounds(next_index)) {
 404     return nullptr;
 405   }
 406   DataLayout* next = data_layout_at(next_index);
 407   return next;
 408 }

 786     // harder. data()'s element type is intptr_t.
 787     out->print(" 0x%zx", data()[i]);
 788   }
 789 
 790   // The MDO contained oop references as ciObjects, so scan for those
 791   // and emit pairs of offset and klass name so that they can be
 792   // reconstructed at runtime.  The first round counts the number of
 793   // oop references and the second actually emits them.
 794   ciParametersTypeData* parameters = parameters_type_data();
 795   for (int count = 0, round = 0; round < 2; round++) {
 796     if (round == 1) out->print(" oops %d", count);
 797     ProfileData* pdata = first_data();
 798     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
 799       if (pdata->is_VirtualCallData()) {
 800         ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
 801         dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
 802         if (pdata->is_VirtualCallTypeData()) {
 803           ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
 804           dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
 805         }




















 806       } else if (pdata->is_ReceiverTypeData()) {
 807         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
 808         dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
 809       } else if (pdata->is_CallTypeData()) {
 810           ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
 811           dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
 812       }
 813     }
 814     if (parameters != nullptr) {
 815       for (int i = 0; i < parameters->number_of_parameters(); i++) {
 816         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
 817       }
 818     }
 819   }
 820   for (int count = 0, round = 0; round < 2; round++) {
 821     if (round == 1) out->print(" methods %d", count);
 822     dump_replay_data_extra_data_helper(out, round, count);
 823   }
 824   out->cr();
 825 }
 826 
 827 #ifndef PRODUCT
 828 void ciMethodData::print() {
 829   print_data_on(tty);
 830 }
 831 

 874     st->print("none");
 875   } else if (TypeEntries::is_type_unknown(k)) {
 876     st->print("unknown");
 877   } else {
 878     valid_ciklass(k)->print_name_on(st);
 879   }
 880   if (TypeEntries::was_null_seen(k)) {
 881     st->print(" (null seen)");
 882   }
 883 }
 884 
 885 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
 886   for (int i = 0; i < number_of_entries(); i++) {
 887     _pd->tab(st);
 888     st->print("%d: stack (%u) ", i, stack_slot(i));
 889     print_ciklass(st, type(i));
 890     st->cr();
 891   }
 892 }
 893 
 894 void ciReturnTypeEntry::print_data_on(outputStream* st) const {
 895   _pd->tab(st);
 896   st->print("ret ");
 897   print_ciklass(st, type());
 898   st->cr();
 899 }
 900 
 901 void ciCallTypeData::print_data_on(outputStream* st, const char* extra) const {
 902   print_shared(st, "ciCallTypeData", extra);
 903   if (has_arguments()) {
 904     tab(st, true);
 905     st->print_cr("argument types");
 906     args()->print_data_on(st);
 907   }
 908   if (has_return()) {
 909     tab(st, true);
 910     st->print_cr("return type");
 911     ret()->print_data_on(st);
 912   }
 913 }
 914 

 947     args()->print_data_on(st);
 948   }
 949   if (has_return()) {
 950     tab(st, true);
 951     st->print("return type");
 952     ret()->print_data_on(st);
 953   }
 954 }
 955 
 956 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
 957   st->print_cr("ciParametersTypeData");
 958   parameters()->print_data_on(st);
 959 }
 960 
 961 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
 962   st->print_cr("ciSpeculativeTrapData");
 963   tab(st);
 964   method()->print_short_name(st);
 965   st->cr();
 966 }































 967 #endif

 313       }
 314     } else {
 315       set_receiver(row, nullptr);
 316     }
 317   }
 318 }
 319 
 320 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
 321   for (int i = 0; i < number_of_entries(); i++) {
 322     intptr_t k = entries->type(i);
 323     Klass* klass = (Klass*)klass_part(k);
 324     if (klass != nullptr && !klass->is_loader_alive()) {
 325       // With concurrent class unloading, the MDO could have stale metadata; override it
 326       TypeStackSlotEntries::set_type(i, TypeStackSlotEntries::with_status((Klass*)nullptr, k));
 327     } else {
 328       TypeStackSlotEntries::set_type(i, translate_klass(k));
 329     }
 330   }
 331 }
 332 
 333 void ciSingleTypeEntry::translate_type_data_from(const SingleTypeEntry* ret) {
 334   intptr_t k = ret->type();
 335   Klass* klass = (Klass*)klass_part(k);
 336   if (klass != nullptr && !klass->is_loader_alive()) {
 337     // With concurrent class unloading, the MDO could have stale metadata; override it
 338     set_type(SingleTypeEntry::with_status((Klass*)nullptr, k));
 339   } else {
 340     set_type(translate_klass(k));
 341   }
 342 }
 343 
 344 void ciSpeculativeTrapData::translate_from(const ProfileData* data) {
 345   Method* m = data->as_SpeculativeTrapData()->method();
 346   ciMethod* ci_m = CURRENT_ENV->get_method(m);
 347   set_method(ci_m);
 348 }
 349 
 350 // Get the data at an arbitrary (sort of) data index.
 351 ciProfileData* ciMethodData::data_at(int data_index) {
 352   if (out_of_bounds(data_index)) {
 353     return nullptr;
 354   }
 355   DataLayout* data_layout = data_layout_at(data_index);
 356   return data_from(data_layout);
 357 }
 358 

 369   case DataLayout::jump_data_tag:
 370     return new ciJumpData(data_layout);
 371   case DataLayout::receiver_type_data_tag:
 372     return new ciReceiverTypeData(data_layout);
 373   case DataLayout::virtual_call_data_tag:
 374     return new ciVirtualCallData(data_layout);
 375   case DataLayout::ret_data_tag:
 376     return new ciRetData(data_layout);
 377   case DataLayout::branch_data_tag:
 378     return new ciBranchData(data_layout);
 379   case DataLayout::multi_branch_data_tag:
 380     return new ciMultiBranchData(data_layout);
 381   case DataLayout::arg_info_data_tag:
 382     return new ciArgInfoData(data_layout);
 383   case DataLayout::call_type_data_tag:
 384     return new ciCallTypeData(data_layout);
 385   case DataLayout::virtual_call_type_data_tag:
 386     return new ciVirtualCallTypeData(data_layout);
 387   case DataLayout::parameters_type_data_tag:
 388     return new ciParametersTypeData(data_layout);
 389   case DataLayout::array_store_data_tag:
 390     return new ciArrayStoreData(data_layout);
 391   case DataLayout::array_load_data_tag:
 392     return new ciArrayLoadData(data_layout);
 393   case DataLayout::acmp_data_tag:
 394     return new ciACmpData(data_layout);
 395   };
 396 }
 397 
 398 // Iteration over data.
 399 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
 400   int current_index = dp_to_di(current->dp());
 401   int next_index = current_index + current->size_in_bytes();
 402   ciProfileData* next = data_at(next_index);
 403   return next;
 404 }
 405 
 406 DataLayout* ciMethodData::next_data_layout_helper(DataLayout* current, bool extra) {
 407   int current_index = dp_to_di((address)current);
 408   int next_index = current_index + current->size_in_bytes();
 409   if (extra ? out_of_bounds_extra(next_index) : out_of_bounds(next_index)) {
 410     return nullptr;
 411   }
 412   DataLayout* next = data_layout_at(next_index);
 413   return next;
 414 }

 792     // harder. data()'s element type is intptr_t.
 793     out->print(" 0x%zx", data()[i]);
 794   }
 795 
 796   // The MDO contained oop references as ciObjects, so scan for those
 797   // and emit pairs of offset and klass name so that they can be
 798   // reconstructed at runtime.  The first round counts the number of
 799   // oop references and the second actually emits them.
 800   ciParametersTypeData* parameters = parameters_type_data();
 801   for (int count = 0, round = 0; round < 2; round++) {
 802     if (round == 1) out->print(" oops %d", count);
 803     ProfileData* pdata = first_data();
 804     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
 805       if (pdata->is_VirtualCallData()) {
 806         ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
 807         dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
 808         if (pdata->is_VirtualCallTypeData()) {
 809           ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
 810           dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
 811         }
 812       } else if (pdata->is_CallTypeData()) {
 813         ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
 814         dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
 815       } else if (pdata->is_ArrayStoreData()) {
 816         ciArrayStoreData* array_store_data = (ciArrayStoreData*)pdata;
 817         dump_replay_data_type_helper(out, round, count, array_store_data, ciArrayStoreData::array_offset(),
 818                                      array_store_data->array()->valid_type());
 819         dump_replay_data_receiver_type_helper<ciArrayStoreData>(out, round, count, array_store_data);
 820       } else if (pdata->is_ArrayLoadData()) {
 821         ciArrayLoadData* array_load_data = (ciArrayLoadData*)pdata;
 822         dump_replay_data_type_helper(out, round, count, array_load_data, ciArrayLoadData::array_offset(),
 823                                      array_load_data->array()->valid_type());
 824         dump_replay_data_type_helper(out, round, count, array_load_data, ciArrayLoadData::element_offset(),
 825                                      array_load_data->element()->valid_type());
 826       } else if (pdata->is_ACmpData()) {
 827         ciACmpData* acmp_data = (ciACmpData*)pdata;
 828         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::left_offset(),
 829                                      acmp_data->left()->valid_type());
 830         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::right_offset(),
 831                                      acmp_data->right()->valid_type());
 832       } else if (pdata->is_ReceiverTypeData()) {
 833         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
 834         dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);



 835       }
 836     }
 837     if (parameters != nullptr) {
 838       for (int i = 0; i < parameters->number_of_parameters(); i++) {
 839         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
 840       }
 841     }
 842   }
 843   for (int count = 0, round = 0; round < 2; round++) {
 844     if (round == 1) out->print(" methods %d", count);
 845     dump_replay_data_extra_data_helper(out, round, count);
 846   }
 847   out->cr();
 848 }
 849 
 850 #ifndef PRODUCT
 851 void ciMethodData::print() {
 852   print_data_on(tty);
 853 }
 854 

 897     st->print("none");
 898   } else if (TypeEntries::is_type_unknown(k)) {
 899     st->print("unknown");
 900   } else {
 901     valid_ciklass(k)->print_name_on(st);
 902   }
 903   if (TypeEntries::was_null_seen(k)) {
 904     st->print(" (null seen)");
 905   }
 906 }
 907 
 908 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
 909   for (int i = 0; i < number_of_entries(); i++) {
 910     _pd->tab(st);
 911     st->print("%d: stack (%u) ", i, stack_slot(i));
 912     print_ciklass(st, type(i));
 913     st->cr();
 914   }
 915 }
 916 
 917 void ciSingleTypeEntry::print_data_on(outputStream* st) const {
 918   _pd->tab(st);
 919   st->print("ret ");
 920   print_ciklass(st, type());
 921   st->cr();
 922 }
 923 
 924 void ciCallTypeData::print_data_on(outputStream* st, const char* extra) const {
 925   print_shared(st, "ciCallTypeData", extra);
 926   if (has_arguments()) {
 927     tab(st, true);
 928     st->print_cr("argument types");
 929     args()->print_data_on(st);
 930   }
 931   if (has_return()) {
 932     tab(st, true);
 933     st->print_cr("return type");
 934     ret()->print_data_on(st);
 935   }
 936 }
 937 

 970     args()->print_data_on(st);
 971   }
 972   if (has_return()) {
 973     tab(st, true);
 974     st->print("return type");
 975     ret()->print_data_on(st);
 976   }
 977 }
 978 
 979 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
 980   st->print_cr("ciParametersTypeData");
 981   parameters()->print_data_on(st);
 982 }
 983 
 984 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
 985   st->print_cr("ciSpeculativeTrapData");
 986   tab(st);
 987   method()->print_short_name(st);
 988   st->cr();
 989 }
 990 
 991 void ciArrayStoreData::print_data_on(outputStream* st, const char* extra) const {
 992   print_shared(st, "ciArrayStoreData", extra);
 993   tab(st, true);
 994   st->print("array");
 995   array()->print_data_on(st);
 996   tab(st, true);
 997   st->print("element");
 998   rtd_super()->print_receiver_data_on(st);
 999 }
1000 
1001 void ciArrayLoadData::print_data_on(outputStream* st, const char* extra) const {
1002   print_shared(st, "ciArrayLoadData", extra);
1003   tab(st, true);
1004   st->print("array");
1005   array()->print_data_on(st);
1006   tab(st, true);
1007   st->print("element");
1008   element()->print_data_on(st);
1009 }
1010 
1011 void ciACmpData::print_data_on(outputStream* st, const char* extra) const {
1012   BranchData::print_data_on(st, extra);
1013   st->cr();
1014   tab(st, true);
1015   st->print("left");
1016   left()->print_data_on(st);
1017   tab(st, true);
1018   st->print("right");
1019   right()->print_data_on(st);
1020 }
1021 #endif
< prev index next >