# HG changeset patch # User Andreas Woess # Date 1427718530 -7200 # Node ID 826a51b9c5d1deb74b1a2929f824d805d8d0a274 # Parent 5b62fbf5f290feab53c9b5988dd9f990ee2ff3f9 remove TruffleReplacements diff -r 5b62fbf5f290 -r 826a51b9c5d1 graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleReplacements.java --- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleReplacements.java Mon Mar 30 14:26:46 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.truffle.hotspot; - -import com.oracle.graal.api.replacements.*; -import com.oracle.graal.api.runtime.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.phases.util.*; -import com.oracle.graal.runtime.*; -import com.oracle.graal.truffle.*; - -public final class HotSpotTruffleReplacements extends TruffleReplacements { - - private HotSpotTruffleReplacements(Providers providers, SnippetReflectionProvider snippetReflection) { - super(providers, snippetReflection); - } - - public static Replacements makeInstance() { - Providers providers = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders(); - SnippetReflectionProvider snippetReflection = Graal.getRequiredCapability(SnippetReflectionProvider.class); - return new HotSpotTruffleReplacements(providers, snippetReflection); - } -} diff -r 5b62fbf5f290 -r 826a51b9c5d1 graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java --- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Mon Mar 30 14:26:46 2015 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Mon Mar 30 14:28:50 2015 +0200 @@ -50,7 +50,6 @@ import com.oracle.graal.lir.phases.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; -import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.inlining.*; import com.oracle.graal.phases.tiers.*; @@ -74,7 +73,6 @@ } private TruffleCompilerImpl truffleCompiler; - private Replacements truffleReplacements; private Map> compilations = newIdentityMap(); private final ThreadPoolExecutor compileQueue; @@ -143,14 +141,6 @@ return createCallTargetImpl(source, root); } - @Override - public Replacements getReplacements() { - if (truffleReplacements == null) { - truffleReplacements = HotSpotTruffleReplacements.makeInstance(); - } - return truffleReplacements; - } - public static void installOptimizedCallTargetCallMethod() { Providers providers = getGraalProviders(); MetaAccessProvider metaAccess = providers.getMetaAccess(); diff -r 5b62fbf5f290 -r 826a51b9c5d1 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Mon Mar 30 14:26:46 2015 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Mon Mar 30 14:28:50 2015 +0200 @@ -32,7 +32,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.api.runtime.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; import com.oracle.graal.truffle.debug.*; import com.oracle.graal.truffle.unsafe.*; import com.oracle.truffle.api.*; @@ -270,8 +269,6 @@ public abstract Collection getQueuedCallTargets(); - public abstract Replacements getReplacements(); - public abstract void compile(OptimizedCallTarget optimizedCallTarget, boolean mayBeAsynchronous); public abstract boolean cancelInstalledTask(OptimizedCallTarget optimizedCallTarget, Object source, CharSequence reason); diff -r 5b62fbf5f290 -r 826a51b9c5d1 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleReplacements.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleReplacements.java Mon Mar 30 14:26:46 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.truffle; - -import java.util.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.replacements.*; -import com.oracle.graal.compiler.common.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.phases.util.*; -import com.oracle.graal.replacements.*; - -/** - * Custom {@link Replacements} for Truffle compilation. - */ -public abstract class TruffleReplacements extends ReplacementsImpl { - - private final Replacements graalReplacements; - - protected TruffleReplacements(Providers providers, SnippetReflectionProvider snippetReflection) { - super(providers, snippetReflection, providers.getCodeCache().getTarget()); - this.graalReplacements = providers.getReplacements(); - } - - @Override - public StructuredGraph getSnippet(ResolvedJavaMethod method, Object[] args) { - return graalReplacements.getSnippet(method, null, args); - } - - @Override - public StructuredGraph getMethodSubstitution(ResolvedJavaMethod method) { - StructuredGraph graph = graalReplacements.getMethodSubstitution(method); - if (graph == null) { - return super.getMethodSubstitution(method); - } - return graph; - } - - @Override - public Collection getAllReplacements() { - throw GraalInternalError.shouldNotReachHere(); - } - - @Override - public boolean isForcedSubstitution(ResolvedJavaMethod method) { - return graalReplacements.isForcedSubstitution(method) || super.isForcedSubstitution(method); - } - - @Override - public void registerSnippetTemplateCache(SnippetTemplateCache templates) { - throw GraalInternalError.shouldNotReachHere(); - } - - @Override - public T getSnippetTemplateCache(Class templatesClass) { - return graalReplacements.getSnippetTemplateCache(templatesClass); - } -}