< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page

283       }
284     } else {
285       set_receiver(row, nullptr);
286     }
287   }
288 }
289 
290 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
291   for (int i = 0; i < number_of_entries(); i++) {
292     intptr_t k = entries->type(i);
293     Klass* klass = (Klass*)klass_part(k);
294     if (klass != nullptr && !klass->is_loader_alive()) {
295       // With concurrent class unloading, the MDO could have stale metadata; override it
296       TypeStackSlotEntries::set_type(i, TypeStackSlotEntries::with_status((Klass*)nullptr, k));
297     } else {
298       TypeStackSlotEntries::set_type(i, translate_klass(k));
299     }
300   }
301 }
302 
303 void ciReturnTypeEntry::translate_type_data_from(const ReturnTypeEntry* ret) {
304   intptr_t k = ret->type();
305   Klass* klass = (Klass*)klass_part(k);
306   if (klass != nullptr && !klass->is_loader_alive()) {
307     // With concurrent class unloading, the MDO could have stale metadata; override it
308     set_type(ReturnTypeEntry::with_status((Klass*)nullptr, k));
309   } else {
310     set_type(translate_klass(k));
311   }
312 }
313 
314 void ciSpeculativeTrapData::translate_from(const ProfileData* data) {
315   Method* m = data->as_SpeculativeTrapData()->method();
316   ciMethod* ci_m = CURRENT_ENV->get_method(m);
317   set_method(ci_m);
318 }
319 
320 // Get the data at an arbitrary (sort of) data index.
321 ciProfileData* ciMethodData::data_at(int data_index) {
322   if (out_of_bounds(data_index)) {
323     return nullptr;
324   }
325   DataLayout* data_layout = data_layout_at(data_index);
326   return data_from(data_layout);
327 }
328 

339   case DataLayout::jump_data_tag:
340     return new ciJumpData(data_layout);
341   case DataLayout::receiver_type_data_tag:
342     return new ciReceiverTypeData(data_layout);
343   case DataLayout::virtual_call_data_tag:
344     return new ciVirtualCallData(data_layout);
345   case DataLayout::ret_data_tag:
346     return new ciRetData(data_layout);
347   case DataLayout::branch_data_tag:
348     return new ciBranchData(data_layout);
349   case DataLayout::multi_branch_data_tag:
350     return new ciMultiBranchData(data_layout);
351   case DataLayout::arg_info_data_tag:
352     return new ciArgInfoData(data_layout);
353   case DataLayout::call_type_data_tag:
354     return new ciCallTypeData(data_layout);
355   case DataLayout::virtual_call_type_data_tag:
356     return new ciVirtualCallTypeData(data_layout);
357   case DataLayout::parameters_type_data_tag:
358     return new ciParametersTypeData(data_layout);






359   };
360 }
361 
362 // Iteration over data.
363 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
364   int current_index = dp_to_di(current->dp());
365   int next_index = current_index + current->size_in_bytes();
366   ciProfileData* next = data_at(next_index);
367   return next;
368 }
369 
370 DataLayout* ciMethodData::next_data_layout(DataLayout* current) {
371   int current_index = dp_to_di((address)current);
372   int next_index = current_index + current->size_in_bytes();
373   if (out_of_bounds(next_index)) {
374     return nullptr;
375   }
376   DataLayout* next = data_layout_at(next_index);
377   return next;
378 }

734   // reconstructed at runtime.  The first round counts the number of
735   // oop references and the second actually emits them.
736   ciParametersTypeData* parameters = parameters_type_data();
737   for (int count = 0, round = 0; round < 2; round++) {
738     if (round == 1) out->print(" oops %d", count);
739     ProfileData* pdata = first_data();
740     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
741       if (pdata->is_VirtualCallData()) {
742         ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
743         dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
744         if (pdata->is_VirtualCallTypeData()) {
745           ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
746           dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
747         }
748       } else if (pdata->is_ReceiverTypeData()) {
749         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
750         dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
751       } else if (pdata->is_CallTypeData()) {
752           ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
753           dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);


















754       }
755     }
756     if (parameters != nullptr) {
757       for (int i = 0; i < parameters->number_of_parameters(); i++) {
758         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
759       }
760     }
761   }
762   for (int count = 0, round = 0; round < 2; round++) {
763     if (round == 1) out->print(" methods %d", count);
764     dump_replay_data_extra_data_helper(out, round, count);
765   }
766   out->cr();
767 }
768 
769 #ifndef PRODUCT
770 void ciMethodData::print() {
771   print_data_on(tty);
772 }
773 

