# HG changeset patch # User Doug Simon # Date 1394741817 -3600 # Node ID 41ecd18552b2231bf5e5eadfb68ac379bbeae96c # Parent 756029dab703a2d7646a695d08ea0b4462abda3b# Parent 469e04960daa6fdc6790b3fd30a4c2f28fb8178b Merge. diff -r 756029dab703 -r 41ecd18552b2 graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Thu Mar 13 21:15:46 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Thu Mar 13 21:16:57 2014 +0100 @@ -41,7 +41,6 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.HotSpotReplacementsImpl.GraphProducer; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.LIRInstruction.OperandFlag; @@ -165,30 +164,6 @@ return deviceInitialized; } - @Override - public GraphProducer getGraphProducer() { - if (!deviceInitialized) { - // GPU could not be initialized so offload is disabled - return null; - } - return new GraphProducer() { - - public StructuredGraph getGraphFor(ResolvedJavaMethod method) { - if (canOffloadToGPU(method)) { - ExternalCompilationResult ptxCode = PTXHotSpotBackend.this.compileKernel(method, true); - HotSpotNmethod installedPTXCode = PTXHotSpotBackend.this.installKernel(method, ptxCode); - return new PTXWrapperBuilder(method, installedPTXCode, getRuntime().getHostBackend().getProviders()).getGraph(); - } - return null; - } - - private boolean canOffloadToGPU(ResolvedJavaMethod method) { - HotSpotVMConfig config = getRuntime().getConfig(); - return config.gpuOffload && method.getName().contains("lambda$") && method.isSynthetic(); - } - }; - } - /** * Compiles a given method to PTX code. * diff -r 756029dab703 -r 41ecd18552b2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Thu Mar 13 21:15:46 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Thu Mar 13 21:16:57 2014 +0100 @@ -27,13 +27,13 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.target.*; -import com.oracle.graal.hotspot.HotSpotReplacementsImpl.GraphProducer; import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.stubs.*; import com.oracle.graal.lir.*; -import com.oracle.graal.lir.LIRInstruction.*; -import com.oracle.graal.lir.StandardOp.*; +import com.oracle.graal.lir.LIRInstruction.ValueProcedure; +import com.oracle.graal.lir.StandardOp.LabelOp; +import com.oracle.graal.lir.StandardOp.SaveRegistersOp; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.phases.tiers.*; @@ -95,14 +95,6 @@ } /** - * Gets the graph producer provided by this backend (if any). A primary use case for this is a - * GPU backend that may want to offload certain methods to the GPU. - */ - public GraphProducer getGraphProducer() { - return null; - } - - /** * Finds all the registers that are defined by some given LIR. * * @param lir the LIR to examine diff -r 756029dab703 -r 41ecd18552b2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Thu Mar 13 21:15:46 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Thu Mar 13 21:16:57 2014 +0100 @@ -26,12 +26,10 @@ import java.util.*; -import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; -import com.oracle.graal.hotspot.HotSpotReplacementsImpl.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.spi.*; @@ -60,8 +58,6 @@ lowerer.initialize(providers, config); HotSpotReplacementsImpl replacements = (HotSpotReplacementsImpl) providers.getReplacements(); - replacements.registerGraphProducers(getNonHostGraphProducers()); - // Install intrinsics. if (Intrinsify.getValue()) { try (Scope s = Debug.scope("RegisterReplacements", new DebugDumpScope("RegisterReplacements"))) { @@ -81,26 +77,4 @@ } } - - /** - * Gets the {@link GraphProducer}s from the non-host backends. These allow a GPU backend (for - * example) to offload compilation and execution of certain methods to a GPU. - *

- * Note that is is a very rough initial attempt at providing a hook for a GPU backend to - * intercept a compilation (or method inlining) for the purpose of routing execution to the GPU. - * Expect it to be extensively refined as experimentation with GPU offload proceeds. - */ - protected GraphProducer[] getNonHostGraphProducers() { - List list = new ArrayList<>(); - for (Map.Entry, HotSpotBackend> e : getRuntime().getBackends().entrySet()) { - HotSpotBackend value = e.getValue(); - if (value != this) { - GraphProducer gp = value.getGraphProducer(); - if (gp != null) { - list.add(gp); - } - } - } - return list.toArray(new GraphProducer[list.size()]); - } } diff -r 756029dab703 -r 41ecd18552b2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Thu Mar 13 21:15:46 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Thu Mar 13 21:16:57 2014 +0100 @@ -80,41 +80,6 @@ return super.registerMethodSubstitution(originalMethod, substituteMethod); } - /** - * A producer of graphs for methods. - */ - public interface GraphProducer { - - /** - * @returns a graph for {@code method} or null - */ - StructuredGraph getGraphFor(ResolvedJavaMethod method); - } - - /** - * Registers the graph producers that will take precedence over the registered method - * substitutions when {@link #getMethodSubstitution(ResolvedJavaMethod)} is called. - */ - public void registerGraphProducers(GraphProducer[] producers) { - assert this.graphProducers == UNINITIALIZED : "graph producers must be registered at most once"; - this.graphProducers = producers.clone(); - } - - private static GraphProducer[] UNINITIALIZED = {}; - - private GraphProducer[] graphProducers = UNINITIALIZED; - - @Override - public StructuredGraph getMethodSubstitution(ResolvedJavaMethod original) { - for (GraphProducer gp : graphProducers) { - StructuredGraph graph = gp.getGraphFor(original); - if (graph != null) { - return graph; - } - } - return super.getMethodSubstitution(original); - } - @Override public Class getMacroSubstitution(ResolvedJavaMethod method) { HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method; diff -r 756029dab703 -r 41ecd18552b2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Thu Mar 13 21:15:46 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Thu Mar 13 21:16:57 2014 +0100 @@ -72,11 +72,11 @@ if (this == obj) { return true; } - if (obj == null || !(obj instanceof HotSpotUnresolvedField)) { - return false; + if (obj instanceof HotSpotResolvedJavaField) { + HotSpotResolvedJavaField that = (HotSpotResolvedJavaField) obj; + return this.holder.equals(that.holder) && this.name.equals(that.name) && this.type.equals(that.type); } - HotSpotResolvedJavaField that = (HotSpotResolvedJavaField) obj; - return this.holder.equals(that.holder) && this.name.equals(that.name) && this.type.equals(that.type); + return false; } @Override diff -r 756029dab703 -r 41ecd18552b2 hotspot/.cproject --- a/hotspot/.cproject Thu Mar 13 21:15:46 2014 +0100 +++ b/hotspot/.cproject Thu Mar 13 21:16:57 2014 +0100 @@ -44,6 +44,7 @@ +