# HG changeset patch # User Doug Simon # Date 1382011514 -7200 # Node ID f04f58c8206bdede4a5fe65a9b667703b7246e72 # Parent 85d03b72f269087eb62758fd0c4c96a70a0ee93b made HSAILCompilationResult subclass CompilationResult diff -r 85d03b72f269 -r f04f58c8206b 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 Oct 17 12:22:27 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Oct 17 14:05:14 2013 +0200 @@ -133,9 +133,9 @@ * argument can be null. * @return the result of the compilation */ - public static CompilationResult compileGraph(final StructuredGraph graph, final CallingConvention cc, final ResolvedJavaMethod installedCodeOwner, final Providers providers, + public static T compileGraph(final StructuredGraph graph, final CallingConvention cc, final ResolvedJavaMethod installedCodeOwner, final Providers providers, final Backend backend, final TargetDescription target, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts, - final SpeculationLog speculationLog, final Suites suites, final CompilationResult compilationResult) { + final SpeculationLog speculationLog, final Suites suites, final T compilationResult) { Debug.scope("GraalCompiler", new Object[]{graph, providers.getCodeCache()}, new Runnable() { public void run() { diff -r 85d03b72f269 -r f04f58c8206b graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java Thu Oct 17 12:22:27 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java Thu Oct 17 14:05:14 2013 +0200 @@ -81,7 +81,7 @@ if (hsailCompResult != null) { hsailCompResult.dumpCompilationResult(); } - return hsailCompResult.getCompilationResult(); + return hsailCompResult; } // Implementations of the CompileAndDispatch interface. diff -r 85d03b72f269 -r f04f58c8206b 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 Thu Oct 17 12:22:27 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILCompilationResult.java Thu Oct 17 14:05:14 2013 +0200 @@ -48,9 +48,10 @@ /** * Class that represents a HSAIL compilation result. Includes the compiled HSAIL code. */ -public class HSAILCompilationResult { +public class HSAILCompilationResult extends CompilationResult { - private CompilationResult compResult; + private static final long serialVersionUID = -4178700465275724625L; + private static final String propPkgName = HSAILCompilationResult.class.getPackage().getName(); private static Level logLevel; private static ConsoleHandler consoleHandler; @@ -139,9 +140,9 @@ CallingConvention cc = getHSAILCallingConvention(Type.JavaCallee, target, graph.method(), false); SuitesProvider suitesProvider = Graal.getRequiredCapability(SuitesProvider.class); try { - CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, graph.method(), providers, backend, target, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog(), - suitesProvider.getDefaultSuites(), new CompilationResult()); - return new HSAILCompilationResult(compResult); + HSAILCompilationResult compResult = GraalCompiler.compileGraph(graph, cc, graph.method(), providers, backend, target, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog(), + suitesProvider.getDefaultSuites(), new HSAILCompilationResult()); + return compResult; } catch (GraalInternalError e) { String partialCode = backend.getPartialCodeString(); if (partialCode != null && !partialCode.equals("")) { @@ -165,20 +166,15 @@ } } - protected HSAILCompilationResult(CompilationResult compResultInput) { - compResult = compResultInput; - } - - public CompilationResult getCompilationResult() { - return compResult; + protected HSAILCompilationResult() { } public String getHSAILCode() { - return new String(compResult.getTargetCode(), 0, compResult.getTargetCodeSize()); + return new String(getTargetCode(), 0, getTargetCodeSize()); } public void dumpCompilationResult() { - logger.fine("targetCodeSize=" + compResult.getTargetCodeSize()); + logger.fine("targetCodeSize=" + getTargetCodeSize()); logger.fine(getHSAILCode()); } diff -r 85d03b72f269 -r f04f58c8206b graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotCodeCacheProvider.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotCodeCacheProvider.java Thu Oct 17 12:22:27 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotCodeCacheProvider.java Thu Oct 17 14:05:14 2013 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.hotspot.hsail; +import java.util.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.*; @@ -35,6 +37,12 @@ } @Override + public String disassemble(CompilationResult compResult, InstalledCode installedCode) { + byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode(); + return new String(code); + } + + @Override protected RegisterConfig createRegisterConfig() { return new HSAILRegisterConfig(); }