Mercurial > hg > truffle
annotate graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java @ 5484:f70b1547c7bf
small refactoring of snippet API
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 07 Jun 2012 12:15:41 +0200 |
parents | 4c3d953f8131 |
children | 56860d3f9f39 |
rev | line source |
---|---|
5105
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
1 /* |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
4 * |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
8 * |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
14 * |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
18 * |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
21 * questions. |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
22 */ |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.max.criutils; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
24 |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
25 import com.oracle.max.cri.ci.*; |
5105
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
26 import com.oracle.max.cri.ri.*; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
27 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
28 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
29 /** |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
30 * Dummy profiling information in case that a method was not executed frequently enough so that |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
31 * no profiling information does exist yet, or in case that the profiling information should not be used. |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
32 */ |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
33 public final class BaseProfilingInfo implements RiProfilingInfo { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
34 private static final RiProfilingInfo[] NO_PROFILING_INFO = new RiProfilingInfo[] { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
35 new BaseProfilingInfo(RiExceptionSeen.TRUE), |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
36 new BaseProfilingInfo(RiExceptionSeen.FALSE), |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
37 new BaseProfilingInfo(RiExceptionSeen.NOT_SUPPORTED) |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
38 }; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
39 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
40 private final RiExceptionSeen exceptionSeen; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
41 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
42 BaseProfilingInfo(RiExceptionSeen exceptionSeen) { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
43 this.exceptionSeen = exceptionSeen; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
44 } |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
45 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
46 @Override |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
47 public int codeSize() { |
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
48 return 0; |
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
49 } |
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
50 |
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
51 @Override |
5105
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
52 public RiTypeProfile getTypeProfile(int bci) { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
53 return null; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
54 } |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
55 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
56 @Override |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
57 public double getBranchTakenProbability(int bci) { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
58 return -1; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
59 } |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
60 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
61 @Override |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
62 public double[] getSwitchProbabilities(int bci) { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
63 return null; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
64 } |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
65 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
66 @Override |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
67 public RiExceptionSeen getExceptionSeen(int bci) { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
68 return exceptionSeen; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
69 } |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
70 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
71 @Override |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
72 public int getExecutionCount(int bci) { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
73 return -1; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
74 } |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
75 |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
76 public static RiProfilingInfo get(RiExceptionSeen exceptionSeen) { |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
77 return NO_PROFILING_INFO[exceptionSeen.ordinal()]; |
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
78 } |
5114
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
79 |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
80 @Override |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
81 public int getDeoptimizationCount(RiDeoptReason reason) { |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
82 return 0; |
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
83 } |
5346
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
84 |
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
85 @Override |
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
86 public String toString() { |
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
87 return "BaseProfilingInfo<" + CiUtil.profileToString(this, null, "; ") + ">"; |
4c3d953f8131
added mechanism (enabled by -G:PICache and -G:PiFilter) for saving/loading method profiling info to/from disk
Doug Simon <doug.simon@oracle.com>
parents:
5114
diff
changeset
|
88 } |
5105
95b8a32a7cc3
preparations to avoid endless recompilations because of not updated profiling information
Christian Haeubl <christian.haeubl@oracle.com>
parents:
diff
changeset
|
89 } |