comparison graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java @ 5105:95b8a32a7cc3

preparations to avoid endless recompilations because of not updated profiling information
author Christian Haeubl <christian.haeubl@oracle.com>
date Mon, 12 Mar 2012 18:40:05 -0700
parents
children dad1ac9dba7d
comparison
equal deleted inserted replaced
5068:6e7c1fb1980f 5105:95b8a32a7cc3
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 com.oracle.max.criutils;
24
25 import com.oracle.max.cri.ri.*;
26
27
28 /**
29 * Dummy profiling information in case that a method was not executed frequently enough so that
30 * no profiling information does exist yet, or in case that the profiling information should not be used.
31 */
32 public final class BaseProfilingInfo implements RiProfilingInfo {
33 private static final RiProfilingInfo[] NO_PROFILING_INFO = new RiProfilingInfo[] {
34 new BaseProfilingInfo(RiExceptionSeen.TRUE),
35 new BaseProfilingInfo(RiExceptionSeen.FALSE),
36 new BaseProfilingInfo(RiExceptionSeen.NOT_SUPPORTED)
37 };
38
39 private final RiExceptionSeen exceptionSeen;
40
41 BaseProfilingInfo(RiExceptionSeen exceptionSeen) {
42 this.exceptionSeen = exceptionSeen;
43 }
44
45 @Override
46 public RiTypeProfile getTypeProfile(int bci) {
47 return null;
48 }
49
50 @Override
51 public double getBranchTakenProbability(int bci) {
52 return -1;
53 }
54
55 @Override
56 public double[] getSwitchProbabilities(int bci) {
57 return null;
58 }
59
60 @Override
61 public RiExceptionSeen getExceptionSeen(int bci) {
62 return exceptionSeen;
63 }
64
65 @Override
66 public int getExecutionCount(int bci) {
67 return -1;
68 }
69
70 public static RiProfilingInfo get(RiExceptionSeen exceptionSeen) {
71 return NO_PROFILING_INFO[exceptionSeen.ordinal()];
72 }
73 }