< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page

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

 356   case DataLayout::jump_data_tag:
 357     return new ciJumpData(data_layout);
 358   case DataLayout::receiver_type_data_tag:
 359     return new ciReceiverTypeData(data_layout);
 360   case DataLayout::virtual_call_data_tag:
 361     return new ciVirtualCallData(data_layout);
 362   case DataLayout::ret_data_tag:
 363     return new ciRetData(data_layout);
 364   case DataLayout::branch_data_tag:
 365     return new ciBranchData(data_layout);
 366   case DataLayout::multi_branch_data_tag:
 367     return new ciMultiBranchData(data_layout);
 368   case DataLayout::arg_info_data_tag:
 369     return new ciArgInfoData(data_layout);
 370   case DataLayout::call_type_data_tag:
 371     return new ciCallTypeData(data_layout);
 372   case DataLayout::virtual_call_type_data_tag:
 373     return new ciVirtualCallTypeData(data_layout);
 374   case DataLayout::parameters_type_data_tag:
 375     return new ciParametersTypeData(data_layout);






 376   };
 377 }
 378 
 379 // Iteration over data.
 380 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
 381   int current_index = dp_to_di(current->dp());
 382   int next_index = current_index + current->size_in_bytes();
 383   ciProfileData* next = data_at(next_index);
 384   return next;
 385 }
 386 
 387 DataLayout* ciMethodData::next_data_layout_helper(DataLayout* current, bool extra) {
 388   int current_index = dp_to_di((address)current);
 389   int next_index = current_index + current->size_in_bytes();
 390   if (extra ? out_of_bounds_extra(next_index) : out_of_bounds(next_index)) {
 391     return nullptr;
 392   }
 393   DataLayout* next = data_layout_at(next_index);
 394   return next;
 395 }

 773   // reconstructed at runtime.  The first round counts the number of
 774   // oop references and the second actually emits them.
 775   ciParametersTypeData* parameters = parameters_type_data();
 776   for (int count = 0, round = 0; round < 2; round++) {
 777     if (round == 1) out->print(" oops %d", count);
 778     ProfileData* pdata = first_data();
 779     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
 780       if (pdata->is_VirtualCallData()) {
 781         ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
 782         dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
 783         if (pdata->is_VirtualCallTypeData()) {
 784           ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
 785           dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
 786         }
 787       } else if (pdata->is_ReceiverTypeData()) {
 788         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
 789         dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
 790       } else if (pdata->is_CallTypeData()) {
 791           ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
 792           dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);


















 793       }
 794     }
 795     if (parameters != nullptr) {
 796       for (int i = 0; i < parameters->number_of_parameters(); i++) {
 797         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
 798       }
 799     }
 800   }
 801   for (int count = 0, round = 0; round < 2; round++) {
 802     if (round == 1) out->print(" methods %d", count);
 803     dump_replay_data_extra_data_helper(out, round, count);
 804   }
 805   out->cr();
 806 }
 807 
 808 #ifndef PRODUCT
 809 void ciMethodData::print() {
 810   print_data_on(tty);
 811 }
 812 

 855     st->print("none");
 856   } else if (TypeEntries::is_type_unknown(k)) {
 857     st->print("unknown");
 858   } else {
 859     valid_ciklass(k)->print_name_on(st);
 860   }
 861   if (TypeEntries::was_null_seen(k)) {
 862     st->print(" (null seen)");
 863   }
 864 }
 865 
 866 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
 867   for (int i = 0; i < number_of_entries(); i++) {
 868     _pd->tab(st);
 869     st->print("%d: stack (%u) ", i, stack_slot(i));
 870     print_ciklass(st, type(i));
 871     st->cr();
 872   }
 873 }
 874 
 875 void ciReturnTypeEntry::print_data_on(outputStream* st) const {
 876   _pd->tab(st);
 877   st->print("ret ");
 878   print_ciklass(st, type());
 879   st->cr();
 880 }
 881 
 882 void ciCallTypeData::print_data_on(outputStream* st, const char* extra) const {
 883   print_shared(st, "ciCallTypeData", extra);
 884   if (has_arguments()) {
 885     tab(st, true);
 886     st->print_cr("argument types");
 887     args()->print_data_on(st);
 888   }
 889   if (has_return()) {
 890     tab(st, true);
 891     st->print_cr("return type");
 892     ret()->print_data_on(st);
 893   }
 894 }
 895 

 928     args()->print_data_on(st);
 929   }
 930   if (has_return()) {
 931     tab(st, true);
 932     st->print("return type");
 933     ret()->print_data_on(st);
 934   }
 935 }
 936 
 937 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
 938   st->print_cr("ciParametersTypeData");
 939   parameters()->print_data_on(st);
 940 }
 941 
 942 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
 943   st->print_cr("ciSpeculativeTrapData");
 944   tab(st);
 945   method()->print_short_name(st);
 946   st->cr();
 947 }































 948 #endif

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

 356   case DataLayout::jump_data_tag:
 357     return new ciJumpData(data_layout);
 358   case DataLayout::receiver_type_data_tag:
 359     return new ciReceiverTypeData(data_layout);
 360   case DataLayout::virtual_call_data_tag:
 361     return new ciVirtualCallData(data_layout);
 362   case DataLayout::ret_data_tag:
 363     return new ciRetData(data_layout);
 364   case DataLayout::branch_data_tag:
 365     return new ciBranchData(data_layout);
 366   case DataLayout::multi_branch_data_tag:
 367     return new ciMultiBranchData(data_layout);
 368   case DataLayout::arg_info_data_tag:
 369     return new ciArgInfoData(data_layout);
 370   case DataLayout::call_type_data_tag:
 371     return new ciCallTypeData(data_layout);
 372   case DataLayout::virtual_call_type_data_tag:
 373     return new ciVirtualCallTypeData(data_layout);
 374   case DataLayout::parameters_type_data_tag:
 375     return new ciParametersTypeData(data_layout);
 376   case DataLayout::array_store_data_tag:
 377     return new ciArrayStoreData(data_layout);
 378   case DataLayout::array_load_data_tag:
 379     return new ciArrayLoadData(data_layout);
 380   case DataLayout::acmp_data_tag:
 381     return new ciACmpData(data_layout);
 382   };
 383 }
 384 
 385 // Iteration over data.
 386 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
 387   int current_index = dp_to_di(current->dp());
 388   int next_index = current_index + current->size_in_bytes();
 389   ciProfileData* next = data_at(next_index);
 390   return next;
 391 }
 392 
 393 DataLayout* ciMethodData::next_data_layout_helper(DataLayout* current, bool extra) {
 394   int current_index = dp_to_di((address)current);
 395   int next_index = current_index + current->size_in_bytes();
 396   if (extra ? out_of_bounds_extra(next_index) : out_of_bounds(next_index)) {
 397     return nullptr;
 398   }
 399   DataLayout* next = data_layout_at(next_index);
 400   return next;
 401 }

 779   // reconstructed at runtime.  The first round counts the number of
 780   // oop references and the second actually emits them.
 781   ciParametersTypeData* parameters = parameters_type_data();
 782   for (int count = 0, round = 0; round < 2; round++) {
 783     if (round == 1) out->print(" oops %d", count);
 784     ProfileData* pdata = first_data();
 785     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
 786       if (pdata->is_VirtualCallData()) {
 787         ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
 788         dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
 789         if (pdata->is_VirtualCallTypeData()) {
 790           ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
 791           dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
 792         }
 793       } else if (pdata->is_ReceiverTypeData()) {
 794         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
 795         dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
 796       } else if (pdata->is_CallTypeData()) {
 797           ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
 798           dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
 799       } else if (pdata->is_ArrayStoreData()) {
 800         ciArrayStoreData* array_store_data = (ciArrayStoreData*)pdata;
 801         dump_replay_data_type_helper(out, round, count, array_store_data, ciArrayStoreData::array_offset(),
 802                                      array_store_data->array()->valid_type());
 803         dump_replay_data_receiver_type_helper<ciArrayStoreData>(out, round, count, array_store_data);
 804       } else if (pdata->is_ArrayLoadData()) {
 805         ciArrayLoadData* array_load_data = (ciArrayLoadData*)pdata;
 806         dump_replay_data_type_helper(out, round, count, array_load_data, ciArrayLoadData::array_offset(),
 807                                      array_load_data->array()->valid_type());
 808         dump_replay_data_type_helper(out, round, count, array_load_data, ciArrayLoadData::element_offset(),
 809                                      array_load_data->element()->valid_type());
 810       } else if (pdata->is_ACmpData()) {
 811         ciACmpData* acmp_data = (ciACmpData*)pdata;
 812         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::left_offset(),
 813                                      acmp_data->left()->valid_type());
 814         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::right_offset(),
 815                                      acmp_data->right()->valid_type());
 816 
 817       }
 818     }
 819     if (parameters != nullptr) {
 820       for (int i = 0; i < parameters->number_of_parameters(); i++) {
 821         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
 822       }
 823     }
 824   }
 825   for (int count = 0, round = 0; round < 2; round++) {
 826     if (round == 1) out->print(" methods %d", count);
 827     dump_replay_data_extra_data_helper(out, round, count);
 828   }
 829   out->cr();
 830 }
 831 
 832 #ifndef PRODUCT
 833 void ciMethodData::print() {
 834   print_data_on(tty);
 835 }
 836 

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

 952     args()->print_data_on(st);
 953   }
 954   if (has_return()) {
 955     tab(st, true);
 956     st->print("return type");
 957     ret()->print_data_on(st);
 958   }
 959 }
 960 
 961 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
 962   st->print_cr("ciParametersTypeData");
 963   parameters()->print_data_on(st);
 964 }
 965 
 966 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
 967   st->print_cr("ciSpeculativeTrapData");
 968   tab(st);
 969   method()->print_short_name(st);
 970   st->cr();
 971 }
 972 
 973 void ciArrayStoreData::print_data_on(outputStream* st, const char* extra) const {
 974   print_shared(st, "ciArrayLoadStoreData", extra);
 975   tab(st, true);
 976   st->print("array");
 977   array()->print_data_on(st);
 978   tab(st, true);
 979   st->print("element");
 980   print_receiver_data_on(st);
 981 }
 982 
 983 void ciArrayLoadData::print_data_on(outputStream* st, const char* extra) const {
 984   print_shared(st, "ciArrayLoadStoreData", extra);
 985   tab(st, true);
 986   st->print("array");
 987   array()->print_data_on(st);
 988   tab(st, true);
 989   st->print("element");
 990   element()->print_data_on(st);
 991 }
 992 
 993 void ciACmpData::print_data_on(outputStream* st, const char* extra) const {
 994   BranchData::print_data_on(st, extra);
 995   st->cr();
 996   tab(st, true);
 997   st->print("left");
 998   left()->print_data_on(st);
 999   tab(st, true);
1000   st->print("right");
1001   right()->print_data_on(st);
1002 }
1003 #endif
< prev index next >