comparison jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/DefaultProfilingInfo.java @ 22672:1bbd4a7c274b

Rename jdk.internal.jvmci to jdk.vm.ci
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 08 Oct 2015 17:28:41 -0700
parents jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/DefaultProfilingInfo.java@41da626860a3
children
comparison
equal deleted inserted replaced
22671:97f30e4d0e95 22672:1bbd4a7c274b
1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package jdk.vm.ci.meta;
24
25 /**
26 * An implementation of {@link ProfilingInfo} that can used in the absence of real profile
27 * information.
28 */
29 public final class DefaultProfilingInfo implements ProfilingInfo {
30
31 private static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[]{new DefaultProfilingInfo(TriState.TRUE), new DefaultProfilingInfo(TriState.FALSE),
32 new DefaultProfilingInfo(TriState.UNKNOWN)};
33
34 private final TriState exceptionSeen;
35
36 DefaultProfilingInfo(TriState exceptionSeen) {
37 this.exceptionSeen = exceptionSeen;
38 }
39
40 @Override
41 public int getCodeSize() {
42 return 0;
43 }
44
45 @Override
46 public JavaTypeProfile getTypeProfile(int bci) {
47 return null;
48 }
49
50 @Override
51 public JavaMethodProfile getMethodProfile(int bci) {
52 return null;
53 }
54
55 @Override
56 public double getBranchTakenProbability(int bci) {
57 return -1;
58 }
59
60 @Override
61 public double[] getSwitchProbabilities(int bci) {
62 return null;
63 }
64
65 @Override
66 public TriState getExceptionSeen(int bci) {
67 return exceptionSeen;
68 }
69
70 @Override
71 public TriState getNullSeen(int bci) {
72 return TriState.UNKNOWN;
73 }
74
75 @Override
76 public int getExecutionCount(int bci) {
77 return -1;
78 }
79
80 public static ProfilingInfo get(TriState exceptionSeen) {
81 return NO_PROFILING_INFO[exceptionSeen.ordinal()];
82 }
83
84 @Override
85 public int getDeoptimizationCount(DeoptimizationReason reason) {
86 return 0;
87 }
88
89 @Override
90 public boolean isMature() {
91 return false;
92 }
93
94 @Override
95 public String toString() {
96 return "DefaultProfilingInfo<" + this.toString(null, "; ") + ">";
97 }
98
99 public void setMature() {
100 // Do nothing
101 }
102
103 public boolean setCompilerIRSize(Class<?> irType, int nodeCount) {
104 return false;
105 }
106
107 public int getCompilerIRSize(Class<?> irType) {
108 return -1;
109 }
110 }