# HG changeset patch # User Doug Simon # Date 1340883909 -7200 # Node ID 0b517fac113ec90eaffad987d646fee869b1086b # Parent 46ad94a0574a93222235dd6bb108e9ed2b0fe568 renamed BaseProfilingInfo to DefaultProfilingInfo and moved it to com.oracle.graal.api.meta diff -r 46ad94a0574a -r 0b517fac113e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java Thu Jun 28 13:45:09 2012 +0200 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.api.meta; + + +/** + * An implementation of {@link ProfilingInfo} that can used in the absence of real profile information. + */ +public final class DefaultProfilingInfo implements ProfilingInfo { + private static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[] { + new DefaultProfilingInfo(ExceptionSeen.TRUE), + new DefaultProfilingInfo(ExceptionSeen.FALSE), + new DefaultProfilingInfo(ExceptionSeen.NOT_SUPPORTED) + }; + + private final ExceptionSeen exceptionSeen; + + DefaultProfilingInfo(ExceptionSeen exceptionSeen) { + this.exceptionSeen = exceptionSeen; + } + + @Override + public int codeSize() { + return 0; + } + + @Override + public JavaTypeProfile getTypeProfile(int bci) { + return null; + } + + @Override + public double getBranchTakenProbability(int bci) { + return -1; + } + + @Override + public double[] getSwitchProbabilities(int bci) { + return null; + } + + @Override + public ExceptionSeen getExceptionSeen(int bci) { + return exceptionSeen; + } + + @Override + public int getExecutionCount(int bci) { + return -1; + } + + public static ProfilingInfo get(ExceptionSeen exceptionSeen) { + return NO_PROFILING_INFO[exceptionSeen.ordinal()]; + } + + @Override + public int getDeoptimizationCount(DeoptimizationReason reason) { + return 0; + } + + @Override + public String toString() { + return "BaseProfilingInfo<" + MetaUtil.profileToString(this, null, "; ") + ">"; + } +} diff -r 46ad94a0574a -r 0b517fac113e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Thu Jun 28 13:39:40 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Thu Jun 28 13:45:09 2012 +0200 @@ -260,7 +260,7 @@ if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) { // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in case of a deoptimization. - info = BaseProfilingInfo.get(ExceptionSeen.FALSE); + info = DefaultProfilingInfo.get(ExceptionSeen.FALSE); } else { info = new HotSpotProfilingInfo(methodData, codeSize); saveProfilingInfo(info); diff -r 46ad94a0574a -r 0b517fac113e graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java --- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java Thu Jun 28 13:39:40 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.criutils; - -import com.oracle.graal.api.meta.*; - - -/** - * Dummy profiling information in case that a method was not executed frequently enough so that - * no profiling information does exist yet, or in case that the profiling information should not be used. - */ -public final class BaseProfilingInfo implements ProfilingInfo { - private static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[] { - new BaseProfilingInfo(ExceptionSeen.TRUE), - new BaseProfilingInfo(ExceptionSeen.FALSE), - new BaseProfilingInfo(ExceptionSeen.NOT_SUPPORTED) - }; - - private final ExceptionSeen exceptionSeen; - - BaseProfilingInfo(ExceptionSeen exceptionSeen) { - this.exceptionSeen = exceptionSeen; - } - - @Override - public int codeSize() { - return 0; - } - - @Override - public JavaTypeProfile getTypeProfile(int bci) { - return null; - } - - @Override - public double getBranchTakenProbability(int bci) { - return -1; - } - - @Override - public double[] getSwitchProbabilities(int bci) { - return null; - } - - @Override - public ExceptionSeen getExceptionSeen(int bci) { - return exceptionSeen; - } - - @Override - public int getExecutionCount(int bci) { - return -1; - } - - public static ProfilingInfo get(ExceptionSeen exceptionSeen) { - return NO_PROFILING_INFO[exceptionSeen.ordinal()]; - } - - @Override - public int getDeoptimizationCount(DeoptimizationReason reason) { - return 0; - } - - @Override - public String toString() { - return "BaseProfilingInfo<" + MetaUtil.profileToString(this, null, "; ") + ">"; - } -}