annotate jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/AbstractJavaProfile.java @ 24151:26a414946c56 jvmci-0.29

Get host class of VM anonymous class (JDK-8182310)
author Doug Simon <doug.simon@oracle.com>
date Fri, 30 Jun 2017 17:09:57 +0200
parents 9e1235406b59
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
1 /*
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
4 *
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
8 *
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
13 * accompanied this code).
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
14 *
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
18 *
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
21 * questions.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
22 */
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22054
diff changeset
23 package jdk.vm.ci.meta;
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
24
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
25 /**
9923
89cbd0119dc5 Added comment to explain the generics of AbstractJavaProfile.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
26 * This object holds probability information for a set of items that were profiled at a specific
89cbd0119dc5 Added comment to explain the generics of AbstractJavaProfile.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
27 * BCI. The precision of the supplied values may vary, but a runtime that provides this information
89cbd0119dc5 Added comment to explain the generics of AbstractJavaProfile.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
28 * should be aware that it will be used to guide performance-critical decisions like speculative
89cbd0119dc5 Added comment to explain the generics of AbstractJavaProfile.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
29 * inlining, etc.
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14157
diff changeset
30 *
9923
89cbd0119dc5 Added comment to explain the generics of AbstractJavaProfile.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
31 * @param <T> a subclass of AbstractProfiledItem
89cbd0119dc5 Added comment to explain the generics of AbstractJavaProfile.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
32 * @param <U> the class of the items that are profiled at the specific BCI and for which
89cbd0119dc5 Added comment to explain the generics of AbstractJavaProfile.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9760
diff changeset
33 * probabilities are stored. E.g., a ResolvedJavaType or a ResolvedJavaMethod.
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
34 */
21411
082417ac43e4 removed com.oracle.graal.hotspot.server and uses of Serializable it depended upon (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19433
diff changeset
35 public abstract class AbstractJavaProfile<T extends AbstractProfiledItem<U>, U> {
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
36
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
37 private final double notRecordedProbability;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
38 private final T[] pitems;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
39
23700
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22672
diff changeset
40 /**
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22672
diff changeset
41 *
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22672
diff changeset
42 * @param notRecordedProbability
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22672
diff changeset
43 * @param pitems
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22672
diff changeset
44 */
9e1235406b59 [Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents: 22672
diff changeset
45 @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of the `pitems` array parameter")
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
46 public AbstractJavaProfile(double notRecordedProbability, T[] pitems) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
47 this.pitems = pitems;
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
48 assert !Double.isNaN(notRecordedProbability);
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
49 this.notRecordedProbability = notRecordedProbability;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
50 assert isSorted();
19433
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
51 assert totalProbablility() >= 0 && totalProbablility() <= 1.0001 : totalProbablility() + " " + this;
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
52 }
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
53
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
54 private double totalProbablility() {
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
55 double total = notRecordedProbability;
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
56 for (T item : pitems) {
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
57 total += item.probability;
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
58 }
2a914f764cfa Add some probablity sanity assert on AbstractJavaProfile
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 18583
diff changeset
59 return total;
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
60 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
61
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
62 /**
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
63 * Determines if an array of profiled items are sorted in descending order of their
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
64 * probabilities.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
65 */
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
66 private boolean isSorted() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
67 for (int i = 1; i < pitems.length; i++) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
68 if (pitems[i - 1].getProbability() < pitems[i].getProbability()) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
69 return false;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
70 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
71 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
72 return true;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
73 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
74
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
75 /**
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
76 * Returns the estimated probability of all types that could not be recorded due to profiling
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
77 * limitations.
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14157
diff changeset
78 *
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14157
diff changeset
79 * @return double value &ge; 0.0 and &le; 1.0
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
80 */
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
81 public double getNotRecordedProbability() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
82 return notRecordedProbability;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
83 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
84
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
85 protected T[] getItems() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
86 return pitems;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
87 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
88
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
89 /**
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
90 * Searches for an entry of a given resolved Java type.
14906
f3a5036cc13c javadoc fixes
Bernhard Urban <bernhard.urban@jku.at>
parents: 14157
diff changeset
91 *
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
92 * @param type the type for which an entry should be searched
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
93 * @return the entry or null if no entry for this type can be found
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
94 */
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
95 public T findEntry(ResolvedJavaType type) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
96 if (pitems != null) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
97 for (T pt : pitems) {
18583
12bd2b344b08 replace usages of == with .equals()
Doug Simon <doug.simon@oracle.com>
parents: 15040
diff changeset
98 if (pt.getItem().equals(type)) {
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
99 return pt;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
100 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
101 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
102 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
103 return null;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
104 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
105
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
106 @Override
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
107 public String toString() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
108 StringBuilder builder = new StringBuilder();
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
109 builder.append(this.getClass().getName());
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
110 builder.append("[");
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
111 if (pitems != null) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
112 for (T pt : pitems) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
113 builder.append(pt.toString());
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
114 builder.append(", ");
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
115 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
116 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
117 builder.append(this.notRecordedProbability);
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
118 builder.append("]");
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
119 return builder.toString();
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
120 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
121
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
122 public boolean isIncluded(U item) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
123 if (this.getNotRecordedProbability() > 0.0) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
124 return true;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
125 } else {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
126 for (int i = 0; i < getItems().length; i++) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
127 T pitem = getItems()[i];
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
128 U curType = pitem.getItem();
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
129 if (curType == item) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
130 return true;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
131 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
132 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
133 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
134 return false;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
135 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
136
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
137 @Override
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
138 public boolean equals(Object obj) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
139 if (obj == this) {
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
140 return true;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
141 }
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
142 if (!(obj instanceof AbstractJavaProfile)) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
143 return false;
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
144 }
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 14906
diff changeset
145 AbstractJavaProfile<?, ?> that = (AbstractJavaProfile<?, ?>) obj;
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
146 if (that.notRecordedProbability != notRecordedProbability) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
147 return false;
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
148 }
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
149 if (that.pitems.length != pitems.length) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
150 return false;
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
151 }
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
152 for (int i = 0; i < pitems.length; ++i) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
153 if (!pitems[i].equals(that.pitems[i])) {
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
154 return false;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
155 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
156 }
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 9923
diff changeset
157 return true;
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
158 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
159
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
160 @Override
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
161 public int hashCode() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
162 return (int) Double.doubleToLongBits(notRecordedProbability) + pitems.length * 13;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
163 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
164 }