annotate graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractJavaProfile.java @ 9760:c76b43ed5089

Added infrastructure for recording invoked methods in the profiling information.
author Christian Haeubl <haeubl@ssw.jku.at>
date Fri, 17 May 2013 15:38:22 +0200
parents
children 89cbd0119dc5
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 */
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
23 package com.oracle.graal.api.meta;
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 import java.io.*;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
26
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
27 /**
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
28 * This profile object represents a certain set of profiling information at a specific BCI. The
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
29 * precision of the supplied values may vary, but a runtime that provides this information should be
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
30 * aware that it will be used to guide performance-critical decisions like speculative inlining,
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
31 * etc.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
32 */
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
33 public abstract class AbstractJavaProfile<T extends AbstractProfiledItem<U>, U> implements Serializable {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
34
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
35 private static final long serialVersionUID = 5493379044459116749L;
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
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
40 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
41 this.pitems = pitems;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
42 assert notRecordedProbability != Double.NaN;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
43 this.notRecordedProbability = notRecordedProbability;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
44 assert isSorted();
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
45 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
46
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
47 /**
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
48 * 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
49 * probabilities.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
50 */
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
51 private boolean isSorted() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
52 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
53 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
54 return false;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
55 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
56 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
57 return true;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
58 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
59
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 * 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
62 * limitations.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
63 *
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
64 * @return double value >= 0.0 and <= 1.0
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 public double getNotRecordedProbability() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
67 return notRecordedProbability;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
68 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
69
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
70 protected T[] getItems() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
71 return pitems;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
72 }
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 * Searches for an entry of a given resolved Java type.
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
76 *
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
77 * @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
78 * @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
79 */
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
80 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
81 if (pitems != null) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
82 for (T pt : pitems) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
83 if (pt.getItem() == type) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
84 return pt;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
85 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
86 }
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 return null;
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
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
91 @Override
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
92 public String toString() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
93 StringBuilder builder = new StringBuilder();
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
94 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
95 builder.append("[");
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) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
98 builder.append(pt.toString());
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
99 builder.append(", ");
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 builder.append(this.notRecordedProbability);
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
103 builder.append("]");
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
104 return builder.toString();
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
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
107 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
108 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
109 return true;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
110 } else {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
111 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
112 T pitem = getItems()[i];
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
113 U curType = pitem.getItem();
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
114 if (curType == item) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
115 return true;
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 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
118 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
119 return false;
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 @Override
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
123 public boolean equals(Object other) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
124 if (other == this) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
125 return true;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
126 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
127 if (getClass() == other.getClass()) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
128 AbstractJavaProfile javaTypeProfile = (AbstractJavaProfile) other;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
129 if (javaTypeProfile.notRecordedProbability != notRecordedProbability) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
130 return false;
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 if (javaTypeProfile.pitems.length != pitems.length) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
133 return false;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
134 }
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 for (int i = 0; i < pitems.length; ++i) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
137 if (!pitems[i].equals(javaTypeProfile.pitems[i])) {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
138 return false;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
139 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
140 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
141
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
142 return true;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
143 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
144 return false;
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
145 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
146
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
147 @Override
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
148 public int hashCode() {
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
149 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
150 }
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
diff changeset
151 }