< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page

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

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




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

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













745       }
746     }
747     if (parameters != NULL) {
748       for (int i = 0; i < parameters->number_of_parameters(); i++) {
749         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
750       }
751     }
752   }
753   for (int count = 0, round = 0; round < 2; round++) {
754     if (round == 1) out->print(" methods %d", count);
755     dump_replay_data_extra_data_helper(out, round, count);
756   }
757   out->cr();
758 }
759 
760 #ifndef PRODUCT
761 void ciMethodData::print() {
762   print_data_on(tty);
763 }
764 

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

880     args()->print_data_on(st);
881   }
882   if (has_return()) {
883     tab(st, true);
884     st->print("return type");
885     ret()->print_data_on(st);
886   }
887 }
888 
889 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
890   st->print_cr("ciParametersTypeData");
891   parameters()->print_data_on(st);
892 }
893 
894 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
895   st->print_cr("ciSpeculativeTrapData");
896   tab(st);
897   method()->print_short_name(st);
898   st->cr();
899 }





















900 #endif

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

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

729   // reconstructed at runtime.  The first round counts the number of
730   // oop references and the second actually emits them.
731   ciParametersTypeData* parameters = parameters_type_data();
732   for (int count = 0, round = 0; round < 2; round++) {
733     if (round == 1) out->print(" oops %d", count);
734     ProfileData* pdata = first_data();
735     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
736       if (pdata->is_VirtualCallData()) {
737         ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
738         dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
739         if (pdata->is_VirtualCallTypeData()) {
740           ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
741           dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
742         }
743       } else if (pdata->is_ReceiverTypeData()) {
744         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
745         dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
746       } else if (pdata->is_CallTypeData()) {
747           ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
748           dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
749       } else if (pdata->is_ArrayLoadStoreData()) {
750         ciArrayLoadStoreData* array_load_store_data = (ciArrayLoadStoreData*)pdata;
751         dump_replay_data_type_helper(out, round, count, array_load_store_data, ciArrayLoadStoreData::array_offset(),
752                                      array_load_store_data->array()->valid_type());
753         dump_replay_data_type_helper(out, round, count, array_load_store_data, ciArrayLoadStoreData::element_offset(),
754                                      array_load_store_data->element()->valid_type());
755       } else if (pdata->is_ACmpData()) {
756         ciACmpData* acmp_data = (ciACmpData*)pdata;
757         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::left_offset(),
758                                      acmp_data->left()->valid_type());
759         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::right_offset(),
760                                      acmp_data->right()->valid_type());
761 
762       }
763     }
764     if (parameters != NULL) {
765       for (int i = 0; i < parameters->number_of_parameters(); i++) {
766         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
767       }
768     }
769   }
770   for (int count = 0, round = 0; round < 2; round++) {
771     if (round == 1) out->print(" methods %d", count);
772     dump_replay_data_extra_data_helper(out, round, count);
773   }
774   out->cr();
775 }
776 
777 #ifndef PRODUCT
778 void ciMethodData::print() {
779   print_data_on(tty);
780 }
781 

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

897     args()->print_data_on(st);
898   }
899   if (has_return()) {
900     tab(st, true);
901     st->print("return type");
902     ret()->print_data_on(st);
903   }
904 }
905 
906 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
907   st->print_cr("ciParametersTypeData");
908   parameters()->print_data_on(st);
909 }
910 
911 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
912   st->print_cr("ciSpeculativeTrapData");
913   tab(st);
914   method()->print_short_name(st);
915   st->cr();
916 }
917 
918 void ciArrayLoadStoreData::print_data_on(outputStream* st, const char* extra) const {
919   print_shared(st, "ciArrayLoadStoreData", extra);
920   tab(st, true);
921   st->print("array");
922   array()->print_data_on(st);
923   tab(st, true);
924   st->print("element");
925   element()->print_data_on(st);
926 }
927 
928 void ciACmpData::print_data_on(outputStream* st, const char* extra) const {
929   BranchData::print_data_on(st, extra);
930   st->cr();
931   tab(st, true);
932   st->print("left");
933   left()->print_data_on(st);
934   tab(st, true);
935   st->print("right");
936   right()->print_data_on(st);
937 }
938 #endif
< prev index next >