src/share/vm/ci/ciMethodData.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/ci

src/share/vm/ci/ciMethodData.cpp

Print this page
rev 5400 : 8023657: New type profiling points: arguments to call
Summary: x86 interpreter and c1 type profiling for arguments at calls
Reviewed-by: kvn, twisti
rev 5401 : 8026054: New type profiling points: type of return values at calls
Summary: x86 interpreter and c1 type profiling for return values at calls
Reviewed-by:
rev 5402 : imported patch kvn
rev 5403 : [mq]: twisti


 120   _arg_returned  = mdo->arg_returned();
 121 #ifndef PRODUCT
 122   if (ReplayCompiles) {
 123     ciReplay::initialize(this);
 124   }
 125 #endif
 126 }
 127 
 128 void ciReceiverTypeData::translate_receiver_data_from(const ProfileData* data) {
 129   for (uint row = 0; row < row_limit(); row++) {
 130     Klass* k = data->as_ReceiverTypeData()->receiver(row);
 131     if (k != NULL) {
 132       ciKlass* klass = CURRENT_ENV->get_klass(k);
 133       set_receiver(row, klass);
 134     }
 135   }
 136 }
 137 
 138 
 139 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
 140   for (int i = 0; i < number_of_arguments(); i++) {
 141     intptr_t k = entries->type(i);
 142     TypeStackSlotEntries::set_type(i, translate_klass(k));
 143   }
 144 }
 145 





 146 // Get the data at an arbitrary (sort of) data index.
 147 ciProfileData* ciMethodData::data_at(int data_index) {
 148   if (out_of_bounds(data_index)) {
 149     return NULL;
 150   }
 151   DataLayout* data_layout = data_layout_at(data_index);
 152 
 153   switch (data_layout->tag()) {
 154   case DataLayout::no_tag:
 155   default:
 156     ShouldNotReachHere();
 157     return NULL;
 158   case DataLayout::bit_data_tag:
 159     return new ciBitData(data_layout);
 160   case DataLayout::counter_data_tag:
 161     return new ciCounterData(data_layout);
 162   case DataLayout::jump_data_tag:
 163     return new ciJumpData(data_layout);
 164   case DataLayout::receiver_type_data_tag:
 165     return new ciReceiverTypeData(data_layout);


 296   MethodData* mdo = get_MethodData();
 297   if (mdo != NULL) {
 298     mdo->set_would_profile(p);
 299   }
 300 }
 301 
 302 void ciMethodData::set_argument_type(int bci, int i, ciKlass* k) {
 303   VM_ENTRY_MARK;
 304   MethodData* mdo = get_MethodData();
 305   if (mdo != NULL) {
 306     ProfileData* data = mdo->bci_to_data(bci);
 307     if (data->is_CallTypeData()) {
 308       data->as_CallTypeData()->set_argument_type(i, k->get_Klass());
 309     } else {
 310       assert(data->is_VirtualCallTypeData(), "no arguments!");
 311       data->as_VirtualCallTypeData()->set_argument_type(i, k->get_Klass());
 312     }
 313   }
 314 }
 315 














 316 bool ciMethodData::has_escape_info() {
 317   return eflag_set(MethodData::estimated);
 318 }
 319 
 320 void ciMethodData::set_eflag(MethodData::EscapeFlag f) {
 321   set_bits(_eflags, f);
 322 }
 323 
 324 void ciMethodData::clear_eflag(MethodData::EscapeFlag f) {
 325   clear_bits(_eflags, f);
 326 }
 327 
 328 bool ciMethodData::eflag_set(MethodData::EscapeFlag f) const {
 329   return mask_bits(_eflags, f) != 0;
 330 }
 331 
 332 void ciMethodData::set_arg_local(int i) {
 333   set_nth_bit(_arg_local, i);
 334 }
 335 


 500     st->print("%d", dp_to_di(data->dp()));
 501     st->fill_to(6);
 502     data->print_data_on(st);
 503   }
 504 }
 505 
 506 void ciTypeEntries::print_ciklass(outputStream* st, intptr_t k) {
 507   if (TypeEntries::is_type_none(k)) {
 508     st->print("none");
 509   } else if (TypeEntries::is_type_unknown(k)) {
 510     st->print("unknown");
 511   } else {
 512     valid_ciklass(k)->print_name_on(st);
 513   }
 514   if (TypeEntries::was_null_seen(k)) {
 515     st->print(" (null seen)");
 516   }
 517 }
 518 
 519 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
 520   _pd->tab(st, true);
 521   st->print("argument types");
 522   for (int i = 0; i < number_of_arguments(); i++) {
 523     _pd->tab(st);
 524     st->print("%d: stack (%u) ", i, stack_slot(i));
 525     print_ciklass(st, type(i));
 526     st->cr();
 527   }
 528 }
 529 







 530 void ciCallTypeData::print_data_on(outputStream* st) const {
 531   print_shared(st, "ciCallTypeData");



 532   args()->print_data_on(st);






 533 }
 534 
 535 void ciReceiverTypeData::print_receiver_data_on(outputStream* st) const {
 536   uint row;
 537   int entries = 0;
 538   for (row = 0; row < row_limit(); row++) {
 539     if (receiver(row) != NULL)  entries++;
 540   }
 541   st->print_cr("count(%u) entries(%u)", count(), entries);
 542   for (row = 0; row < row_limit(); row++) {
 543     if (receiver(row) != NULL) {
 544       tab(st);
 545       receiver(row)->print_name_on(st);
 546       st->print_cr("(%u)", receiver_count(row));
 547     }
 548   }
 549 }
 550 
 551 void ciReceiverTypeData::print_data_on(outputStream* st) const {
 552   print_shared(st, "ciReceiverTypeData");
 553   print_receiver_data_on(st);
 554 }
 555 
 556 void ciVirtualCallData::print_data_on(outputStream* st) const {
 557   print_shared(st, "ciVirtualCallData");
 558   rtd_super()->print_receiver_data_on(st);
 559 }
 560 
 561 void ciVirtualCallTypeData::print_data_on(outputStream* st) const {
 562   print_shared(st, "ciVirtualCallTypeData");
 563   rtd_super()->print_receiver_data_on(st);



 564   args()->print_data_on(st);






 565 }
 566 #endif


 120   _arg_returned  = mdo->arg_returned();
 121 #ifndef PRODUCT
 122   if (ReplayCompiles) {
 123     ciReplay::initialize(this);
 124   }
 125 #endif
 126 }
 127 
 128 void ciReceiverTypeData::translate_receiver_data_from(const ProfileData* data) {
 129   for (uint row = 0; row < row_limit(); row++) {
 130     Klass* k = data->as_ReceiverTypeData()->receiver(row);
 131     if (k != NULL) {
 132       ciKlass* klass = CURRENT_ENV->get_klass(k);
 133       set_receiver(row, klass);
 134     }
 135   }
 136 }
 137 
 138 
 139 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
 140   for (int i = 0; i < _number_of_entries; i++) {
 141     intptr_t k = entries->type(i);
 142     TypeStackSlotEntries::set_type(i, translate_klass(k));
 143   }
 144 }
 145 
 146 void ciReturnTypeEntry::translate_type_data_from(const ReturnTypeEntry* ret) {
 147   intptr_t k = ret->type();
 148   set_type(translate_klass(k));
 149 }
 150 
 151 // Get the data at an arbitrary (sort of) data index.
 152 ciProfileData* ciMethodData::data_at(int data_index) {
 153   if (out_of_bounds(data_index)) {
 154     return NULL;
 155   }
 156   DataLayout* data_layout = data_layout_at(data_index);
 157 
 158   switch (data_layout->tag()) {
 159   case DataLayout::no_tag:
 160   default:
 161     ShouldNotReachHere();
 162     return NULL;
 163   case DataLayout::bit_data_tag:
 164     return new ciBitData(data_layout);
 165   case DataLayout::counter_data_tag:
 166     return new ciCounterData(data_layout);
 167   case DataLayout::jump_data_tag:
 168     return new ciJumpData(data_layout);
 169   case DataLayout::receiver_type_data_tag:
 170     return new ciReceiverTypeData(data_layout);


 301   MethodData* mdo = get_MethodData();
 302   if (mdo != NULL) {
 303     mdo->set_would_profile(p);
 304   }
 305 }
 306 
 307 void ciMethodData::set_argument_type(int bci, int i, ciKlass* k) {
 308   VM_ENTRY_MARK;
 309   MethodData* mdo = get_MethodData();
 310   if (mdo != NULL) {
 311     ProfileData* data = mdo->bci_to_data(bci);
 312     if (data->is_CallTypeData()) {
 313       data->as_CallTypeData()->set_argument_type(i, k->get_Klass());
 314     } else {
 315       assert(data->is_VirtualCallTypeData(), "no arguments!");
 316       data->as_VirtualCallTypeData()->set_argument_type(i, k->get_Klass());
 317     }
 318   }
 319 }
 320 
 321 void ciMethodData::set_return_type(int bci, ciKlass* k) {
 322   VM_ENTRY_MARK;
 323   MethodData* mdo = get_MethodData();
 324   if (mdo != NULL) {
 325     ProfileData* data = mdo->bci_to_data(bci);
 326     if (data->is_CallTypeData()) {
 327       data->as_CallTypeData()->set_return_type(k->get_Klass());
 328     } else {
 329       assert(data->is_VirtualCallTypeData(), "no arguments!");
 330       data->as_VirtualCallTypeData()->set_return_type(k->get_Klass());
 331     }
 332   }
 333 }
 334 
 335 bool ciMethodData::has_escape_info() {
 336   return eflag_set(MethodData::estimated);
 337 }
 338 
 339 void ciMethodData::set_eflag(MethodData::EscapeFlag f) {
 340   set_bits(_eflags, f);
 341 }
 342 
 343 void ciMethodData::clear_eflag(MethodData::EscapeFlag f) {
 344   clear_bits(_eflags, f);
 345 }
 346 
 347 bool ciMethodData::eflag_set(MethodData::EscapeFlag f) const {
 348   return mask_bits(_eflags, f) != 0;
 349 }
 350 
 351 void ciMethodData::set_arg_local(int i) {
 352   set_nth_bit(_arg_local, i);
 353 }
 354 


 519     st->print("%d", dp_to_di(data->dp()));
 520     st->fill_to(6);
 521     data->print_data_on(st);
 522   }
 523 }
 524 
 525 void ciTypeEntries::print_ciklass(outputStream* st, intptr_t k) {
 526   if (TypeEntries::is_type_none(k)) {
 527     st->print("none");
 528   } else if (TypeEntries::is_type_unknown(k)) {
 529     st->print("unknown");
 530   } else {
 531     valid_ciklass(k)->print_name_on(st);
 532   }
 533   if (TypeEntries::was_null_seen(k)) {
 534     st->print(" (null seen)");
 535   }
 536 }
 537 
 538 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
 539   for (int i = 0; i < _number_of_entries; i++) {


 540     _pd->tab(st);
 541     st->print("%d: stack (%u) ", i, stack_slot(i));
 542     print_ciklass(st, type(i));
 543     st->cr();
 544   }
 545 }
 546 
 547 void ciReturnTypeEntry::print_data_on(outputStream* st) const {
 548   _pd->tab(st);
 549   st->print("ret ");
 550   print_ciklass(st, type());
 551   st->cr();
 552 }
 553 
 554 void ciCallTypeData::print_data_on(outputStream* st) const {
 555   print_shared(st, "ciCallTypeData");
 556   if (has_arguments()) {
 557     tab(st, true);
 558     st->print("argument types");
 559     args()->print_data_on(st);
 560   }
 561   if (has_return()) {
 562     tab(st, true);
 563     st->print("return type");
 564     ret()->print_data_on(st);
 565   }
 566 }
 567 
 568 void ciReceiverTypeData::print_receiver_data_on(outputStream* st) const {
 569   uint row;
 570   int entries = 0;
 571   for (row = 0; row < row_limit(); row++) {
 572     if (receiver(row) != NULL)  entries++;
 573   }
 574   st->print_cr("count(%u) entries(%u)", count(), entries);
 575   for (row = 0; row < row_limit(); row++) {
 576     if (receiver(row) != NULL) {
 577       tab(st);
 578       receiver(row)->print_name_on(st);
 579       st->print_cr("(%u)", receiver_count(row));
 580     }
 581   }
 582 }
 583 
 584 void ciReceiverTypeData::print_data_on(outputStream* st) const {
 585   print_shared(st, "ciReceiverTypeData");
 586   print_receiver_data_on(st);
 587 }
 588 
 589 void ciVirtualCallData::print_data_on(outputStream* st) const {
 590   print_shared(st, "ciVirtualCallData");
 591   rtd_super()->print_receiver_data_on(st);
 592 }
 593 
 594 void ciVirtualCallTypeData::print_data_on(outputStream* st) const {
 595   print_shared(st, "ciVirtualCallTypeData");
 596   rtd_super()->print_receiver_data_on(st);
 597   if (has_arguments()) {
 598     tab(st, true);
 599     st->print("argument types");
 600     args()->print_data_on(st);
 601   }
 602   if (has_return()) {
 603     tab(st, true);
 604     st->print("return type");
 605     ret()->print_data_on(st);
 606   }
 607 }
 608 #endif
src/share/vm/ci/ciMethodData.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File