# HG changeset patch # User Thomas Wuerthinger # Date 1361485487 28800 # Node ID a063308816d9deb88e3c6d98d3c0943a690db163 # Parent 46005f68fc6c929cf093c3d405de96a67fcc7b45 Complete first PTX unit test. diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Thu Feb 21 14:24:47 2013 -0800 @@ -60,10 +60,8 @@ /** * Gets the register configuration to use when compiling a given method. - * - * @param method the top level method of a compilation */ - RegisterConfig lookupRegisterConfig(ResolvedJavaMethod method); + RegisterConfig lookupRegisterConfig(); /** * Custom area on the stack of each compiled method that the VM can use for its own purposes. diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java Thu Feb 21 14:24:47 2013 -0800 @@ -322,7 +322,7 @@ argTypes[i] = sig.getParameterType(i, null); } - RegisterConfig registerConfig = codeCache.lookupRegisterConfig(method); + RegisterConfig registerConfig = codeCache.lookupRegisterConfig(); return registerConfig.getCallingConvention(type, retType, argTypes, codeCache.getTarget(), stackOnly); } } diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java Thu Feb 21 14:24:47 2013 -0800 @@ -87,18 +87,7 @@ */ public final int implicitNullCheckLimit; - /** - * Specifies how {@code long} and {@code double} constants are to be stored in - * {@linkplain BytecodeFrame frames}. This is useful for VMs such as HotSpot where convention - * the interpreter uses is that the second local holds the first raw word of the native long or - * double representation. This is actually reasonable, since locals and stack arrays grow - * downwards in all implementations. If, on some machine, the interpreter's Java locals or stack - * were to grow upwards, the embedded doubles would be word-swapped.) - */ - public final boolean debugInfoDoubleWordsInSecondSlot; - - public TargetDescription(Architecture arch, boolean isMP, int stackAlignment, int stackBias, int implicitNullCheckLimit, int pageSize, int cacheAlignment, boolean inlineObjects, - boolean debugInfoDoubleWordsInSecondSlot) { + public TargetDescription(Architecture arch, boolean isMP, int stackAlignment, int stackBias, int implicitNullCheckLimit, int pageSize, int cacheAlignment, boolean inlineObjects) { this.arch = arch; this.pageSize = pageSize; this.isMP = isMP; @@ -109,7 +98,6 @@ this.implicitNullCheckLimit = implicitNullCheckLimit; this.cacheAlignment = cacheAlignment; this.inlineObjects = inlineObjects; - this.debugInfoDoubleWordsInSecondSlot = debugInfoDoubleWordsInSecondSlot; } /** diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java --- a/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Thu Feb 21 14:24:47 2013 -0800 @@ -47,7 +47,7 @@ protected InstalledCode assembleMethod(Method m, CodeGenTest test) { ResolvedJavaMethod method = codeCache.lookupJavaMethod(m); - RegisterConfig registerConfig = codeCache.lookupRegisterConfig(method); + RegisterConfig registerConfig = codeCache.lookupRegisterConfig(); CallingConvention cc = CodeUtil.getCallingConvention(codeCache, CallingConvention.Type.JavaCallee, method, false); CompilationResult compResult = new CompilationResult(); diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java Thu Feb 21 14:24:47 2013 -0800 @@ -24,9 +24,17 @@ import org.junit.*; +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.runtime.*; +import com.oracle.graal.compiler.*; +import com.oracle.graal.compiler.ptx.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.debug.*; +import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.phases.*; +import com.oracle.graal.phases.PhasePlan.*; +import com.oracle.graal.ptx.*; /** * Test class for small Java methods compiled to PTX kernels. @@ -46,5 +54,12 @@ private void test(String snippet) { StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); + TargetDescription target = new TargetDescription(new PTX(), true, 1, 0, 0, 0, 0, true); + PTXBackend ptxBackend = new PTXBackend(Graal.getRequiredCapability(CodeCacheProvider.class), target); + PhasePlan phasePlan = new PhasePlan(); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); + phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); + CompilationResult result = GraalCompiler.compileMethod(runtime, ptxBackend, target, graph.method(), graph, null, phasePlan, OptimisticOptimizations.NONE); + System.out.println("result=" + result); } } diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Feb 21 14:24:47 2013 -0800 @@ -51,7 +51,7 @@ final StructuredGraph graph, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) { assert (method.getModifiers() & Modifier.NATIVE) == 0 : "compiling native methods is not supported"; - return Debug.scope("GraalCompiler", new Object[]{graph, method, this}, new Callable() { + return Debug.scope("GraalCompiler", new Object[]{graph, method}, new Callable() { public CompilationResult call() { final Assumptions assumptions = new Assumptions(GraalOptions.OptAssumptions); @@ -64,7 +64,7 @@ final FrameMap frameMap = Debug.scope("BackEnd", lir, new Callable() { public FrameMap call() { - return emitLIR(runtime, backend, target, lir, graph, method); + return emitLIR(backend, target, lir, graph, method); } }); return Debug.scope("CodeGen", frameMap, new Callable() { @@ -225,8 +225,8 @@ } - public static FrameMap emitLIR(GraalCodeCacheProvider runtime, Backend backend, final TargetDescription target, final LIR lir, StructuredGraph graph, final ResolvedJavaMethod method) { - final FrameMap frameMap = backend.newFrameMap(runtime.lookupRegisterConfig(method)); + public static FrameMap emitLIR(Backend backend, final TargetDescription target, final LIR lir, StructuredGraph graph, final ResolvedJavaMethod method) { + final FrameMap frameMap = backend.newFrameMap(); final LIRGenerator lirGenerator = backend.newLIRGenerator(graph, frameMap, method, lir); Debug.scope("LIRGen", lirGenerator, new Runnable() { diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Thu Feb 21 14:24:47 2013 -0800 @@ -46,8 +46,8 @@ return runtime; } - public FrameMap newFrameMap(RegisterConfig registerConfig) { - return new FrameMap(runtime, target, registerConfig); + public FrameMap newFrameMap() { + return new FrameMap(runtime, target, runtime.lookupRegisterConfig()); } public abstract LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, ResolvedJavaMethod method, LIR lir); diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime.java Thu Feb 21 14:24:47 2013 -0800 @@ -51,7 +51,7 @@ final int stackFrameAlignment = 16; final int stackBias = 0; final int implicitNullCheckLimit = 4096; - return new TargetDescription(new AMD64(), true, stackFrameAlignment, stackBias, implicitNullCheckLimit, config.vmPageSize, wordSize, true, true); + return new TargetDescription(new AMD64(), true, stackFrameAlignment, stackBias, implicitNullCheckLimit, config.vmPageSize, wordSize, true); } @Override diff -r 46005f68fc6c -r a063308816d9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu Feb 21 13:43:40 2013 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu Feb 21 14:24:47 2013 -0800 @@ -505,7 +505,7 @@ } @Override - public RegisterConfig lookupRegisterConfig(ResolvedJavaMethod method) { + public RegisterConfig lookupRegisterConfig() { return regConfig; } diff -r 46005f68fc6c -r a063308816d9 mx/projects --- a/mx/projects Thu Feb 21 13:43:40 2013 -0800 +++ b/mx/projects Thu Feb 21 14:24:47 2013 -0800 @@ -245,7 +245,7 @@ # graal.compiler.ptx.test project@com.oracle.graal.compiler.ptx.test@subDir=graal project@com.oracle.graal.compiler.ptx.test@sourceDirs=src -project@com.oracle.graal.compiler.ptx.test@dependencies=com.oracle.graal.compiler.ptx,com.oracle.graal.compiler.test +project@com.oracle.graal.compiler.ptx.test@dependencies=com.oracle.graal.compiler.ptx,com.oracle.graal.compiler.test,com.oracle.graal.ptx project@com.oracle.graal.compiler.ptx.test@checkstyle=com.oracle.graal.graph project@com.oracle.graal.compiler.ptx.test@javaCompliance=1.7