< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page

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

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




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

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













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

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

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





















906 #endif

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

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

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

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

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