# HG changeset patch # User Miguel Garcia # Date 1400246067 -7200 # Node ID 1e3be4d992f381628ef8715a12f36370e7e31ccf # Parent 8344485d71bd7774d545fe8dfe19c17d2210b713 [inlining] tradeoff: "return null" still shorter than "return ...AndReturnNull" diff -r 8344485d71bd -r 1e3be4d992f3 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java Fri May 16 14:57:45 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java Fri May 16 15:14:27 2014 +0200 @@ -177,8 +177,8 @@ return false; } - private static InlineInfo logNotInlinedMethodAndReturnNull(Invoke invoke, int inliningDepth, ResolvedJavaMethod method, String msg) { - return logNotInlinedMethodAndReturnNull(invoke, inliningDepth, method, msg, new Object[0]); + private static void logNotInlinedMethod(Invoke invoke, int inliningDepth, ResolvedJavaMethod method, String msg) { + logNotInlinedMethodAndReturnNull(invoke, inliningDepth, method, msg, new Object[0]); } private static InlineInfo logNotInlinedMethodAndReturnNull(Invoke invoke, int inliningDepth, ResolvedJavaMethod method, String msg, Object... args) { @@ -337,18 +337,21 @@ TypeProfileProxyNode typeProfileProxyNode = (TypeProfileProxyNode) receiver; typeProfile = typeProfileProxyNode.getProfile(); } else { - return logNotInlinedMethodAndReturnNull(invoke, data.inliningDepth(), targetMethod, "no type profile exists"); + logNotInlinedMethod(invoke, data.inliningDepth(), targetMethod, "no type profile exists"); + return null; } ProfiledType[] ptypes = typeProfile.getTypes(); if (ptypes == null || ptypes.length <= 0) { - return logNotInlinedMethodAndReturnNull(invoke, data.inliningDepth(), targetMethod, "no types in profile"); + logNotInlinedMethod(invoke, data.inliningDepth(), targetMethod, "no types in profile"); + return null; } double notRecordedTypeProbability = typeProfile.getNotRecordedProbability(); if (ptypes.length == 1 && notRecordedTypeProbability == 0) { if (!optimisticOpts.inlineMonomorphicCalls()) { - return logNotInlinedMethodAndReturnNull(invoke, data.inliningDepth(), targetMethod, "inlining monomorphic calls is disabled"); + logNotInlinedMethod(invoke, data.inliningDepth(), targetMethod, "inlining monomorphic calls is disabled"); + return null; } ResolvedJavaType type = ptypes[0].getType(); @@ -377,7 +380,8 @@ for (int i = 0; i < ptypes.length; i++) { ResolvedJavaMethod concrete = ptypes[i].getType().resolveMethod(targetMethod); if (concrete == null) { - return logNotInlinedMethodAndReturnNull(invoke, data.inliningDepth(), targetMethod, "could not resolve method"); + logNotInlinedMethod(invoke, data.inliningDepth(), targetMethod, "could not resolve method"); + return null; } int index = concreteMethods.indexOf(concrete); double curProbability = ptypes[i].getProbability(); @@ -437,7 +441,8 @@ for (ResolvedJavaMethod concrete : concreteMethods) { if (!checkTargetConditions(data, replacements, invoke, concrete, optimisticOpts)) { - return logNotInlinedMethodAndReturnNull(invoke, data.inliningDepth(), targetMethod, "it is a polymorphic method call and at least one invoked method cannot be inlined"); + logNotInlinedMethod(invoke, data.inliningDepth(), targetMethod, "it is a polymorphic method call and at least one invoked method cannot be inlined"); + return null; } } return new MultiTypeGuardInlineInfo(invoke, concreteMethods, concreteMethodsProbabilities, usedTypes, typesToConcretes, notRecordedTypeProbability); @@ -496,7 +501,7 @@ if (failureMessage == null) { return true; } else { - logNotInlinedMethodAndReturnNull(invoke, data.inliningDepth(), method, failureMessage); + logNotInlinedMethod(invoke, data.inliningDepth(), method, failureMessage); return false; } }