< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page

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

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






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

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




















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

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

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































 968 #endif

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

 370   case DataLayout::jump_data_tag:
 371     return new ciJumpData(data_layout);
 372   case DataLayout::receiver_type_data_tag:
 373     return new ciReceiverTypeData(data_layout);
 374   case DataLayout::virtual_call_data_tag:
 375     return new ciVirtualCallData(data_layout);
 376   case DataLayout::ret_data_tag:
 377     return new ciRetData(data_layout);
 378   case DataLayout::branch_data_tag:
 379     return new ciBranchData(data_layout);
 380   case DataLayout::multi_branch_data_tag:
 381     return new ciMultiBranchData(data_layout);
 382   case DataLayout::arg_info_data_tag:
 383     return new ciArgInfoData(data_layout);
 384   case DataLayout::call_type_data_tag:
 385     return new ciCallTypeData(data_layout);
 386   case DataLayout::virtual_call_type_data_tag:
 387     return new ciVirtualCallTypeData(data_layout);
 388   case DataLayout::parameters_type_data_tag:
 389     return new ciParametersTypeData(data_layout);
 390   case DataLayout::array_store_data_tag:
 391     return new ciArrayStoreData(data_layout);
 392   case DataLayout::array_load_data_tag:
 393     return new ciArrayLoadData(data_layout);
 394   case DataLayout::acmp_data_tag:
 395     return new ciACmpData(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(" " INTX_FORMAT_X, 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_CallTypeData()) {
 814         ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
 815         dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
 816       } else if (pdata->is_ArrayStoreData()) {
 817         ciArrayStoreData* array_store_data = (ciArrayStoreData*)pdata;
 818         dump_replay_data_type_helper(out, round, count, array_store_data, ciArrayStoreData::array_offset(),
 819                                      array_store_data->array()->valid_type());
 820         dump_replay_data_receiver_type_helper<ciArrayStoreData>(out, round, count, array_store_data);
 821       } else if (pdata->is_ArrayLoadData()) {
 822         ciArrayLoadData* array_load_data = (ciArrayLoadData*)pdata;
 823         dump_replay_data_type_helper(out, round, count, array_load_data, ciArrayLoadData::array_offset(),
 824                                      array_load_data->array()->valid_type());
 825         dump_replay_data_type_helper(out, round, count, array_load_data, ciArrayLoadData::element_offset(),
 826                                      array_load_data->element()->valid_type());
 827       } else if (pdata->is_ACmpData()) {
 828         ciACmpData* acmp_data = (ciACmpData*)pdata;
 829         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::left_offset(),
 830                                      acmp_data->left()->valid_type());
 831         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::right_offset(),
 832                                      acmp_data->right()->valid_type());
 833       } else if (pdata->is_ReceiverTypeData()) {
 834         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
 835         dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);



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

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

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