# HG changeset patch # User Christian Haeubl # Date 1364377017 -3600 # Node ID 5407d1dd64505ee50ebd7fab7253aeebdb81f31b # Parent 9f9aaa65294ee985745a13109a2e00837b9d0928 API to access nullness profiling information for instanceof, checkcast, and aastore increased maximum interpreter code size to support Java debugging on Windows diff -r 9f9aaa65294e -r 5407d1dd6450 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java Tue Mar 26 15:35:20 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java Wed Mar 27 10:36:57 2013 +0100 @@ -28,12 +28,12 @@ */ 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 static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[]{new DefaultProfilingInfo(TriState.TRUE), new DefaultProfilingInfo(TriState.FALSE), + new DefaultProfilingInfo(TriState.UNKNOWN)}; - private final ExceptionSeen exceptionSeen; + private final TriState exceptionSeen; - DefaultProfilingInfo(ExceptionSeen exceptionSeen) { + DefaultProfilingInfo(TriState exceptionSeen) { this.exceptionSeen = exceptionSeen; } @@ -58,16 +58,21 @@ } @Override - public ExceptionSeen getExceptionSeen(int bci) { + public TriState getExceptionSeen(int bci) { return exceptionSeen; } @Override + public TriState getNullSeen(int bci) { + return TriState.UNKNOWN; + } + + @Override public int getExecutionCount(int bci) { return -1; } - public static ProfilingInfo get(ExceptionSeen exceptionSeen) { + public static ProfilingInfo get(TriState exceptionSeen) { return NO_PROFILING_INFO[exceptionSeen.ordinal()]; } diff -r 9f9aaa65294e -r 5407d1dd6450 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Tue Mar 26 15:35:20 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Wed Mar 27 10:36:57 2013 +0100 @@ -29,7 +29,7 @@ import java.util.*; import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; -import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; +import com.oracle.graal.api.meta.ProfilingInfo.TriState; /** * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.meta} and its @@ -567,10 +567,14 @@ buf.append(sep); } - if (info.getExceptionSeen(i) != ExceptionSeen.FALSE) { + if (info.getExceptionSeen(i) == TriState.TRUE) { buf.append(String.format("exceptionSeen@%d: %s%s", i, info.getExceptionSeen(i).name(), sep)); } + if (info.getNullSeen(i) == TriState.TRUE) { + buf.append(String.format("nullSeen@%d: %s%s", i, info.getNullSeen(i).name(), sep)); + } + JavaTypeProfile typeProfile = info.getTypeProfile(i); if (typeProfile != null) { ProfiledType[] ptypes = typeProfile.getTypes(); diff -r 9f9aaa65294e -r 5407d1dd6450 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java Tue Mar 26 15:35:20 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java Wed Mar 27 10:36:57 2013 +0100 @@ -33,10 +33,10 @@ /** * Represents the three possibilities that an exception was seen at a specific BCI. */ - public enum ExceptionSeen { - TRUE, FALSE, NOT_SUPPORTED; + public enum TriState { + TRUE, FALSE, UNKNOWN; - public static ExceptionSeen get(boolean value) { + public static TriState get(boolean value) { return value ? TRUE : FALSE; } } @@ -73,11 +73,20 @@ /** * Returns information if the given BCI did ever throw an exception. * - * @return {@link ExceptionSeen#TRUE} if the instruction has thrown an exception at least once, - * {@link ExceptionSeen#FALSE} if it never threw an exception, and - * {@link ExceptionSeen#NOT_SUPPORTED} if this information was not recorded. + * @return {@link TriState#TRUE} if the instruction has thrown an exception at least once, + * {@link TriState#FALSE} if it never threw an exception, and + * {@link TriState#UNKNOWN} if this information was not recorded. */ - ExceptionSeen getExceptionSeen(int bci); + TriState getExceptionSeen(int bci); + + /** + * Returns information if null was ever seen for the given BCI. + * + * @return {@link TriState#TRUE} if null was seen for the instruction, + * {@link TriState#FALSE} if null was NOT seen, and + * {@link TriState#UNKNOWN} if this information was not recorded. + */ + TriState getNullSeen(int bci); /** * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts diff -r 9f9aaa65294e -r 5407d1dd6450 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Tue Mar 26 15:35:20 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Wed Mar 27 10:36:57 2013 +0100 @@ -29,7 +29,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; -import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; +import com.oracle.graal.api.meta.ProfilingInfo.TriState; import com.oracle.graal.hotspot.*; import com.oracle.graal.phases.*; @@ -41,8 +41,8 @@ private static final long serialVersionUID = -8873133496591225071L; private static final HotSpotVMConfig config = HotSpotGraalRuntime.getInstance().getConfig(); - private static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(ExceptionSeen.FALSE); - private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(ExceptionSeen.NOT_SUPPORTED); + private static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(TriState.FALSE); + private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(TriState.UNKNOWN); // sorted by tag private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {null, new BitData(), new CounterData(), new JumpData(), new TypeCheckData(), new VirtualCallData(), new RetData(), @@ -194,8 +194,8 @@ } @Override - public ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position) { - return ExceptionSeen.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0); + public TriState getExceptionSeen(HotSpotMethodData data, int position) { + return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0); } @Override @@ -218,6 +218,11 @@ return -1; } + @Override + public TriState getNullSeen(HotSpotMethodData data, int position) { + return TriState.UNKNOWN; + } + protected int getFlags(HotSpotMethodData data, int position) { return data.readUnsignedByte(position, config.dataLayoutFlagsOffset); } @@ -232,9 +237,9 @@ private static final int NO_DATA_TAG = 0; private static final int NO_DATA_SIZE = cellIndexToOffset(0); - private final ExceptionSeen exceptionSeen; + private final TriState exceptionSeen; - protected NoMethodData(ExceptionSeen exceptionSeen) { + protected NoMethodData(TriState exceptionSeen) { super(NO_DATA_TAG, NO_DATA_SIZE); this.exceptionSeen = exceptionSeen; } @@ -245,7 +250,7 @@ } @Override - public ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position) { + public TriState getExceptionSeen(HotSpotMethodData data, int position) { return exceptionSeen; } } @@ -264,9 +269,9 @@ super(tag, staticSize); } - @SuppressWarnings("unused") - public boolean getNullSeen(HotSpotMethodData data, int position) { - return (getFlags(data, position) & BIT_DATA_NULL_SEEN_FLAG) != 0; + @Override + public TriState getNullSeen(HotSpotMethodData data, int position) { + return TriState.get((getFlags(data, position) & BIT_DATA_NULL_SEEN_FLAG) != 0); } } diff -r 9f9aaa65294e -r 5407d1dd6450 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java Tue Mar 26 15:35:20 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java Wed Mar 27 10:36:57 2013 +0100 @@ -23,7 +23,7 @@ package com.oracle.graal.hotspot.meta; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; +import com.oracle.graal.api.meta.ProfilingInfo.TriState; /** * Interface for accessor objects that encapsulate the logic for accessing the different kinds of @@ -59,7 +59,9 @@ double[] getSwitchProbabilities(HotSpotMethodData data, int position); - ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position); + TriState getExceptionSeen(HotSpotMethodData data, int position); + + TriState getNullSeen(HotSpotMethodData data, int position); int getExecutionCount(HotSpotMethodData data, int position); } diff -r 9f9aaa65294e -r 5407d1dd6450 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java Tue Mar 26 15:35:20 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java Wed Mar 27 10:36:57 2013 +0100 @@ -69,12 +69,18 @@ } @Override - public ExceptionSeen getExceptionSeen(int bci) { + public TriState getExceptionSeen(int bci) { findBCI(bci, true); return dataAccessor.getExceptionSeen(methodData, position); } @Override + public TriState getNullSeen(int bci) { + findBCI(bci, false); + return dataAccessor.getNullSeen(methodData, position); + } + + @Override public int getExecutionCount(int bci) { findBCI(bci, false); return dataAccessor.getExecutionCount(methodData, position); diff -r 9f9aaa65294e -r 5407d1dd6450 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 Tue Mar 26 15:35:20 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Wed Mar 27 10:36:57 2013 +0100 @@ -32,7 +32,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; +import com.oracle.graal.api.meta.ProfilingInfo.TriState; import com.oracle.graal.bytecode.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.debug.*; @@ -223,7 +223,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 = DefaultProfilingInfo.get(ExceptionSeen.FALSE); + info = DefaultProfilingInfo.get(TriState.FALSE); } else { info = new HotSpotProfilingInfo(methodData, codeSize); } diff -r 9f9aaa65294e -r 5407d1dd6450 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Mar 26 15:35:20 2013 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed Mar 27 10:36:57 2013 +0100 @@ -34,7 +34,7 @@ import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; import com.oracle.graal.api.meta.*; import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; -import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; +import com.oracle.graal.api.meta.ProfilingInfo.TriState; import com.oracle.graal.api.meta.ResolvedJavaType.Representation; import com.oracle.graal.bytecode.*; import com.oracle.graal.debug.*; @@ -959,7 +959,7 @@ protected void emitExplicitExceptions(ValueNode receiver, ValueNode outOfBoundsIndex) { assert receiver != null; - if (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == ExceptionSeen.FALSE) { + if (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE) { return; } @@ -1122,7 +1122,7 @@ protected Invoke createInvokeNode(MethodCallTargetNode callTarget, Kind resultType) { // be conservative if information was not recorded (could result in endless recompiles // otherwise) - if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == ExceptionSeen.FALSE)) { + if (graphBuilderConfig.omitAllExceptionEdges() || (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE)) { InvokeNode invoke = new InvokeNode(callTarget, bci()); ValueNode result = appendWithBCI(currentGraph.add(invoke)); frameState.pushReturn(resultType, result); diff -r 9f9aaa65294e -r 5407d1dd6450 src/cpu/x86/vm/templateInterpreter_x86.hpp --- a/src/cpu/x86/vm/templateInterpreter_x86.hpp Tue Mar 26 15:35:20 2013 +0100 +++ b/src/cpu/x86/vm/templateInterpreter_x86.hpp Wed Mar 27 10:36:57 2013 +0100 @@ -34,7 +34,7 @@ // Run with +PrintInterpreter to get the VM to print out the size. // Max size with JVMTI #ifdef AMD64 - const static int InterpreterCodeSize = 220 * 1024; + const static int InterpreterCodeSize = 240 * 1024; #else const static int InterpreterCodeSize = 168 * 1024; #endif // AMD64