1844 // Back pointer to the Method*
1845 Method* _method;
1846
1847 // Size of this oop in bytes
1848 int _size;
1849
1850 // Cached hint for bci_to_dp and bci_to_data
1851 int _hint_di;
1852
1853 Mutex _extra_data_lock;
1854
1855 MethodData(methodHandle method, int size, TRAPS);
1856 public:
1857 static MethodData* allocate(ClassLoaderData* loader_data, methodHandle method, TRAPS);
1858 MethodData() : _extra_data_lock(Monitor::leaf, "MDO extra data lock") {}; // For ciMethodData
1859
1860 bool is_methodData() const volatile { return true; }
1861
1862 // Whole-method sticky bits and flags
1863 enum {
1864 _trap_hist_limit = 18, // decoupled from Deoptimization::Reason_LIMIT
1865 _trap_hist_mask = max_jubyte,
1866 _extra_data_count = 4 // extra DataLayout headers, for trap history
1867 }; // Public flag values
1868 private:
1869 uint _nof_decompiles; // count of all nmethod removals
1870 uint _nof_overflow_recompiles; // recompile count, excluding recomp. bits
1871 uint _nof_overflow_traps; // trap count, excluding _trap_hist
1872 union {
1873 intptr_t _align;
1874 u1 _array[_trap_hist_limit];
1875 } _trap_hist;
1876
1877 // Support for interprocedural escape analysis, from Thomas Kotzmann.
1878 intx _eflags; // flags on escape information
1879 intx _arg_local; // bit set of non-escaping arguments
1880 intx _arg_stack; // bit set of stack-allocatable arguments
1881 intx _arg_returned; // bit set of returned arguments
1882
1883 int _creation_mileage; // method mileage at MDO creation
1884
1885 // How many invocations has this MDO seen?
1886 // These counters are used to determine the exact age of MDO.
1887 // We need those because in tiered a method can be concurrently
1888 // executed at different levels.
1889 InvocationCounter _invocation_counter;
1890 // Same for backedges.
1891 InvocationCounter _backedge_counter;
1892 // Counter values at the time profiling started.
1893 int _invocation_counter_start;
1894 int _backedge_counter_start;
1895 // Number of loops and blocks is computed when compiling the first
1896 // time with C1. It is used to determine if method is trivial.
1897 short _num_loops;
1898 short _num_blocks;
1899 // Highest compile level this method has ever seen.
1900 u1 _highest_comp_level;
1901 // Same for OSR level
1902 u1 _highest_osr_comp_level;
1903 // Does this method contain anything worth profiling?
1904 bool _would_profile;
1905
1906 // Size of _data array in bytes. (Excludes header and extra_data fields.)
1907 int _data_size;
1908
1909 // data index for the area dedicated to parameters. -1 if no
1910 // parameter profiling.
1911 int _parameters_type_data_di;
1912
1913 // Beginning of the data entries
1914 intptr_t _data[1];
2038 }
2039
2040 int backedge_count_start() {
2041 if (backedge_counter()->carry()) {
2042 return 0;
2043 }
2044 return _backedge_counter_start;
2045 }
2046
2047 int invocation_count_delta() { return invocation_count() - invocation_count_start(); }
2048 int backedge_count_delta() { return backedge_count() - backedge_count_start(); }
2049
2050 void reset_start_counters() {
2051 _invocation_counter_start = invocation_count();
2052 _backedge_counter_start = backedge_count();
2053 }
2054
2055 InvocationCounter* invocation_counter() { return &_invocation_counter; }
2056 InvocationCounter* backedge_counter() { return &_backedge_counter; }
2057
2058 void set_would_profile(bool p) { _would_profile = p; }
2059 bool would_profile() const { return _would_profile; }
2060
2061 int highest_comp_level() const { return _highest_comp_level; }
2062 void set_highest_comp_level(int level) { _highest_comp_level = level; }
2063 int highest_osr_comp_level() const { return _highest_osr_comp_level; }
2064 void set_highest_osr_comp_level(int level) { _highest_osr_comp_level = level; }
2065
2066 int num_loops() const { return _num_loops; }
2067 void set_num_loops(int n) { _num_loops = n; }
2068 int num_blocks() const { return _num_blocks; }
2069 void set_num_blocks(int n) { _num_blocks = n; }
2070
2071 bool is_mature() const; // consult mileage and ProfileMaturityPercentage
2072 static int mileage_of(Method* m);
2073
2074 // Support for interprocedural escape analysis, from Thomas Kotzmann.
2075 enum EscapeFlag {
2076 estimated = 1 << 0,
2077 return_local = 1 << 1,
|
1844 // Back pointer to the Method*
1845 Method* _method;
1846
1847 // Size of this oop in bytes
1848 int _size;
1849
1850 // Cached hint for bci_to_dp and bci_to_data
1851 int _hint_di;
1852
1853 Mutex _extra_data_lock;
1854
1855 MethodData(methodHandle method, int size, TRAPS);
1856 public:
1857 static MethodData* allocate(ClassLoaderData* loader_data, methodHandle method, TRAPS);
1858 MethodData() : _extra_data_lock(Monitor::leaf, "MDO extra data lock") {}; // For ciMethodData
1859
1860 bool is_methodData() const volatile { return true; }
1861
1862 // Whole-method sticky bits and flags
1863 enum {
1864 _trap_hist_limit = 19, // decoupled from Deoptimization::Reason_LIMIT
1865 _trap_hist_mask = max_jubyte,
1866 _extra_data_count = 4 // extra DataLayout headers, for trap history
1867 }; // Public flag values
1868 private:
1869 uint _nof_decompiles; // count of all nmethod removals
1870 uint _nof_overflow_recompiles; // recompile count, excluding recomp. bits
1871 uint _nof_overflow_traps; // trap count, excluding _trap_hist
1872 union {
1873 intptr_t _align;
1874 u1 _array[_trap_hist_limit];
1875 } _trap_hist;
1876
1877 // Support for interprocedural escape analysis, from Thomas Kotzmann.
1878 intx _eflags; // flags on escape information
1879 intx _arg_local; // bit set of non-escaping arguments
1880 intx _arg_stack; // bit set of stack-allocatable arguments
1881 intx _arg_returned; // bit set of returned arguments
1882
1883 int _creation_mileage; // method mileage at MDO creation
1884
1885 // How many invocations has this MDO seen?
1886 // These counters are used to determine the exact age of MDO.
1887 // We need those because in tiered a method can be concurrently
1888 // executed at different levels.
1889 InvocationCounter _invocation_counter;
1890 // Same for backedges.
1891 InvocationCounter _backedge_counter;
1892 // Counter values at the time profiling started.
1893 int _invocation_counter_start;
1894 int _backedge_counter_start;
1895
1896 #if INCLUDE_RTM_OPT
1897 // State of RTM code generation during compilation of the method
1898 int _rtm_state;
1899 #endif
1900
1901 // Number of loops and blocks is computed when compiling the first
1902 // time with C1. It is used to determine if method is trivial.
1903 short _num_loops;
1904 short _num_blocks;
1905 // Highest compile level this method has ever seen.
1906 u1 _highest_comp_level;
1907 // Same for OSR level
1908 u1 _highest_osr_comp_level;
1909 // Does this method contain anything worth profiling?
1910 bool _would_profile;
1911
1912 // Size of _data array in bytes. (Excludes header and extra_data fields.)
1913 int _data_size;
1914
1915 // data index for the area dedicated to parameters. -1 if no
1916 // parameter profiling.
1917 int _parameters_type_data_di;
1918
1919 // Beginning of the data entries
1920 intptr_t _data[1];
2044 }
2045
2046 int backedge_count_start() {
2047 if (backedge_counter()->carry()) {
2048 return 0;
2049 }
2050 return _backedge_counter_start;
2051 }
2052
2053 int invocation_count_delta() { return invocation_count() - invocation_count_start(); }
2054 int backedge_count_delta() { return backedge_count() - backedge_count_start(); }
2055
2056 void reset_start_counters() {
2057 _invocation_counter_start = invocation_count();
2058 _backedge_counter_start = backedge_count();
2059 }
2060
2061 InvocationCounter* invocation_counter() { return &_invocation_counter; }
2062 InvocationCounter* backedge_counter() { return &_backedge_counter; }
2063
2064 #if INCLUDE_RTM_OPT
2065 int rtm_state() const {
2066 return _rtm_state;
2067 }
2068 void set_rtm_state(RTMState rstate) {
2069 _rtm_state = (int)rstate;
2070 }
2071 void atomic_set_rtm_state(RTMState rstate) {
2072 Atomic::store((int)rstate, &_rtm_state);
2073 }
2074
2075 static int rtm_state_offset_in_bytes() {
2076 return offset_of(MethodData, _rtm_state);
2077 }
2078 #endif
2079
2080 void set_would_profile(bool p) { _would_profile = p; }
2081 bool would_profile() const { return _would_profile; }
2082
2083 int highest_comp_level() const { return _highest_comp_level; }
2084 void set_highest_comp_level(int level) { _highest_comp_level = level; }
2085 int highest_osr_comp_level() const { return _highest_osr_comp_level; }
2086 void set_highest_osr_comp_level(int level) { _highest_osr_comp_level = level; }
2087
2088 int num_loops() const { return _num_loops; }
2089 void set_num_loops(int n) { _num_loops = n; }
2090 int num_blocks() const { return _num_blocks; }
2091 void set_num_blocks(int n) { _num_blocks = n; }
2092
2093 bool is_mature() const; // consult mileage and ProfileMaturityPercentage
2094 static int mileage_of(Method* m);
2095
2096 // Support for interprocedural escape analysis, from Thomas Kotzmann.
2097 enum EscapeFlag {
2098 estimated = 1 << 0,
2099 return_local = 1 << 1,
|