annotate src/share/vm/ci/ciCallProfile.hpp @ 1879:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children c760f78e0a53
rev   line source
duke@0 1 /*
stefank@1879 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1879 25 #ifndef SHARE_VM_CI_CICALLPROFILE_HPP
stefank@1879 26 #define SHARE_VM_CI_CICALLPROFILE_HPP
stefank@1879 27
stefank@1879 28 #include "ci/ciClassList.hpp"
stefank@1879 29
duke@0 30 // ciCallProfile
duke@0 31 //
duke@0 32 // This class is used to determine the frequently called method
duke@0 33 // at some call site
duke@0 34 class ciCallProfile : StackObj {
duke@0 35 private:
duke@0 36 // Fields are initialized directly by ciMethod::call_profile_at_bci.
duke@0 37 friend class ciMethod;
duke@0 38
duke@0 39 enum { MorphismLimit = 2 }; // Max call site's morphism we care about
duke@0 40 int _limit; // number of receivers have been determined
duke@0 41 int _morphism; // determined call site's morphism
duke@0 42 int _count; // # times has this call been executed
duke@0 43 int _receiver_count[MorphismLimit + 1]; // # times receivers have been seen
duke@0 44 ciMethod* _method[MorphismLimit + 1]; // receivers methods
duke@0 45 ciKlass* _receiver[MorphismLimit + 1]; // receivers (exact)
duke@0 46
duke@0 47 ciCallProfile() {
duke@0 48 _limit = 0;
duke@0 49 _morphism = 0;
duke@0 50 _count = -1;
duke@0 51 _receiver_count[0] = -1;
duke@0 52 _method[0] = NULL;
duke@0 53 _receiver[0] = NULL;
duke@0 54 }
duke@0 55
duke@0 56 void add_receiver(ciKlass* receiver, int receiver_count);
duke@0 57
duke@0 58 public:
duke@0 59 // Note: The following predicates return false for invalid profiles:
duke@0 60 bool has_receiver(int i) { return _limit > i; }
duke@0 61 int morphism() { return _morphism; }
duke@0 62
duke@0 63 int count() { return _count; }
duke@0 64 int receiver_count(int i) {
duke@0 65 assert(i < _limit, "out of Call Profile MorphismLimit");
duke@0 66 return _receiver_count[i];
duke@0 67 }
duke@0 68 float receiver_prob(int i) {
duke@0 69 assert(i < _limit, "out of Call Profile MorphismLimit");
duke@0 70 return (float)_receiver_count[i]/(float)_count;
duke@0 71 }
duke@0 72 ciMethod* method(int i) {
duke@0 73 assert(i < _limit, "out of Call Profile MorphismLimit");
duke@0 74 return _method[i];
duke@0 75 }
duke@0 76 ciKlass* receiver(int i) {
duke@0 77 assert(i < _limit, "out of Call Profile MorphismLimit");
duke@0 78 return _receiver[i];
duke@0 79 }
duke@0 80 };
stefank@1879 81
stefank@1879 82 #endif // SHARE_VM_CI_CICALLPROFILE_HPP