comparison src/share/vm/ci/ciMethodData.cpp @ 12882:ce0cc25bc5e2

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: kvn, twisti
author roland
date Sat, 12 Oct 2013 12:12:59 +0200
parents d13d7aba8c12
children 5ccbab1c69f3
comparison
equal deleted inserted replaced
12881:ed2c74787eb5 12882:ce0cc25bc5e2
135 } 135 }
136 } 136 }
137 137
138 138
139 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) { 139 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
140 for (int i = 0; i < number_of_arguments(); i++) { 140 for (int i = 0; i < _number_of_entries; i++) {
141 intptr_t k = entries->type(i); 141 intptr_t k = entries->type(i);
142 TypeStackSlotEntries::set_type(i, translate_klass(k)); 142 TypeStackSlotEntries::set_type(i, translate_klass(k));
143 } 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));
144 } 149 }
145 150
146 // Get the data at an arbitrary (sort of) data index. 151 // Get the data at an arbitrary (sort of) data index.
147 ciProfileData* ciMethodData::data_at(int data_index) { 152 ciProfileData* ciMethodData::data_at(int data_index) {
148 if (out_of_bounds(data_index)) { 153 if (out_of_bounds(data_index)) {
307 if (data->is_CallTypeData()) { 312 if (data->is_CallTypeData()) {
308 data->as_CallTypeData()->set_argument_type(i, k->get_Klass()); 313 data->as_CallTypeData()->set_argument_type(i, k->get_Klass());
309 } else { 314 } else {
310 assert(data->is_VirtualCallTypeData(), "no arguments!"); 315 assert(data->is_VirtualCallTypeData(), "no arguments!");
311 data->as_VirtualCallTypeData()->set_argument_type(i, k->get_Klass()); 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());
312 } 331 }
313 } 332 }
314 } 333 }
315 334
316 bool ciMethodData::has_escape_info() { 335 bool ciMethodData::has_escape_info() {
515 st->print(" (null seen)"); 534 st->print(" (null seen)");
516 } 535 }
517 } 536 }
518 537
519 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const { 538 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
520 _pd->tab(st, true); 539 for (int i = 0; i < _number_of_entries; i++) {
521 st->print("argument types");
522 for (int i = 0; i < number_of_arguments(); i++) {
523 _pd->tab(st); 540 _pd->tab(st);
524 st->print("%d: stack (%u) ", i, stack_slot(i)); 541 st->print("%d: stack (%u) ", i, stack_slot(i));
525 print_ciklass(st, type(i)); 542 print_ciklass(st, type(i));
526 st->cr(); 543 st->cr();
527 } 544 }
528 } 545 }
529 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
530 void ciCallTypeData::print_data_on(outputStream* st) const { 554 void ciCallTypeData::print_data_on(outputStream* st) const {
531 print_shared(st, "ciCallTypeData"); 555 print_shared(st, "ciCallTypeData");
532 args()->print_data_on(st); 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 }
533 } 566 }
534 567
535 void ciReceiverTypeData::print_receiver_data_on(outputStream* st) const { 568 void ciReceiverTypeData::print_receiver_data_on(outputStream* st) const {
536 uint row; 569 uint row;
537 int entries = 0; 570 int entries = 0;
559 } 592 }
560 593
561 void ciVirtualCallTypeData::print_data_on(outputStream* st) const { 594 void ciVirtualCallTypeData::print_data_on(outputStream* st) const {
562 print_shared(st, "ciVirtualCallTypeData"); 595 print_shared(st, "ciVirtualCallTypeData");
563 rtd_super()->print_receiver_data_on(st); 596 rtd_super()->print_receiver_data_on(st);
564 args()->print_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 }
565 } 607 }
566 #endif 608 #endif