816     st->print("none");
817   } else if (TypeEntries::is_type_unknown(k)) {
818     st->print("unknown");
819   } else {
820     valid_ciklass(k)->print_name_on(st);
821   }
822   if (TypeEntries::was_null_seen(k)) {
823     st->print(" (null seen)");
824   }
825 }
826 
827 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
828   for (int i = 0; i < number_of_entries(); i++) {
829     _pd->tab(st);
830     st->print("%d: stack (%u) ", i, stack_slot(i));
831     print_ciklass(st, type(i));
832     st->cr();
833   }
834 }
835 
836 void ciReturnTypeEntry::print_data_on(outputStream* st) const {
837   _pd->tab(st);
838   st->print("ret ");
839   print_ciklass(st, type());
840   st->cr();
841 }
842 
843 void ciCallTypeData::print_data_on(outputStream* st, const char* extra) const {
844   print_shared(st, "ciCallTypeData", extra);
845   if (has_arguments()) {
846     tab(st, true);
847     st->print_cr("argument types");
848     args()->print_data_on(st);
849   }
850   if (has_return()) {
851     tab(st, true);
852     st->print_cr("return type");
853     ret()->print_data_on(st);
854   }
855 }
856 

889     args()->print_data_on(st);
890   }
891   if (has_return()) {
892     tab(st, true);
893     st->print("return type");
894     ret()->print_data_on(st);
895   }
896 }
897 
898 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
899   st->print_cr("ciParametersTypeData");
900   parameters()->print_data_on(st);
901 }
902 
903 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
904   st->print_cr("ciSpeculativeTrapData");
905   tab(st);
906   method()->print_short_name(st);
907   st->cr();
908 }































909 #endif

283       }
284     } else {
285       set_receiver(row, nullptr);
286     }
287   }
288 }
289 
290 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
291   for (int i = 0; i < number_of_entries(); i++) {
292     intptr_t k = entries->type(i);
293     Klass* klass = (Klass*)klass_part(k);
294     if (klass != nullptr && !klass->is_loader_alive()) {
295       // With concurrent class unloading, the MDO could have stale metadata; override it
296       TypeStackSlotEntries::set_type(i, TypeStackSlotEntries::with_status((Klass*)nullptr, k));
297     } else {
298       TypeStackSlotEntries::set_type(i, translate_klass(k));
299     }
300   }
301 }
302 
303 void ciSingleTypeEntry::translate_type_data_from(const SingleTypeEntry* ret) {
304   intptr_t k = ret->type();
305   Klass* klass = (Klass*)klass_part(k);
306   if (klass != nullptr && !klass->is_loader_alive()) {
307     // With concurrent class unloading, the MDO could have stale metadata; override it
308     set_type(SingleTypeEntry::with_status((Klass*)nullptr, k));
309   } else {
310     set_type(translate_klass(k));
311   }
312 }
313 
314 void ciSpeculativeTrapData::translate_from(const ProfileData* data) {
315   Method* m = data->as_SpeculativeTrapData()->method();
316   ciMethod* ci_m = CURRENT_ENV->get_method(m);
317   set_method(ci_m);
318 }
319 
320 // Get the data at an arbitrary (sort of) data index.
321 ciProfileData* ciMethodData::data_at(int data_index) {
322   if (out_of_bounds(data_index)) {
323     return nullptr;
324   }
325   DataLayout* data_layout = data_layout_at(data_index);
326   return data_from(data_layout);
327 }
328 

339   case DataLayout::jump_data_tag:
340     return new ciJumpData(data_layout);
341   case DataLayout::receiver_type_data_tag:
342     return new ciReceiverTypeData(data_layout);
343   case DataLayout::virtual_call_data_tag:
344     return new ciVirtualCallData(data_layout);
345   case DataLayout::ret_data_tag:
346     return new ciRetData(data_layout);
347   case DataLayout::branch_data_tag:
348     return new ciBranchData(data_layout);
349   case DataLayout::multi_branch_data_tag:
350     return new ciMultiBranchData(data_layout);
351   case DataLayout::arg_info_data_tag:
352     return new ciArgInfoData(data_layout);
353   case DataLayout::call_type_data_tag:
354     return new ciCallTypeData(data_layout);
355   case DataLayout::virtual_call_type_data_tag:
356     return new ciVirtualCallTypeData(data_layout);
357   case DataLayout::parameters_type_data_tag:
358     return new ciParametersTypeData(data_layout);
359   case DataLayout::array_store_data_tag:
360     return new ciArrayStoreData(data_layout);
361   case DataLayout::array_load_data_tag:
362     return new ciArrayLoadData(data_layout);
363   case DataLayout::acmp_data_tag:
364     return new ciACmpData(data_layout);
365   };
366 }
367 
368 // Iteration over data.
369 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
370   int current_index = dp_to_di(current->dp());
371   int next_index = current_index + current->size_in_bytes();
372   ciProfileData* next = data_at(next_index);
373   return next;
374 }
375 
376 DataLayout* ciMethodData::next_data_layout(DataLayout* current) {
377   int current_index = dp_to_di((address)current);
378   int next_index = current_index + current->size_in_bytes();
379   if (out_of_bounds(next_index)) {
380     return nullptr;
381   }
382   DataLayout* next = data_layout_at(next_index);
383   return next;
384 }

