comparison src/share/vm/oops/methodData.hpp @ 9783:5402504894fe

Merge.
author Christian Humer <christian.humer@gmail.com>
date Tue, 21 May 2013 19:51:00 +0200
parents 57e5211846f9
children 836a62f43af9
comparison
equal deleted inserted replaced
9782:ba02d19dd3cc 9783:5402504894fe
633 // which are used to store a type profile for the receiver of the check. 633 // which are used to store a type profile for the receiver of the check.
634 class ReceiverTypeData : public CounterData { 634 class ReceiverTypeData : public CounterData {
635 protected: 635 protected:
636 enum { 636 enum {
637 #ifdef GRAAL 637 #ifdef GRAAL
638 // Graal is interested in knowing the percentage of type checks 638 // Description of the different counters
639 // involving a type not explicitly in the profile 639 // ReceiverTypeData for instanceof/checkcast/aastore:
640 nonprofiled_receiver_count_off_set = counter_cell_count, 640 // C1/C2: count is incremented on type overflow and decremented for failed type checks
641 // Graal: count decremented for failed type checks and nonprofiled_count is incremented on type overflow
642 // TODO (chaeubl): in fact, Graal should also increment the count for failed type checks to mimic the C1/C2 behavior
643 // VirtualCallData for invokevirtual/invokeinterface:
644 // C1/C2: count is incremented on type overflow
645 // Graal: count is incremented on type overflow, nonprofiled_count is increment on method overflow
646
647 // Graal is interested in knowing the percentage of type checks involving a type not explicitly in the profile
648 nonprofiled_count_off_set = counter_cell_count,
641 receiver0_offset, 649 receiver0_offset,
642 #else 650 #else
643 receiver0_offset = counter_cell_count, 651 receiver0_offset = counter_cell_count,
644 #endif 652 #endif
645 count0_offset, 653 count0_offset,
715 // We do sorting a profiling info (ciCallProfile) for compilation. 723 // We do sorting a profiling info (ciCallProfile) for compilation.
716 // 724 //
717 set_count(0); 725 set_count(0);
718 set_receiver(row, NULL); 726 set_receiver(row, NULL);
719 set_receiver_count(row, 0); 727 set_receiver_count(row, 0);
728 #ifdef GRAAL
729 if (!this->is_VirtualCallData()) {
730 // if this is a ReceiverTypeData for Graal, the nonprofiled_count
731 // must also be reset (see "Description of the different counters" above)
732 set_nonprofiled_count(0);
733 }
734 #endif
720 } 735 }
721 736
722 // Code generation support 737 // Code generation support
723 static ByteSize receiver_offset(uint row) { 738 static ByteSize receiver_offset(uint row) {
724 return cell_offset(receiver_cell_index(row)); 739 return cell_offset(receiver_cell_index(row));
726 static ByteSize receiver_count_offset(uint row) { 741 static ByteSize receiver_count_offset(uint row) {
727 return cell_offset(receiver_count_cell_index(row)); 742 return cell_offset(receiver_count_cell_index(row));
728 } 743 }
729 #ifdef GRAAL 744 #ifdef GRAAL
730 static ByteSize nonprofiled_receiver_count_offset() { 745 static ByteSize nonprofiled_receiver_count_offset() {
731 return cell_offset(nonprofiled_receiver_count_off_set); 746 return cell_offset(nonprofiled_count_off_set);
747 }
748 void set_nonprofiled_count(uint count) {
749 set_uint_at(nonprofiled_count_off_set, count);
732 } 750 }
733 #endif 751 #endif
734 static ByteSize receiver_type_data_size() { 752 static ByteSize receiver_type_data_size() {
735 return cell_offset(static_cell_count()); 753 return cell_offset(static_cell_count());
736 } 754 }
757 virtual bool is_VirtualCallData() { return true; } 775 virtual bool is_VirtualCallData() { return true; }
758 776
759 static int static_cell_count() { 777 static int static_cell_count() {
760 // At this point we could add more profile state, e.g., for arguments. 778 // At this point we could add more profile state, e.g., for arguments.
761 // But for now it's the same size as the base record type. 779 // But for now it's the same size as the base record type.
762 return ReceiverTypeData::static_cell_count(); 780 return ReceiverTypeData::static_cell_count() GRAAL_ONLY(+ (uint) MethodProfileWidth * receiver_type_row_cell_count);
763 } 781 }
764 782
765 virtual int cell_count() { 783 virtual int cell_count() {
766 return static_cell_count(); 784 return static_cell_count();
767 } 785 }
768 786
769 // Direct accessors 787 // Direct accessors
770 static ByteSize virtual_call_data_size() { 788 static ByteSize virtual_call_data_size() {
771 return cell_offset(static_cell_count()); 789 return cell_offset(static_cell_count());
772 } 790 }
791
792 #ifdef GRAAL
793 static ByteSize method_offset(uint row) {
794 return cell_offset(method_cell_index(row));
795 }
796 static ByteSize method_count_offset(uint row) {
797 return cell_offset(method_count_cell_index(row));
798 }
799 static int method_cell_index(uint row) {
800 return receiver0_offset + (row + TypeProfileWidth) * receiver_type_row_cell_count;
801 }
802 static int method_count_cell_index(uint row) {
803 return count0_offset + (row + TypeProfileWidth) * receiver_type_row_cell_count;
804 }
805 static uint method_row_limit() {
806 return MethodProfileWidth;
807 }
808
809 Method* method(uint row) {
810 assert(row < method_row_limit(), "oob");
811
812 Method* method = (Method*)intptr_at(method_cell_index(row));
813 assert(method == NULL || method->is_method(), "must be");
814 return method;
815 }
816
817 void set_method(uint row, Method* m) {
818 assert((uint)row < method_row_limit(), "oob");
819 set_intptr_at(method_cell_index(row), (uintptr_t)m);
820 }
821
822 void set_method_count(uint row, uint count) {
823 assert(row < method_row_limit(), "oob");
824 set_uint_at(method_count_cell_index(row), count);
825 }
826
827 void clear_method_row(uint row) {
828 assert(row < method_row_limit(), "oob");
829 // Clear total count - indicator of polymorphic call site (see comment for clear_row() in ReceiverTypeData).
830 set_nonprofiled_count(0);
831 set_method(row, NULL);
832 set_method_count(row, 0);
833 }
834
835 // GC support
836 virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure);
837 #endif
773 838
774 #ifndef PRODUCT 839 #ifndef PRODUCT
775 void print_data_on(outputStream* st); 840 void print_data_on(outputStream* st);
776 #endif 841 #endif
777 }; 842 };