< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page

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

 376   case DataLayout::jump_data_tag:
 377     return new ciJumpData(data_layout);
 378   case DataLayout::receiver_type_data_tag:
 379     return new ciReceiverTypeData(data_layout);
 380   case DataLayout::virtual_call_data_tag:
 381     return new ciVirtualCallData(data_layout);
 382   case DataLayout::ret_data_tag:
 383     return new ciRetData(data_layout);
 384   case DataLayout::branch_data_tag:
 385     return new ciBranchData(data_layout);
 386   case DataLayout::multi_branch_data_tag:
 387     return new ciMultiBranchData(data_layout);
 388   case DataLayout::arg_info_data_tag:
 389     return new ciArgInfoData(data_layout);
 390   case DataLayout::call_type_data_tag:
 391     return new ciCallTypeData(data_layout);
 392   case DataLayout::virtual_call_type_data_tag:
 393     return new ciVirtualCallTypeData(data_layout);
 394   case DataLayout::parameters_type_data_tag:
 395     return new ciParametersTypeData(data_layout);






 396   };
 397 }
 398 
 399 // Iteration over data.
 400 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
 401   int current_index = dp_to_di(current->dp());
 402   int next_index = current_index + current->size_in_bytes();
 403   ciProfileData* next = data_at(next_index);
 404   return next;
 405 }
 406 
 407 DataLayout* ciMethodData::next_data_layout_helper(DataLayout* current, bool extra) {
 408   int current_index = dp_to_di((address)current);
 409   int next_index = current_index + current->size_in_bytes();
 410   if (extra ? out_of_bounds_extra(next_index) : out_of_bounds(next_index)) {
 411     return nullptr;
 412   }
 413   DataLayout* next = data_layout_at(next_index);
 414   return next;
 415 }

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




















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

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

 954     args()->print_data_on(st);
 955   }
 956   if (has_return()) {
 957     tab(st, true);
 958     st->print("return type");
 959     ret()->print_data_on(st);
 960   }
 961 }
 962 
 963 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
 964   st->print_cr("ciParametersTypeData");
 965   parameters()->print_data_on(st);
 966 }
 967 
 968 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
 969   st->print_cr("ciSpeculativeTrapData");
 970   tab(st);
 971   method()->print_short_name(st);
 972   st->cr();
 973 }































 974 #endif

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

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

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



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

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

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