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_load_store_data_tag:
360 return new ciArrayLoadStoreData(data_layout);
361 case DataLayout::acmp_data_tag:
362 return new ciACmpData(data_layout);
363 };
364 }
365
366 // Iteration over data.
367 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
368 int current_index = dp_to_di(current->dp());
369 int next_index = current_index + current->size_in_bytes();
370 ciProfileData* next = data_at(next_index);
371 return next;
372 }
373
374 DataLayout* ciMethodData::next_data_layout(DataLayout* current) {
375 int current_index = dp_to_di((address)current);
376 int next_index = current_index + current->size_in_bytes();
377 if (out_of_bounds(next_index)) {
378 return nullptr;
379 }
380 DataLayout* next = data_layout_at(next_index);
381 return next;
382 }
738 // reconstructed at runtime. The first round counts the number of
739 // oop references and the second actually emits them.
740 ciParametersTypeData* parameters = parameters_type_data();
741 for (int count = 0, round = 0; round < 2; round++) {
742 if (round == 1) out->print(" oops %d", count);
743 ProfileData* pdata = first_data();
744 for ( ; is_valid(pdata); pdata = next_data(pdata)) {
745 if (pdata->is_VirtualCallData()) {
746 ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
747 dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
748 if (pdata->is_VirtualCallTypeData()) {
749 ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
750 dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
751 }
752 } else if (pdata->is_ReceiverTypeData()) {
753 ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
754 dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
755 } else if (pdata->is_CallTypeData()) {
756 ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
757 dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
758 } else if (pdata->is_ArrayLoadStoreData()) {
759 ciArrayLoadStoreData* array_load_store_data = (ciArrayLoadStoreData*)pdata;
760 dump_replay_data_type_helper(out, round, count, array_load_store_data, ciArrayLoadStoreData::array_offset(),
761 array_load_store_data->array()->valid_type());
762 dump_replay_data_type_helper(out, round, count, array_load_store_data, ciArrayLoadStoreData::element_offset(),
763 array_load_store_data->element()->valid_type());
764 } else if (pdata->is_ACmpData()) {
765 ciACmpData* acmp_data = (ciACmpData*)pdata;
766 dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::left_offset(),
767 acmp_data->left()->valid_type());
768 dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::right_offset(),
769 acmp_data->right()->valid_type());
770
771 }
772 }
773 if (parameters != nullptr) {
774 for (int i = 0; i < parameters->number_of_parameters(); i++) {
775 dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
776 }
777 }
778 }
779 for (int count = 0, round = 0; round < 2; round++) {
780 if (round == 1) out->print(" methods %d", count);
781 dump_replay_data_extra_data_helper(out, round, count);
782 }
783 out->cr();
784 }
785
786 #ifndef PRODUCT
787 void ciMethodData::print() {
788 print_data_on(tty);
789 }
790
833 st->print("none");
834 } else if (TypeEntries::is_type_unknown(k)) {
835 st->print("unknown");
836 } else {
837 valid_ciklass(k)->print_name_on(st);
838 }
839 if (TypeEntries::was_null_seen(k)) {
840 st->print(" (null seen)");
841 }
842 }
843
844 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
845 for (int i = 0; i < number_of_entries(); i++) {
846 _pd->tab(st);
847 st->print("%d: stack (%u) ", i, stack_slot(i));
848 print_ciklass(st, type(i));
849 st->cr();
850 }
851 }
852
853 void ciSingleTypeEntry::print_data_on(outputStream* st) const {
854 _pd->tab(st);
855 st->print("ret ");
856 print_ciklass(st, type());
857 st->cr();
858 }
859
860 void ciCallTypeData::print_data_on(outputStream* st, const char* extra) const {
861 print_shared(st, "ciCallTypeData", extra);
862 if (has_arguments()) {
863 tab(st, true);
864 st->print_cr("argument types");
865 args()->print_data_on(st);
866 }
867 if (has_return()) {
868 tab(st, true);
869 st->print_cr("return type");
870 ret()->print_data_on(st);
871 }
872 }
873
906 args()->print_data_on(st);
907 }
908 if (has_return()) {
909 tab(st, true);
910 st->print("return type");
911 ret()->print_data_on(st);
912 }
913 }
914
915 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
916 st->print_cr("ciParametersTypeData");
917 parameters()->print_data_on(st);
918 }
919
920 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
921 st->print_cr("ciSpeculativeTrapData");
922 tab(st);
923 method()->print_short_name(st);
924 st->cr();
925 }
926
927 void ciArrayLoadStoreData::print_data_on(outputStream* st, const char* extra) const {
928 print_shared(st, "ciArrayLoadStoreData", extra);
929 tab(st, true);
930 st->print("array");
931 array()->print_data_on(st);
932 tab(st, true);
933 st->print("element");
934 element()->print_data_on(st);
935 }
936
937 void ciACmpData::print_data_on(outputStream* st, const char* extra) const {
938 BranchData::print_data_on(st, extra);
939 st->cr();
940 tab(st, true);
941 st->print("left");
942 left()->print_data_on(st);
943 tab(st, true);
944 st->print("right");
945 right()->print_data_on(st);
946 }
947 #endif
|