hotspot/src/share/vm/oops/methodCounters.hpp
author twisti
Mon, 14 Dec 2015 17:02:02 -1000
changeset 35123 b0b89d83bcf5
parent 33163 9e128b399e48
child 37272 c427db4ea8c4
permissions -rw-r--r--
8134994: use separate VMStructs databases for SA and JVMCI Reviewed-by: kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     1
/*
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     4
 *
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     7
 * published by the Free Software Foundation.
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     8
 *
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    13
 * accompanied this code).
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    14
 *
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    18
 *
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    21
 * questions.
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    22
 *
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    23
 */
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    24
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    25
#ifndef SHARE_VM_OOPS_METHODCOUNTERS_HPP
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    26
#define SHARE_VM_OOPS_METHODCOUNTERS_HPP
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    27
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    28
#include "oops/metadata.hpp"
28650
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    29
#include "compiler/compilerOracle.hpp"
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    30
#include "interpreter/invocationCounter.hpp"
28650
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    31
#include "runtime/arguments.hpp"
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    32
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    33
class MethodCounters: public MetaspaceObj {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    34
 friend class VMStructs;
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33163
diff changeset
    35
 friend class JVMCIVMStructs;
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    36
 private:
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    37
  int               _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    38
  u2                _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    39
  u2                _number_of_breakpoints;      // fullspeed debugging support
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    40
  InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    41
  InvocationCounter _backedge_counter;           // Incremented before each backedge taken - used to trigger frequencey-based optimizations
24442
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    42
  // NMethod age is a counter for warm methods detection in the code cache sweeper.
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    43
  // The counter is reset by the sweeper and is decremented by some of the compiled
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    44
  // code. The counter values are interpreted as follows:
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    45
  // 1. (HotMethodDetection..INT_MAX] - initial value, no counters inserted
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 28650
diff changeset
    46
  // 2. [1..HotMethodDetectionLimit)  - the method is warm, the counter is used
24442
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    47
  //                                    to figure out which methods can be flushed.
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    48
  // 3. (INT_MIN..0]                  - method is hot and will deopt and get
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    49
  //                                    recompiled without the counters
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    50
  int               _nmethod_age;
28650
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    51
  int               _interpreter_invocation_limit;        // per-method InterpreterInvocationLimit
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    52
  int               _interpreter_backward_branch_limit;   // per-method InterpreterBackwardBranchLimit
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    53
  int               _interpreter_profile_limit;           // per-method InterpreterProfileLimit
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    54
  int               _invoke_mask;                         // per-method Tier0InvokeNotifyFreqLog
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    55
  int               _backedge_mask;                       // per-method Tier0BackedgeNotifyFreqLog
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    56
#ifdef TIERED
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    57
  float             _rate;                        // Events (invocation and backedge counter increments) per millisecond
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    58
  jlong             _prev_time;                   // Previous time the rate was acquired
26586
992efa57514f 8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters
iveresov
parents: 24442
diff changeset
    59
  u1                _highest_comp_level;          // Highest compile level this method has ever seen.
992efa57514f 8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters
iveresov
parents: 24442
diff changeset
    60
  u1                _highest_osr_comp_level;      // Same for OSR level
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    61
#endif
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    62
28650
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    63
  MethodCounters(methodHandle mh) : _interpreter_invocation_count(0),
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    64
                                    _interpreter_throwout_count(0),
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    65
                                    _number_of_breakpoints(0),
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    66
                                    _nmethod_age(INT_MAX)
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    67
#ifdef TIERED
28650
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    68
                                 , _rate(0),
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    69
                                   _prev_time(0),
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    70
                                   _highest_comp_level(0),
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    71
                                   _highest_osr_comp_level(0)
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    72
#endif
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    73
  {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    74
    invocation_counter()->init();
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    75
    backedge_counter()->init();
24442
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    76
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    77
    if (StressCodeAging) {
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    78
      set_nmethod_age(HotMethodDetectionLimit);
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
    79
    }
28650
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    80
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    81
    // Set per-method thresholds.
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    82
    double scale = 1.0;
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    83
    CompilerOracle::has_option_value(mh, "CompileThresholdScaling", scale);
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    84
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    85
    int compile_threshold = Arguments::scaled_compile_threshold(CompileThreshold, scale);
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    86
    _interpreter_invocation_limit = compile_threshold << InvocationCounter::count_shift;
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    87
    if (ProfileInterpreter) {
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    88
      // If interpreter profiling is enabled, the backward branch limit
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    89
      // is compared against the method data counter rather than an invocation
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    90
      // counter, therefore no shifting of bits is required.
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    91
      _interpreter_backward_branch_limit = (compile_threshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100;
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    92
    } else {
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    93
      _interpreter_backward_branch_limit = ((compile_threshold * OnStackReplacePercentage) / 100) << InvocationCounter::count_shift;
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    94
    }
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    95
    _interpreter_profile_limit = ((compile_threshold * InterpreterProfilePercentage) / 100) << InvocationCounter::count_shift;
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    96
    _invoke_mask = right_n_bits(Arguments::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
    97
    _backedge_mask = right_n_bits(Arguments::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift;
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    98
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
    99
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   100
 public:
28650
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   101
  static MethodCounters* allocate(methodHandle mh, TRAPS);
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   102
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   103
  void deallocate_contents(ClassLoaderData* loader_data) {}
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   104
  DEBUG_ONLY(bool on_stack() { return false; })  // for template
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   105
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   106
  static int size() { return sizeof(MethodCounters) / wordSize; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   107
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   108
  bool is_klass() const { return false; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   109
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   110
  void clear_counters();
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   111
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   112
  int interpreter_invocation_count() {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   113
    return _interpreter_invocation_count;
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   114
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   115
  void set_interpreter_invocation_count(int count) {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   116
    _interpreter_invocation_count = count;
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   117
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   118
  int increment_interpreter_invocation_count() {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   119
    return ++_interpreter_invocation_count;
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   120
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   121
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   122
  void interpreter_throwout_increment() {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   123
    if (_interpreter_throwout_count < 65534) {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   124
      _interpreter_throwout_count++;
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   125
    }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   126
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   127
  int  interpreter_throwout_count() const {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   128
    return _interpreter_throwout_count;
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   129
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   130
  void set_interpreter_throwout_count(int count) {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   131
    _interpreter_throwout_count = count;
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   132
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   133
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   134
  u2   number_of_breakpoints() const   { return _number_of_breakpoints; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   135
  void incr_number_of_breakpoints()    { ++_number_of_breakpoints; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   136
  void decr_number_of_breakpoints()    { --_number_of_breakpoints; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   137
  void clear_number_of_breakpoints()   { _number_of_breakpoints = 0; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   138
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   139
#ifdef TIERED
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   140
  jlong prev_time() const                        { return _prev_time; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   141
  void set_prev_time(jlong time)                 { _prev_time = time; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   142
  float rate() const                             { return _rate; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   143
  void set_rate(float rate)                      { _rate = rate; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   144
#endif
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   145
26586
992efa57514f 8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters
iveresov
parents: 24442
diff changeset
   146
  int highest_comp_level() const;
992efa57514f 8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters
iveresov
parents: 24442
diff changeset
   147
  void set_highest_comp_level(int level);
992efa57514f 8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters
iveresov
parents: 24442
diff changeset
   148
  int highest_osr_comp_level() const;
992efa57514f 8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters
iveresov
parents: 24442
diff changeset
   149
  void set_highest_osr_comp_level(int level);
992efa57514f 8058184: Move _highest_comp_level and _highest_osr_comp_level from MethodData to MethodCounters
iveresov
parents: 24442
diff changeset
   150
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   151
  // invocation counter
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   152
  InvocationCounter* invocation_counter() { return &_invocation_counter; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   153
  InvocationCounter* backedge_counter()   { return &_backedge_counter; }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   154
24442
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   155
  int nmethod_age() {
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   156
    return _nmethod_age;
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   157
  }
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   158
  void set_nmethod_age(int age) {
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   159
    _nmethod_age = age;
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   160
  }
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   161
  void reset_nmethod_age() {
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   162
    set_nmethod_age(HotMethodDetectionLimit);
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   163
  }
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   164
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   165
  static bool is_nmethod_hot(int age)       { return age <= 0; }
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   166
  static bool is_nmethod_warm(int age)      { return age < HotMethodDetectionLimit; }
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   167
  static bool is_nmethod_age_unset(int age) { return age > HotMethodDetectionLimit; }
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   168
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   169
  static ByteSize nmethod_age_offset() {
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   170
    return byte_offset_of(MethodCounters, _nmethod_age);
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   171
  }
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 17000
diff changeset
   172
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   173
  static ByteSize interpreter_invocation_counter_offset() {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   174
    return byte_offset_of(MethodCounters, _interpreter_invocation_count);
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   175
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   176
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   177
  static ByteSize invocation_counter_offset()    {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   178
    return byte_offset_of(MethodCounters, _invocation_counter);
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   179
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   180
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   181
  static ByteSize backedge_counter_offset()      {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   182
    return byte_offset_of(MethodCounters, _backedge_counter);
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   183
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   184
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   185
  static int interpreter_invocation_counter_offset_in_bytes() {
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   186
    return offset_of(MethodCounters, _interpreter_invocation_count);
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   187
  }
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   188
28650
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   189
  static ByteSize interpreter_invocation_limit_offset() {
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   190
    return byte_offset_of(MethodCounters, _interpreter_invocation_limit);
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   191
  }
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   192
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   193
  static ByteSize interpreter_backward_branch_limit_offset() {
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   194
    return byte_offset_of(MethodCounters, _interpreter_backward_branch_limit);
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   195
  }
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   196
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   197
  static ByteSize interpreter_profile_limit_offset() {
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   198
    return byte_offset_of(MethodCounters, _interpreter_profile_limit);
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   199
  }
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   200
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   201
  static ByteSize invoke_mask_offset() {
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   202
    return byte_offset_of(MethodCounters, _invoke_mask);
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   203
  }
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   204
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   205
  static ByteSize backedge_mask_offset() {
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   206
    return byte_offset_of(MethodCounters, _backedge_mask);
772aaab2582f 8059606: Enable per-method usage of CompileThresholdScaling (per-method compilation thresholds)
zmajo
parents: 26586
diff changeset
   207
  }
17000
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   208
};
11bf92e571a2 8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
diff changeset
   209
#endif //SHARE_VM_OOPS_METHODCOUNTERS_HPP