# HG changeset patch # User Doug Simon # Date 1390520036 -3600 # Node ID b9c5875e3a36a1e25927b9682dac2d6fc5afb2a8 # Parent 3424bc098ca083eebabf185ac47b5dc0f692be0a# Parent 64fa703198908c030edb114c79c38cda2314062c Merge. diff -r 64fa70319890 -r b9c5875e3a36 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILCompilationResult.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILCompilationResult.java Wed Jan 22 21:34:00 2014 -0800 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILCompilationResult.java Fri Jan 24 00:33:56 2014 +0100 @@ -96,33 +96,6 @@ return getHSAILCompilationResult(graph); } - /** - * HSAIL doesn't have a calling convention as such. Function arguments are actually passed in - * memory but then loaded into registers in the function body. This routine makes sure that - * arguments to a kernel or function are loaded (by the kernel or function body) into registers - * of the appropriate sizes. For example, int and float parameters should appear in S registers, - * whereas double and long parameters should appear in d registers. - */ - public static CallingConvention getHSAILCallingConvention(CallingConvention.Type type, TargetDescription target, ResolvedJavaMethod method, boolean stackOnly) { - Signature sig = method.getSignature(); - JavaType retType = sig.getReturnType(null); - int sigCount = sig.getParameterCount(false); - JavaType[] argTypes; - int argIndex = 0; - if (!Modifier.isStatic(method.getModifiers())) { - argTypes = new JavaType[sigCount + 1]; - argTypes[argIndex++] = method.getDeclaringClass(); - } else { - argTypes = new JavaType[sigCount]; - } - for (int i = 0; i < sigCount; i++) { - argTypes[argIndex++] = sig.getParameterType(i, null); - } - - RegisterConfig registerConfig = backend.getProviders().getCodeCache().getRegisterConfig(); - return registerConfig.getCallingConvention(type, retType, argTypes, target, stackOnly); - } - public static HSAILCompilationResult getCompiledLambda(Class consumerClass) { /** * Find the accept() method in the IntConsumer, then use Graal API to find the target lambda @@ -168,7 +141,7 @@ PhaseSuite graphBuilderSuite = backend.getSuites().getDefaultGraphBuilderSuite().copy(); graphBuilderSuite.appendPhase(new HSAILPhase()); new HSAILPhase().apply(graph); - CallingConvention cc = getHSAILCallingConvention(Type.JavaCallee, target, graph.method(), false); + CallingConvention cc = CodeUtil.getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); SuitesProvider suitesProvider = backend.getSuites(); try { HSAILCompilationResult compResult = compileGraph(graph, cc, graph.method(), providers, backend, target, null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph),