< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page

283       }
284     } else {
285       set_receiver(row, NULL);
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 != NULL && !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*)NULL, 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 != NULL && !klass->is_loader_alive()) {
307     // With concurrent class unloading, the MDO could have stale metadata; override it
308     set_type(ReturnTypeEntry::with_status((Klass*)NULL, 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 NULL;
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 NULL;
375   }
376   DataLayout* next = data_layout_at(next_index);
377   return next;
378 }

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













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

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

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





















905 #endif

283       }
284     } else {
285       set_receiver(row, NULL);
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 != NULL && !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*)NULL, 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 != NULL && !klass->is_loader_alive()) {
307     // With concurrent class unloading, the MDO could have stale metadata; override it
308     set_type(SingleTypeEntry::with_status((Klass*)NULL, 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 NULL;
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 NULL;
379   }
380   DataLayout* next = data_layout_at(next_index);
381   return next;
382 }

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       } else if (pdata->is_ArrayLoadStoreData()) {
755         ciArrayLoadStoreData* array_load_store_data = (ciArrayLoadStoreData*)pdata;
756         dump_replay_data_type_helper(out, round, count, array_load_store_data, ciArrayLoadStoreData::array_offset(),
757                                      array_load_store_data->array()->valid_type());
758         dump_replay_data_type_helper(out, round, count, array_load_store_data, ciArrayLoadStoreData::element_offset(),
759                                      array_load_store_data->element()->valid_type());
760       } else if (pdata->is_ACmpData()) {
761         ciACmpData* acmp_data = (ciACmpData*)pdata;
762         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::left_offset(),
763                                      acmp_data->left()->valid_type());
764         dump_replay_data_type_helper(out, round, count, acmp_data, ciACmpData::right_offset(),
765                                      acmp_data->right()->valid_type());
766 
767       }
768     }
769     if (parameters != NULL) {
770       for (int i = 0; i < parameters->number_of_parameters(); i++) {
771         dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
772       }
773     }
774   }
775   for (int count = 0, round = 0; round < 2; round++) {
776     if (round == 1) out->print(" methods %d", count);
777     dump_replay_data_extra_data_helper(out, round, count);
778   }
779   out->cr();
780 }
781 
782 #ifndef PRODUCT
783 void ciMethodData::print() {
784   print_data_on(tty);
785 }
786 

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

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