comparison graal/com.oracle.max.criutils/src/com/oracle/max/criutils/SnapshotProfilingInfo.java @ 5507:dc71b06d09f8

Moving classes from cri.ri to api.meta.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 07 Jun 2012 18:24:06 +0200
parents 56860d3f9f39
children 426c605c9d3c
comparison
equal deleted inserted replaced
5506:56860d3f9f39 5507:dc71b06d09f8
22 */ 22 */
23 package com.oracle.max.criutils; 23 package com.oracle.max.criutils;
24 24
25 import java.io.*; 25 import java.io.*;
26 26
27 import com.oracle.graal.api.meta.*;
27 import com.oracle.max.cri.ci.*; 28 import com.oracle.max.cri.ci.*;
28 import com.oracle.max.cri.ri.*; 29 import com.oracle.max.cri.ri.*;
29 30
30 /** 31 /**
31 * A profiling info snapshot that can be {@linkplain #save(File, File) saved} to 32 * A profiling info snapshot that can be {@linkplain #save(File, File) saved} to
46 branchTaken = new double[codeSize]; 47 branchTaken = new double[codeSize];
47 switches = new double[codeSize][]; 48 switches = new double[codeSize][];
48 typeProfiles = new RiTypeProfile[codeSize]; 49 typeProfiles = new RiTypeProfile[codeSize];
49 exceptions = new RiExceptionSeen[codeSize]; 50 exceptions = new RiExceptionSeen[codeSize];
50 executions = new int[codeSize]; 51 executions = new int[codeSize];
51 deopts = new int[CiDeoptReason.values().length]; 52 deopts = new int[RiDeoptReason.values().length];
52 53
53 for (int bci = 0; bci < codeSize; bci++) { 54 for (int bci = 0; bci < codeSize; bci++) {
54 executions[bci] = other.getExecutionCount(bci); 55 executions[bci] = other.getExecutionCount(bci);
55 exceptions[bci] = other.getExceptionSeen(bci); 56 exceptions[bci] = other.getExceptionSeen(bci);
56 branchTaken[bci] = other.getBranchTakenProbability(bci); 57 branchTaken[bci] = other.getBranchTakenProbability(bci);
57 switches[bci] = other.getSwitchProbabilities(bci); 58 switches[bci] = other.getSwitchProbabilities(bci);
58 typeProfiles[bci] = other.getTypeProfile(bci); 59 typeProfiles[bci] = other.getTypeProfile(bci);
59 } 60 }
60 for (CiDeoptReason reason: CiDeoptReason.values()) { 61 for (RiDeoptReason reason: RiDeoptReason.values()) {
61 deopts[reason.ordinal()] = other.getDeoptimizationCount(reason); 62 deopts[reason.ordinal()] = other.getDeoptimizationCount(reason);
62 } 63 }
63 } 64 }
64 65
65 @Override 66 @Override
80 return bci < exceptions.length ? exceptions[bci] : RiExceptionSeen.NOT_SUPPORTED; 81 return bci < exceptions.length ? exceptions[bci] : RiExceptionSeen.NOT_SUPPORTED;
81 } 82 }
82 public int getExecutionCount(int bci) { 83 public int getExecutionCount(int bci) {
83 return bci < executions.length ? executions[bci] : -1; 84 return bci < executions.length ? executions[bci] : -1;
84 } 85 }
85 public int getDeoptimizationCount(CiDeoptReason reason) { 86 public int getDeoptimizationCount(RiDeoptReason reason) {
86 return deopts[reason.ordinal()]; 87 return deopts[reason.ordinal()];
87 } 88 }
88 89
89 @Override 90 @Override
90 public String toString() { 91 public String toString() {