annotate src/share/vm/oops/methodCounters.hpp @ 5645:fce21ac5968d

8027229: ICCE expected for >=2 maximally specific default methods. Summary: Need to process defaults for interfaces for invokespecial Reviewed-by: lfoltan, hseigel, coleenp, jrose
author acorn
date Wed, 13 Nov 2013 07:31:26 -0800
parents
children
rev   line source
jiangli@4501 1 /*
jiangli@4501 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
jiangli@4501 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jiangli@4501 4 *
jiangli@4501 5 * This code is free software; you can redistribute it and/or modify it
jiangli@4501 6 * under the terms of the GNU General Public License version 2 only, as
jiangli@4501 7 * published by the Free Software Foundation.
jiangli@4501 8 *
jiangli@4501 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jiangli@4501 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jiangli@4501 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jiangli@4501 12 * version 2 for more details (a copy is included in the LICENSE file that
jiangli@4501 13 * accompanied this code).
jiangli@4501 14 *
jiangli@4501 15 * You should have received a copy of the GNU General Public License version
jiangli@4501 16 * 2 along with this work; if not, write to the Free Software Foundation,
jiangli@4501 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jiangli@4501 18 *
jiangli@4501 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jiangli@4501 20 * or visit www.oracle.com if you need additional information or have any
jiangli@4501 21 * questions.
jiangli@4501 22 *
jiangli@4501 23 */
jiangli@4501 24
jiangli@4501 25 #ifndef SHARE_VM_OOPS_METHODCOUNTERS_HPP
jiangli@4501 26 #define SHARE_VM_OOPS_METHODCOUNTERS_HPP
jiangli@4501 27
jiangli@4501 28 #include "oops/metadata.hpp"
jiangli@4501 29 #include "interpreter/invocationCounter.hpp"
jiangli@4501 30
jiangli@4501 31 class MethodCounters: public MetaspaceObj {
jiangli@4501 32 friend class VMStructs;
jiangli@4501 33 private:
jiangli@4501 34 int _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
jiangli@4501 35 u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
jiangli@4501 36 u2 _number_of_breakpoints; // fullspeed debugging support
jiangli@4501 37 InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations
jiangli@4501 38 InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations
jiangli@4501 39
jiangli@4501 40 #ifdef TIERED
jiangli@4501 41 float _rate; // Events (invocation and backedge counter increments) per millisecond
jiangli@4501 42 jlong _prev_time; // Previous time the rate was acquired
jiangli@4501 43 #endif
jiangli@4501 44
jiangli@4501 45 MethodCounters() : _interpreter_invocation_count(0),
jiangli@4501 46 _interpreter_throwout_count(0),
jiangli@4501 47 _number_of_breakpoints(0)
jiangli@4501 48 #ifdef TIERED
jiangli@4501 49 , _rate(0),
jiangli@4501 50 _prev_time(0)
jiangli@4501 51 #endif
jiangli@4501 52 {
jiangli@4501 53 invocation_counter()->init();
jiangli@4501 54 backedge_counter()->init();
jiangli@4501 55 }
jiangli@4501 56
jiangli@4501 57 public:
jiangli@4501 58 static MethodCounters* allocate(ClassLoaderData* loader_data, TRAPS);
jiangli@4501 59
jiangli@4501 60 void deallocate_contents(ClassLoaderData* loader_data) {}
jiangli@4501 61 DEBUG_ONLY(bool on_stack() { return false; }) // for template
jiangli@4501 62
jiangli@4501 63 static int size() { return sizeof(MethodCounters) / wordSize; }
jiangli@4501 64
jiangli@4501 65 bool is_klass() const { return false; }
jiangli@4501 66
jiangli@4501 67 void clear_counters();
jiangli@4501 68
jiangli@4501 69 int interpreter_invocation_count() {
jiangli@4501 70 return _interpreter_invocation_count;
jiangli@4501 71 }
jiangli@4501 72 void set_interpreter_invocation_count(int count) {
jiangli@4501 73 _interpreter_invocation_count = count;
jiangli@4501 74 }
jiangli@4501 75 int increment_interpreter_invocation_count() {
jiangli@4501 76 return ++_interpreter_invocation_count;
jiangli@4501 77 }
jiangli@4501 78
jiangli@4501 79 void interpreter_throwout_increment() {
jiangli@4501 80 if (_interpreter_throwout_count < 65534) {
jiangli@4501 81 _interpreter_throwout_count++;
jiangli@4501 82 }
jiangli@4501 83 }
jiangli@4501 84 int interpreter_throwout_count() const {
jiangli@4501 85 return _interpreter_throwout_count;
jiangli@4501 86 }
jiangli@4501 87 void set_interpreter_throwout_count(int count) {
jiangli@4501 88 _interpreter_throwout_count = count;
jiangli@4501 89 }
jiangli@4501 90
jiangli@4501 91 u2 number_of_breakpoints() const { return _number_of_breakpoints; }
jiangli@4501 92 void incr_number_of_breakpoints() { ++_number_of_breakpoints; }
jiangli@4501 93 void decr_number_of_breakpoints() { --_number_of_breakpoints; }
jiangli@4501 94 void clear_number_of_breakpoints() { _number_of_breakpoints = 0; }
jiangli@4501 95
jiangli@4501 96 #ifdef TIERED
jiangli@4501 97 jlong prev_time() const { return _prev_time; }
jiangli@4501 98 void set_prev_time(jlong time) { _prev_time = time; }
jiangli@4501 99 float rate() const { return _rate; }
jiangli@4501 100 void set_rate(float rate) { _rate = rate; }
jiangli@4501 101 #endif
jiangli@4501 102
jiangli@4501 103 // invocation counter
jiangli@4501 104 InvocationCounter* invocation_counter() { return &_invocation_counter; }
jiangli@4501 105 InvocationCounter* backedge_counter() { return &_backedge_counter; }
jiangli@4501 106
jiangli@4501 107 static ByteSize interpreter_invocation_counter_offset() {
jiangli@4501 108 return byte_offset_of(MethodCounters, _interpreter_invocation_count);
jiangli@4501 109 }
jiangli@4501 110
jiangli@4501 111 static ByteSize invocation_counter_offset() {
jiangli@4501 112 return byte_offset_of(MethodCounters, _invocation_counter);
jiangli@4501 113 }
jiangli@4501 114
jiangli@4501 115 static ByteSize backedge_counter_offset() {
jiangli@4501 116 return byte_offset_of(MethodCounters, _backedge_counter);
jiangli@4501 117 }
jiangli@4501 118
jiangli@4501 119 static int interpreter_invocation_counter_offset_in_bytes() {
jiangli@4501 120 return offset_of(MethodCounters, _interpreter_invocation_count);
jiangli@4501 121 }
jiangli@4501 122
jiangli@4501 123 };
jiangli@4501 124 #endif //SHARE_VM_OOPS_METHODCOUNTERS_HPP