740   // reconstructed at runtime.  The first round counts the number of
741   // oop references and the second actually emits them.
742   ciParametersTypeData* parameters = parameters_type_data();
743   for (int count = 0, round = 0; round < 2; round++) {
744     if (round == 1) out->print(" oops %d", count);
745     ProfileData* pdata = first_data();
746     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
747       if (pdata->is_VirtualCallData()) {
748         ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
749         dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
750         if (pdata->is_VirtualCallTypeData()) {
751           ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
752           dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
753         }
754       } else if (pdata->is_ReceiverTypeData()) {
755         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
756         dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
757       } else if (pdata->is_CallTypeData()) {
758           ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
759           dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
760       } else if (pdata->is_ArrayStoreData()) {
761         ciArrayStoreData* array_store_data = (ciArrayStoreData*)pdata;
762         dump_replay_data_type_helper(out, round, count, array_store_data, ciArrayStoreData::array_offset(),
763                                      array_store_data->array()->valid_type());
764         dump_replay_data_receiver_type_helper<ciArrayStoreData>(out, round, count, array_store_data);
765       } else if (pdata->is_ArrayLoadData()) {
766         ciArrayLoadData* array_load_data = (ciArrayLoadData*)pdata;
767         dump_replay_data_type_helper(out, round, count, array_load_data, ciArrayLoadData::array_offset(),
768                                      array_load_data->array()->valid_type());
769         dump_replay_data_type_helper(out, round, count, array_load_data, ciArrayLoadData::element_offset(),
770                                      array_load_data->element()->valid_type());
771       } else if (pdata->is_ACmpData()) {
772         ciACmpData* acmp_data = (ciACmpData*)pdata;
773         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::left_offset(),
774                                      acmp_data->left()->valid_type());
775         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::right_offset(),
776                                      acmp_data->right()->valid_type());
777 
778       }
779     }
780     if (parameters != nullptr) {
781       for (int i = 0; i < parameters->number_of_parameters(); i++) {
782         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
783       }
784     }
785   }
786   for (int count = 0, round = 0; round < 2; round++) {
787     if (round == 1) out->print(" methods %d", count);
788     dump_replay_data_extra_data_helper(out, round, count);
789   }
790   out->cr();
791 }
792 
793 #ifndef PRODUCT
794 void ciMethodData::print() {
795   print_data_on(tty);
796 }
797 

840     st->print("none");
841   } else if (TypeEntries::is_type_unknown(k)) {
842     st->print("unknown");
843   } else {
844     valid_ciklass(k)->print_name_on(st);
845   }
846   if (TypeEntries::was_null_seen(k)) {
847     st->print(" (null seen)");
848   }
849 }
850 
851 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
852   for (int i = 0; i < number_of_entries(); i++) {
853     _pd->tab(st);
854     st->print("%d: stack (%u) ", i, stack_slot(i));
855     print_ciklass(st, type(i));
856     st->cr();
857   }
858 }
859 
860 void ciSingleTypeEntry::print_data_on(outputStream* st) const {
861   _pd->tab(st);
862   st->print("ret ");
863   print_ciklass(st, type());
864   st->cr();
865 }
866 
867 void ciCallTypeData::print_data_on(outputStream* st, const char* extra) const {
868   print_shared(st, "ciCallTypeData", extra);
869   if (has_arguments()) {
870     tab(st, true);
871     st->print_cr("argument types");
872     args()->print_data_on(st);
873   }
874   if (has_return()) {
875     tab(st, true);
876     st->print_cr("return type");
877     ret()->print_data_on(st);
878   }
879 }
880 

913     args()->print_data_on(st);
914   }
915   if (has_return()) {
916     tab(st, true);
917     st->print("return type");
918     ret()->print_data_on(st);
919   }
920 }
921 
922 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
923   st->print_cr("ciParametersTypeData");
924   parameters()->print_data_on(st);
925 }
926 
927 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
928   st->print_cr("ciSpeculativeTrapData");
929   tab(st);
930   method()->print_short_name(st);
931   st->cr();
932 }
933 
934 void ciArrayStoreData::print_data_on(outputStream* st, const char* extra) const {
935   print_shared(st, "ciArrayLoadStoreData", extra);
936   tab(st, true);
937   st->print("array");
938   array()->print_data_on(st);
939   tab(st, true);
940   st->print("element");
941   print_receiver_data_on(st);
942 }
943 
944 void ciArrayLoadData::print_data_on(outputStream* st, const char* extra) const {
945   print_shared(st, "ciArrayLoadStoreData", extra);
946   tab(st, true);
947   st->print("array");
948   array()->print_data_on(st);
949   tab(st, true);
950   st->print("element");
951   element()->print_data_on(st);
952 }
953 
954 void ciACmpData::print_data_on(outputStream* st, const char* extra) const {
955   BranchData::print_data_on(st, extra);
956   st->cr();
957   tab(st, true);
958   st->print("left");
959   left()->print_data_on(st);
960   tab(st, true);
961   st->print("right");
962   right()->print_data_on(st);
963 }
964 #endif
< prev index next >