Mercurial > hg > graal-compiler
comparison src/share/vm/oops/methodData.hpp @ 9762:57e5211846f9
Added class unloading support to the method profiling infrastructure.
author | Christian Haeubl <haeubl@ssw.jku.at> |
---|---|
date | Fri, 17 May 2013 17:24:03 +0200 |
parents | c76b43ed5089 |
children | 836a62f43af9 |
comparison
equal
deleted
inserted
replaced
9761:b1e4aebbd19e | 9762:57e5211846f9 |
---|---|
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 } |
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 |
787 // Direct accessors | |
788 static ByteSize virtual_call_data_size() { | |
789 return cell_offset(static_cell_count()); | |
790 } | |
791 | |
769 #ifdef GRAAL | 792 #ifdef GRAAL |
770 static ByteSize method_offset(uint row) { | 793 static ByteSize method_offset(uint row) { |
771 return cell_offset(method_cell_index(row)); | 794 return cell_offset(method_cell_index(row)); |
772 } | 795 } |
773 static ByteSize method_count_offset(uint row) { | 796 static ByteSize method_count_offset(uint row) { |
777 return receiver0_offset + (row + TypeProfileWidth) * receiver_type_row_cell_count; | 800 return receiver0_offset + (row + TypeProfileWidth) * receiver_type_row_cell_count; |
778 } | 801 } |
779 static int method_count_cell_index(uint row) { | 802 static int method_count_cell_index(uint row) { |
780 return count0_offset + (row + TypeProfileWidth) * receiver_type_row_cell_count; | 803 return count0_offset + (row + TypeProfileWidth) * receiver_type_row_cell_count; |
781 } | 804 } |
782 #endif | 805 static uint method_row_limit() { |
783 | 806 return MethodProfileWidth; |
784 // Direct accessors | 807 } |
785 static ByteSize virtual_call_data_size() { | 808 |
786 return cell_offset(static_cell_count()); | 809 Method* method(uint row) { |
787 } | 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 | |
788 | 838 |
789 #ifndef PRODUCT | 839 #ifndef PRODUCT |
790 void print_data_on(outputStream* st); | 840 void print_data_on(outputStream* st); |
791 #endif | 841 #endif |
792 }; | 842 }; |