# HG changeset patch # User Christos Kotselidis # Date 1381533305 -7200 # Node ID 7b1f522884ee1c260b517d8d7f8ac6e53dd0e625 # Parent 819c0394c6e3b7eea6b12376fea3c3961d588904# Parent f53dc8bbb88c96c896e02f092beb8a11b874e80a Merge diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ForeignCallsProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ForeignCallsProvider.java Sat Oct 12 01:15:05 2013 +0200 @@ -0,0 +1,47 @@ +/* + * 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.api.meta; + +/** + * Capability to query attributes of the supported {@link ForeignCallDescriptor foreign calls}. + */ +public interface ForeignCallsProvider { + + /** + * Determines if a given foreign call is side-effect free. Deoptimization cannot return + * execution to a point before a foreign call that has a side effect. + */ + boolean isReexecutable(ForeignCallDescriptor descriptor); + + /** + * Gets the set of memory locations killed by a given foreign call. Returning the special value + * {@link LocationIdentity#ANY_LOCATION} denotes that the call kills all memory locations. + * Returning any empty array denotes that the call does not kill any memory locations. + */ + LocationIdentity[] getKilledLocations(ForeignCallDescriptor descriptor); + + /** + * Determines if deoptimization can occur during a given foreign call. + */ + boolean canDeoptimize(ForeignCallDescriptor descriptor); +} diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Sat Oct 12 01:15:05 2013 +0200 @@ -68,24 +68,6 @@ Signature parseMethodDescriptor(String methodDescriptor); /** - * Determines if a given foreign call is side-effect free. Deoptimization cannot return - * execution to a point before a foreign call that has a side effect. - */ - boolean isReexecutable(ForeignCallDescriptor descriptor); - - /** - * Gets the set of memory locations killed by a given foreign call. Returning the special value - * {@link LocationIdentity#ANY_LOCATION} denotes that the call kills all memory locations. - * Returning any empty array denotes that the call does not kill any memory locations. - */ - LocationIdentity[] getKilledLocations(ForeignCallDescriptor descriptor); - - /** - * Determines if deoptimization can occur during a given foreign call. - */ - boolean canDeoptimize(ForeignCallDescriptor descriptor); - - /** * Encodes a deoptimization action and a deoptimization reason in an integer value. * * @return the encoded value as an integer diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/ForEachToGraal.java --- a/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/ForEachToGraal.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/ForEachToGraal.java Sat Oct 12 01:15:05 2013 +0200 @@ -57,10 +57,10 @@ } } HotSpotVMConfig config = HotSpotGraalRuntime.graalRuntime().getConfig(); - AMD64HotSpotRuntime hsruntime = new AMD64HotSpotRuntime(config, HotSpotGraalRuntime.graalRuntime()); - ResolvedJavaMethod rm = hsruntime.lookupJavaMethod(acceptMethod); + AMD64HotSpotRuntime runtime = new AMD64HotSpotRuntime(config, HotSpotGraalRuntime.graalRuntime()); + ResolvedJavaMethod rm = runtime.lookupJavaMethod(acceptMethod); StructuredGraph graph = new StructuredGraph(rm); - new GraphBuilderPhase(hsruntime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(runtime, runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); NodeIterable nin = graph.getNodes(); ResolvedJavaMethod lambdaMethod = null; for (Node n : nin) { diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILCompilationResult.java --- a/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILCompilationResult.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILCompilationResult.java Sat Oct 12 01:15:05 2013 +0200 @@ -80,8 +80,9 @@ public static HSAILCompilationResult getHSAILCompilationResult(ResolvedJavaMethod javaMethod) { MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); + ForeignCallsProvider foreignCalls = Graal.getRequiredCapability(ForeignCallsProvider.class); StructuredGraph graph = new StructuredGraph(javaMethod); - new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(metaAccess, foreignCalls, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); return getHSAILCompilationResult(graph); } @@ -118,7 +119,7 @@ TargetDescription target = new TargetDescription(new HSAIL(), true, 8, 0, true); HSAILBackend hsailBackend = new HSAILBackend(providers.getMetaAccess(), providers.getCodeCache(), target); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(providers.getMetaAccess(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(providers.getMetaAccess(), providers.getForeignCalls(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); phasePlan.addPhase(PhasePosition.AFTER_PARSING, new HSAILPhase()); new HSAILPhase().apply(graph); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java Sat Oct 12 01:15:05 2013 +0200 @@ -62,7 +62,7 @@ TargetDescription target = new TargetDescription(new PTX(), true, 1, 0, true); PTXBackend ptxBackend = new PTXBackend(getMetaAccess(), getCodeCache(), target); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), getForeignCalls(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); phasePlan.addPhase(PhasePosition.AFTER_PARSING, new PTXPhase()); new PTXPhase().apply(graph); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Sat Oct 12 01:15:05 2013 +0200 @@ -67,7 +67,7 @@ StructuredGraph graph = new StructuredGraph(javaMethod); GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(); - new GraphBuilderPhase(getMetaAccess(), conf, OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(getMetaAccess(), getForeignCalls(), conf, OptimisticOptimizations.ALL).apply(graph); HighTierContext context = new HighTierContext(getProviders(), assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Sat Oct 12 01:15:05 2013 +0200 @@ -77,20 +77,12 @@ */ public abstract class GraalCompilerTest extends GraalTest { - private final CodeCacheProvider codeCache; - private final MetaAccessProvider metaAccess; - private final ConstantReflectionProvider constantReflection; - private final LoweringProvider lowerer; - private final Replacements replacements; + private final Providers providers; protected final Backend backend; protected final Suites suites; public GraalCompilerTest() { - this.replacements = Graal.getRequiredCapability(Replacements.class); - this.metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); - this.constantReflection = Graal.getRequiredCapability(ConstantReflectionProvider.class); - this.codeCache = Graal.getRequiredCapability(CodeCacheProvider.class); - this.lowerer = Graal.getRequiredCapability(LoweringProvider.class); + this.providers = GraalCompiler.getGraalProviders(); this.backend = Graal.getRequiredCapability(Backend.class); this.suites = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); } @@ -166,23 +158,27 @@ } protected Providers getProviders() { - return new Providers(metaAccess, codeCache, constantReflection, lowerer, getReplacements()); + return providers; } protected CodeCacheProvider getCodeCache() { - return codeCache; + return getProviders().getCodeCache(); } protected ConstantReflectionProvider getConstantReflection() { - return constantReflection; + return getProviders().getConstantReflection(); + } + + protected ForeignCallsProvider getForeignCalls() { + return getProviders().getForeignCalls(); } protected MetaAccessProvider getMetaAccess() { - return metaAccess; + return getProviders().getMetaAccess(); } protected LoweringProvider getLowerer() { - return lowerer; + return getProviders().getLowerer(); } /** @@ -347,7 +343,7 @@ before(method); Object[] executeArgs = argsWithReceiver(receiver, args); - ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(method); + ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); checkArgs(javaMethod, executeArgs); InstalledCode compiledMethod = getCode(javaMethod, parse(method)); @@ -370,7 +366,7 @@ if (kind == Kind.Object) { if (arg != null && javaType instanceof ResolvedJavaType) { ResolvedJavaType resolvedJavaType = (ResolvedJavaType) javaType; - Assert.assertTrue(resolvedJavaType + " from " + metaAccess.lookupJavaType(arg.getClass()), resolvedJavaType.isAssignableFrom(metaAccess.lookupJavaType(arg.getClass()))); + Assert.assertTrue(resolvedJavaType + " from " + getMetaAccess().lookupJavaType(arg.getClass()), resolvedJavaType.isAssignableFrom(getMetaAccess().lookupJavaType(arg.getClass()))); } } else { Assert.assertNotNull(arg); @@ -419,7 +415,7 @@ protected Result executeActualCheckDeopt(Method method, Set shouldNotDeopt, Object receiver, Object... args) { Map deoptCounts = new EnumMap<>(DeoptimizationReason.class); - ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(method); + ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); ProfilingInfo profile = javaMethod.getProfilingInfo(); for (DeoptimizationReason reason : shouldNotDeopt) { deoptCounts.put(reason, profile.getDeoptimizationCount(reason)); @@ -488,11 +484,11 @@ } long start = System.currentTimeMillis(); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), getForeignCalls(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); - final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, getProviders(), backend, getCodeCache().getTarget(), null, phasePlan, - OptimisticOptimizations.ALL, new SpeculationLog(), suites, new CompilationResult()); + final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, getProviders(), backend, getCodeCache().getTarget(), null, phasePlan, OptimisticOptimizations.ALL, + new SpeculationLog(), suites, new CompilationResult()); if (printCompilation) { TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s | %4dms %5dB", id, "", "", "", System.currentTimeMillis() - start, compResult.getTargetCodeSize())); } @@ -567,9 +563,9 @@ private StructuredGraph parse0(Method m, GraphBuilderConfiguration conf) { assert m.getAnnotation(Test.class) == null : "shouldn't parse method with @Test annotation: " + m; - ResolvedJavaMethod javaMethod = metaAccess.lookupJavaMethod(m); + ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(m); StructuredGraph graph = new StructuredGraph(javaMethod); - new GraphBuilderPhase(metaAccess, conf, OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(getMetaAccess(), getForeignCalls(), conf, OptimisticOptimizations.ALL).apply(graph); return graph; } @@ -581,11 +577,11 @@ PhasePlan plan = new PhasePlan(); GraphBuilderConfiguration gbConf = GraphBuilderConfiguration.getEagerDefault(); gbConf.setEagerInfopointMode(eagerInfopointMode); - plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(metaAccess, gbConf, OptimisticOptimizations.ALL)); + plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(getMetaAccess(), getForeignCalls(), gbConf, OptimisticOptimizations.ALL)); return plan; } protected Replacements getReplacements() { - return replacements; + return getProviders().getReplacements(); } } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Sat Oct 12 01:15:05 2013 +0200 @@ -230,7 +230,7 @@ return Debug.scope("GraalCompiler", new Object[]{graph, method, getCodeCache()}, new Callable() { public ReturnNode call() { - new GraphBuilderPhase(getMetaAccess(), GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(getMetaAccess(), getForeignCalls(), GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); Assumptions assumptions = new Assumptions(false); HighTierContext context = new HighTierContext(getProviders(), assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); diff -r 819c0394c6e3 -r 7b1f522884ee 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 Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Sat Oct 12 01:15:05 2013 +0200 @@ -294,8 +294,9 @@ MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); CodeCacheProvider codeCache = Graal.getRequiredCapability(CodeCacheProvider.class); ConstantReflectionProvider constantReflection = Graal.getRequiredCapability(ConstantReflectionProvider.class); + ForeignCallsProvider foreignCalls = Graal.getRequiredCapability(ForeignCallsProvider.class); LoweringProvider lowerer = Graal.getRequiredCapability(LoweringProvider.class); Replacements replacements = Graal.getRequiredCapability(Replacements.class); - return new Providers(metaAccess, codeCache, constantReflection, lowerer, replacements); + return new Providers(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements); } } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Sat Oct 12 01:15:05 2013 +0200 @@ -73,7 +73,7 @@ registerForeignCall(DECRYPT, config.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION); - Providers providers = new Providers(this, this, this, this, replacements); + Providers providers = new Providers(this, this, this, this, this, replacements); convertSnippets = new AMD64ConvertSnippets.Templates(providers, graalRuntime.getTarget()); super.registerReplacements(replacements); } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Sat Oct 12 01:15:05 2013 +0200 @@ -200,7 +200,7 @@ boolean originalSetting = AOTCompilation.getValue(); AOTCompilation.setValue(compileAOT); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), getForeignCalls(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); // create suites everytime, as we modify options for the compiler diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Sat Oct 12 01:15:05 2013 +0200 @@ -155,7 +155,7 @@ InliningUtil.InlinedBytecodes.add(method.getCodeSize()); HotSpotRuntime runtime = graalRuntime.getRuntime(); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); - Providers providers = new Providers(runtime, runtime, runtime, runtime, replacements); + Providers providers = new Providers(runtime, runtime, runtime, runtime, runtime, replacements); return GraalCompiler.compileGraph(graph, cc, method, providers, graalRuntime.getBackend(), graalRuntime.getTarget(), graalRuntime.getCache(), plan, optimisticOpts, method.getSpeculationLog(), suitesProvider.getDefaultSuites(), new CompilationResult()); } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Sat Oct 12 01:15:05 2013 +0200 @@ -349,7 +349,8 @@ @SuppressWarnings("unchecked") @Override public T getCapability(Class clazz) { - if (clazz == LoweringProvider.class || clazz == CodeCacheProvider.class || clazz == MetaAccessProvider.class || clazz == ConstantReflectionProvider.class) { + if (clazz == LoweringProvider.class || clazz == CodeCacheProvider.class || clazz == MetaAccessProvider.class || clazz == ConstantReflectionProvider.class || + clazz == ForeignCallsProvider.class) { return (T) getRuntime(); } if (clazz == DisassemblerProvider.class || clazz == BytecodeDisassemblerProvider.class || clazz == SuitesProvider.class) { diff -r 819c0394c6e3 -r 7b1f522884ee 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 Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Sat Oct 12 01:15:05 2013 +0200 @@ -40,7 +40,7 @@ private final HotSpotVMConfig config; public HotSpotReplacementsImpl(HotSpotRuntime runtime, Assumptions assumptions, TargetDescription target) { - super(runtime, runtime, runtime, runtime, assumptions, target); + super(runtime, runtime, runtime, runtime, runtime, assumptions, target); this.config = runtime.config; } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Sat Oct 12 01:15:05 2013 +0200 @@ -180,7 +180,7 @@ } final HotSpotRuntime runtime = graalRuntime.getCapability(HotSpotRuntime.class); - assert VerifyOptionsPhase.checkOptions(runtime); + assert VerifyOptionsPhase.checkOptions(runtime, runtime); // Install intrinsics. final Replacements replacements = graalRuntime.getCapability(Replacements.class); @@ -687,7 +687,7 @@ public PhasePlan createPhasePlan(OptimisticOptimizations optimisticOpts, boolean onStackReplacement) { PhasePlan phasePlan = new PhasePlan(); - phasePlan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(graalRuntime.getRuntime(), GraphBuilderConfiguration.getDefault(), optimisticOpts)); + phasePlan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(graalRuntime.getRuntime(), graalRuntime.getRuntime(), GraphBuilderConfiguration.getDefault(), optimisticOpts)); if (onStackReplacement) { phasePlan.addPhase(PhasePosition.AFTER_PARSING, new OnStackReplacementPhase()); } diff -r 819c0394c6e3 -r 7b1f522884ee 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 Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sat Oct 12 01:15:05 2013 +0200 @@ -99,7 +99,8 @@ /** * HotSpot implementation of {@link LoweringProvider}. */ -public abstract class HotSpotRuntime implements MetaAccessProvider, ConstantReflectionProvider, CodeCacheProvider, LoweringProvider, DisassemblerProvider, BytecodeDisassemblerProvider, SuitesProvider { +public abstract class HotSpotRuntime implements MetaAccessProvider, ForeignCallsProvider, ConstantReflectionProvider, CodeCacheProvider, LoweringProvider, DisassemblerProvider, + BytecodeDisassemblerProvider, SuitesProvider { public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", void.class, long.class); public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", int.class, Object.class); @@ -292,7 +293,7 @@ registerForeignCall(NEW_INSTANCE_C, c.newInstanceAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, ANY_LOCATION); registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, NO_LOCATIONS); - Providers providers = new Providers(this, this, this, this, r); + Providers providers = new Providers(this, this, this, this, this, r); link(new NewInstanceStub(providers, target, registerStubCall(NEW_INSTANCE, REEXECUTABLE, NOT_LEAF, ANY_LOCATION))); link(new NewArrayStub(providers, target, registerStubCall(NEW_ARRAY, REEXECUTABLE, NOT_LEAF, INIT_LOCATION))); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Sat Oct 12 01:15:05 2013 +0200 @@ -43,8 +43,8 @@ public static final ForeignCallDescriptor NEW_MULTI_ARRAY = new ForeignCallDescriptor("new_multi_array", Object.class, Word.class, int.class, Word.class); - public NewMultiArrayStubCall(@InjectedNodeParameter MetaAccessProvider metaAccess, ValueNode hub, int rank, ValueNode dims) { - super(metaAccess, NEW_MULTI_ARRAY, defaultStamp); + public NewMultiArrayStubCall(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode hub, int rank, ValueNode dims) { + super(foreignCalls, NEW_MULTI_ARRAY, defaultStamp); this.hub = hub; this.rank = rank; this.dims = dims; diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Sat Oct 12 01:15:05 2013 +0200 @@ -37,15 +37,15 @@ public class StubForeignCallNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Multi { @Input private final NodeInputList arguments; - private final MetaAccessProvider metaAccess; + private final ForeignCallsProvider foreignCalls; private final ForeignCallDescriptor descriptor; - public StubForeignCallNode(@InjectedNodeParameter MetaAccessProvider metaAccess, ForeignCallDescriptor descriptor, ValueNode... arguments) { + public StubForeignCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, ValueNode... arguments) { super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); this.arguments = new NodeInputList<>(this, arguments); this.descriptor = descriptor; - this.metaAccess = metaAccess; + this.foreignCalls = foreignCalls; } public ForeignCallDescriptor getDescriptor() { @@ -54,7 +54,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return metaAccess.getKilledLocations(descriptor); + return foreignCalls.getKilledLocations(descriptor); } protected Value[] operands(LIRGeneratorTool gen) { diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Sat Oct 12 01:15:05 2013 +0200 @@ -93,7 +93,7 @@ } // the canonicalization before loop unrolling is needed to propagate the length into // additions, etc. - PhaseContext context = new PhaseContext(tool.getMetaAccess(), tool.getCodeCache(), tool.getConstantReflection(), tool.getLowerer(), tool.assumptions(), tool.getReplacements()); + PhaseContext context = new PhaseContext(tool.getMetaAccess(), tool.getCodeCache(), tool.getConstantReflection(), tool.getForeignCalls(), tool.getLowerer(), tool.assumptions(), tool.getReplacements()); new CanonicalizerPhase(true).apply(snippetGraph, context); new LoopFullUnrollPhase(new CanonicalizerPhase(true)).apply(snippetGraph, context); new CanonicalizerPhase(true).apply(snippetGraph, context); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java Sat Oct 12 01:15:05 2013 +0200 @@ -74,7 +74,7 @@ HotSpotRuntime hsRuntime = (HotSpotRuntime) providers.getMetaAccess(); ReadRegisterNode thread = graph.add(new ReadRegisterNode(hsRuntime.threadRegister(), true, false)); graph.addBeforeFixed(loadExceptionObject, thread); - ForeignCallNode loadExceptionC = graph.add(new ForeignCallNode(providers.getMetaAccess(), LOAD_AND_CLEAR_EXCEPTION, thread)); + ForeignCallNode loadExceptionC = graph.add(new ForeignCallNode(providers.getForeignCalls(), LOAD_AND_CLEAR_EXCEPTION, thread)); loadExceptionC.setStateAfter(loadExceptionObject.stateAfter()); graph.replaceFixedWithFixed(loadExceptionObject, loadExceptionC); } else { diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Sat Oct 12 01:15:05 2013 +0200 @@ -85,8 +85,7 @@ * be re-executed. * @param killedLocations the memory locations killed by the stub call */ - public ForeignCallStub(Providers providers, long address, ForeignCallDescriptor descriptor, boolean prependThread, Transition transition, boolean reexecutable, - LocationIdentity... killedLocations) { + public ForeignCallStub(Providers providers, long address, ForeignCallDescriptor descriptor, boolean prependThread, Transition transition, boolean reexecutable, LocationIdentity... killedLocations) { super(providers, HotSpotForeignCallLinkage.create(descriptor, 0L, PRESERVES_REGISTERS, JavaCall, JavaCallee, transition, reexecutable, killedLocations)); this.prependThread = prependThread; Class[] targetParameterTypes = createTargetParameters(descriptor); @@ -304,7 +303,7 @@ private void inline(InvokeNode invoke) { ResolvedJavaMethod method = ((MethodCallTargetNode) invoke.callTarget()).targetMethod(); - ReplacementsImpl repl = new ReplacementsImpl(runtime, runtime, runtime, runtime, new Assumptions(false), runtime.getTarget()); + ReplacementsImpl repl = new ReplacementsImpl(runtime, runtime, runtime, runtime, runtime, new Assumptions(false), runtime.getTarget()); StructuredGraph calleeGraph = repl.makeGraph(method, null, null, false); InliningUtil.inline(invoke, calleeGraph, false); } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Sat Oct 12 01:15:05 2013 +0200 @@ -152,7 +152,7 @@ } PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); // The stub itself needs the incoming calling convention. CallingConvention incomingCc = linkage.getIncomingCallingConvention(); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java --- a/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java Sat Oct 12 01:15:05 2013 +0200 @@ -43,9 +43,11 @@ Providers providers = GraalCompiler.getGraalProviders(); Suites suites = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); StructuredGraph graph = new StructuredGraph(method); - new GraphBuilderPhase(providers.getMetaAccess(), GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + MetaAccessProvider metaAccess = providers.getMetaAccess(); + ForeignCallsProvider foreignCalls = providers.getForeignCalls(); + new GraphBuilderPhase(metaAccess, foreignCalls, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(providers.getMetaAccess(), GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(metaAccess, foreignCalls, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); Backend backend = Graal.getRequiredCapability(Backend.class); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Sat Oct 12 01:15:05 2013 +0200 @@ -86,6 +86,7 @@ protected BlockPlaceholderNode placeholders; private final MetaAccessProvider metaAccess; + private final ForeignCallsProvider foreignCalls; private ConstantPool constantPool; private ResolvedJavaMethod method; private int entryBCI; @@ -150,10 +151,11 @@ return currentGraph; } - public GraphBuilderPhase(MetaAccessProvider metaAccess, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts) { + public GraphBuilderPhase(MetaAccessProvider metaAccess, ForeignCallsProvider foreignCalls, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts) { this.graphBuilderConfig = graphBuilderConfig; this.optimisticOpts = optimisticOpts; this.metaAccess = metaAccess; + this.foreignCalls = foreignCalls; assert metaAccess != null; } @@ -959,7 +961,7 @@ ValueNode exception = ConstantNode.forObject(cachedNullPointerException, metaAccess, currentGraph); trueSucc.setNext(handleException(exception, bci())); } else { - ForeignCallNode call = currentGraph.add(new ForeignCallNode(metaAccess, CREATE_NULL_POINTER_EXCEPTION)); + ForeignCallNode call = currentGraph.add(new ForeignCallNode(foreignCalls, CREATE_NULL_POINTER_EXCEPTION)); call.setStateAfter(frameState.create(bci())); trueSucc.setNext(call); call.setNext(handleException(call, bci())); @@ -983,7 +985,7 @@ ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, metaAccess, currentGraph); falseSucc.setNext(handleException(exception, bci())); } else { - ForeignCallNode call = currentGraph.add(new ForeignCallNode(metaAccess, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); + ForeignCallNode call = currentGraph.add(new ForeignCallNode(foreignCalls, CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); call.setStateAfter(frameState.create(bci())); falseSucc.setNext(call); call.setNext(handleException(call, bci())); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java Sat Oct 12 01:15:05 2013 +0200 @@ -44,29 +44,29 @@ */ public class VerifyOptionsPhase extends Phase { - public static boolean checkOptions(MetaAccessProvider metaAccess) { + public static boolean checkOptions(MetaAccessProvider metaAccess, ForeignCallsProvider foreignCalls) { ServiceLoader sl = ServiceLoader.loadInstalled(Options.class); Set checked = new HashSet<>(); for (Options opts : sl) { for (OptionDescriptor desc : opts) { ResolvedJavaType holder = metaAccess.lookupJavaType(desc.getDeclaringClass()); - checkType(holder, desc, metaAccess, checked); + checkType(holder, desc, metaAccess, foreignCalls, checked); } } return true; } - private static void checkType(ResolvedJavaType type, OptionDescriptor option, MetaAccessProvider metaAccess, Set checked) { + private static void checkType(ResolvedJavaType type, OptionDescriptor option, MetaAccessProvider metaAccess, ForeignCallsProvider foreignCalls, Set checked) { if (!checked.contains(type)) { checked.add(type); ResolvedJavaType superType = type.getSuperclass(); if (superType != null && !MetaUtil.isJavaLangObject(superType)) { - checkType(superType, option, metaAccess, checked); + checkType(superType, option, metaAccess, foreignCalls, checked); } for (ResolvedJavaMethod method : type.getDeclaredMethods()) { if (method.isClassInitializer()) { StructuredGraph graph = new StructuredGraph(method); - new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); + new GraphBuilderPhase(metaAccess, foreignCalls, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); new VerifyOptionsPhase(type, metaAccess, option).apply(graph); } } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Sat Oct 12 01:15:05 2013 +0200 @@ -36,28 +36,28 @@ public class ForeignCallNode extends AbstractStateSplit implements LIRLowerable, DeoptimizingNode, MemoryCheckpoint.Multi { @Input private final NodeInputList arguments; - private final MetaAccessProvider metaAccess; + private final ForeignCallsProvider foreignCalls; @Input private FrameState deoptState; private final ForeignCallDescriptor descriptor; - public ForeignCallNode(@InjectedNodeParameter MetaAccessProvider metaAccess, ForeignCallDescriptor descriptor, ValueNode... arguments) { + public ForeignCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, ValueNode... arguments) { super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); this.arguments = new NodeInputList<>(this, arguments); this.descriptor = descriptor; - this.metaAccess = metaAccess; + this.foreignCalls = foreignCalls; } - protected ForeignCallNode(@InjectedNodeParameter MetaAccessProvider metaAccess, ForeignCallDescriptor descriptor, Stamp stamp) { + protected ForeignCallNode(@InjectedNodeParameter ForeignCallsProvider metaAccess, ForeignCallDescriptor descriptor, Stamp stamp) { super(stamp); this.arguments = new NodeInputList<>(this); this.descriptor = descriptor; - this.metaAccess = metaAccess; + this.foreignCalls = metaAccess; } @Override public boolean hasSideEffect() { - return !metaAccess.isReexecutable(descriptor); + return !foreignCalls.isReexecutable(descriptor); } public ForeignCallDescriptor getDescriptor() { @@ -66,7 +66,7 @@ @Override public LocationIdentity[] getLocationIdentities() { - return metaAccess.getKilledLocations(descriptor); + return foreignCalls.getKilledLocations(descriptor); } protected Value[] operands(LIRGeneratorTool gen) { @@ -126,7 +126,7 @@ @Override public boolean canDeoptimize() { - return metaAccess.canDeoptimize(descriptor); + return foreignCalls.canDeoptimize(descriptor); } @Override diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java Sat Oct 12 01:15:05 2013 +0200 @@ -39,6 +39,8 @@ ConstantReflectionProvider getConstantReflection(); + ForeignCallsProvider getForeignCalls(); + Replacements getReplacements(); GuardingNode createNullCheckGuard(GuardedNode guardedNode, ValueNode object); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Sat Oct 12 01:15:05 2013 +0200 @@ -78,6 +78,11 @@ } @Override + public ForeignCallsProvider getForeignCalls() { + return context.getForeignCalls(); + } + + @Override public LoweringProvider getLowerer() { return context.getLowerer(); } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/PhaseContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/PhaseContext.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/PhaseContext.java Sat Oct 12 01:15:05 2013 +0200 @@ -31,9 +31,9 @@ private final Assumptions assumptions; - public PhaseContext(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, LoweringProvider lowerer, Assumptions assumptions, - Replacements replacements) { - super(metaAccess, codeCache, constantReflection, lowerer, replacements); + public PhaseContext(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, ForeignCallsProvider foreignCalls, LoweringProvider lowerer, + Assumptions assumptions, Replacements replacements) { + super(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, replacements); this.assumptions = assumptions; } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Providers.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Providers.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Providers.java Sat Oct 12 01:15:05 2013 +0200 @@ -35,12 +35,15 @@ private final CodeCacheProvider codeCache; private final LoweringProvider lowerer; private final ConstantReflectionProvider constantReflection; + private final ForeignCallsProvider foreignCalls; private final Replacements replacements; - public Providers(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, LoweringProvider lowerer, Replacements replacements) { + public Providers(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, ForeignCallsProvider foreignCalls, LoweringProvider lowerer, + Replacements replacements) { this.metaAccess = metaAccess; this.codeCache = codeCache; this.constantReflection = constantReflection; + this.foreignCalls = foreignCalls; this.lowerer = lowerer; this.replacements = replacements; } @@ -49,6 +52,7 @@ this.metaAccess = copyFrom.metaAccess; this.codeCache = copyFrom.codeCache; this.constantReflection = copyFrom.constantReflection; + this.foreignCalls = copyFrom.foreignCalls; this.lowerer = copyFrom.lowerer; this.replacements = copyFrom.replacements; } @@ -61,6 +65,10 @@ return codeCache; } + public ForeignCallsProvider getForeignCalls() { + return foreignCalls; + } + public LoweringProvider getLowerer() { return lowerer; } @@ -72,4 +80,28 @@ public Replacements getReplacements() { return replacements; } + + public Providers copyWith(MetaAccessProvider substitution) { + return new Providers(substitution, codeCache, constantReflection, foreignCalls, lowerer, replacements); + } + + public Providers copyWith(CodeCacheProvider substitution) { + return new Providers(metaAccess, substitution, constantReflection, foreignCalls, lowerer, replacements); + } + + public Providers copyWith(ConstantReflectionProvider substitution) { + return new Providers(metaAccess, codeCache, substitution, foreignCalls, lowerer, replacements); + } + + public Providers copyWith(ForeignCallsProvider substitution) { + return new Providers(metaAccess, codeCache, constantReflection, substitution, lowerer, replacements); + } + + public Providers copyWith(LoweringProvider substitution) { + return new Providers(metaAccess, codeCache, constantReflection, foreignCalls, substitution, replacements); + } + + public Providers copyWith(Replacements substitution) { + return new Providers(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, substitution); + } } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Sat Oct 12 01:15:05 2013 +0200 @@ -49,7 +49,7 @@ public ObjectAccessTest() { target = Graal.getRequiredCapability(CodeCacheProvider.class).getTarget(); - installer = new ReplacementsImpl(getMetaAccess(), getConstantReflection(), getCodeCache(), getLowerer(), new Assumptions(false), target); + installer = new ReplacementsImpl(getMetaAccess(), getConstantReflection(), getCodeCache(), getForeignCalls(), getLowerer(), new Assumptions(false), target); } private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Sat Oct 12 01:15:05 2013 +0200 @@ -53,7 +53,7 @@ public PointerTest() { target = Graal.getRequiredCapability(CodeCacheProvider.class).getTarget(); - installer = new ReplacementsImpl(getMetaAccess(), getConstantReflection(), getCodeCache(), getLowerer(), new Assumptions(false), target); + installer = new ReplacementsImpl(getMetaAccess(), getConstantReflection(), getCodeCache(), getForeignCalls(), getLowerer(), new Assumptions(false), target); } private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java Sat Oct 12 01:15:05 2013 +0200 @@ -43,7 +43,7 @@ public WordTest() { TargetDescription target = Graal.getRequiredCapability(CodeCacheProvider.class).getTarget(); - installer = new ReplacementsImpl(getMetaAccess(), getConstantReflection(), getCodeCache(), getLowerer(), new Assumptions(false), target); + installer = new ReplacementsImpl(getMetaAccess(), getConstantReflection(), getCodeCache(), getForeignCalls(), getLowerer(), new Assumptions(false), target); } private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Sat Oct 12 01:15:05 2013 +0200 @@ -40,6 +40,7 @@ import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.*; +import com.oracle.graal.phases.util.*; import com.oracle.graal.replacements.Snippet.Fold; /** @@ -48,10 +49,10 @@ */ public class NodeIntrinsificationPhase extends Phase { - private final MetaAccessProvider metaAccess; + private final Providers providers; - public NodeIntrinsificationPhase(MetaAccessProvider metaAccess) { - this.metaAccess = metaAccess; + public NodeIntrinsificationPhase(Providers providers) { + this.providers = providers; } @Override @@ -112,7 +113,7 @@ if (constant != null) { // Replace the invoke with the result of the call - ConstantNode node = ConstantNode.forConstant(constant, metaAccess, methodCallTargetNode.graph()); + ConstantNode node = ConstantNode.forConstant(constant, providers.getMetaAccess(), methodCallTargetNode.graph()); methodCallTargetNode.invoke().intrinsify(node); // Clean up checkcast instructions inserted by javac if the return type is generic. @@ -157,8 +158,8 @@ Constant constant = constantNode.asConstant(); Object o = constant.asBoxedValue(); if (o instanceof Class) { - reflectionCallArguments[i] = Constant.forObject(metaAccess.lookupJavaType((Class) o)); - parameterTypes[i] = metaAccess.lookupJavaType(ResolvedJavaType.class); + reflectionCallArguments[i] = Constant.forObject(providers.getMetaAccess().lookupJavaType((Class) o)); + parameterTypes[i] = providers.getMetaAccess().lookupJavaType(ResolvedJavaType.class); } else { if (parameterTypes[i].getKind() == Kind.Boolean) { reflectionCallArguments[i] = Constant.forObject(Boolean.valueOf(constant.asInt() != 0)); @@ -174,7 +175,7 @@ } } else { reflectionCallArguments[i] = Constant.forObject(argument); - parameterTypes[i] = metaAccess.lookupJavaType(ValueNode.class); + parameterTypes[i] = providers.getMetaAccess().lookupJavaType(ValueNode.class); } } return reflectionCallArguments; @@ -185,10 +186,10 @@ if (intrinsic.value() == NodeIntrinsic.class) { result = target.getDeclaringClass(); } else { - result = metaAccess.lookupJavaType(intrinsic.value()); + result = providers.getMetaAccess().lookupJavaType(intrinsic.value()); } - assert metaAccess.lookupJavaType(ValueNode.class).isAssignableFrom(result) : "Node intrinsic class " + toJavaName(result, false) + " derived from @" + NodeIntrinsic.class.getSimpleName() + - " annotation on " + format("%H.%n(%p)", target) + " is not a subclass of " + ValueNode.class; + assert providers.getMetaAccess().lookupJavaType(ValueNode.class).isAssignableFrom(result) : "Node intrinsic class " + toJavaName(result, false) + " derived from @" + + NodeIntrinsic.class.getSimpleName() + " annotation on " + format("%H.%n(%p)", target) + " is not a subclass of " + ValueNode.class; return result; } @@ -249,11 +250,14 @@ Constant[] injected = null; ResolvedJavaType[] signature = resolveJavaTypes(signatureToTypes(c.getSignature(), null), c.getDeclaringClass()); + MetaAccessProvider metaAccess = providers.getMetaAccess(); for (int i = 0; i < signature.length; i++) { if (getParameterAnnotation(InjectedNodeParameter.class, i, c) != null) { injected = injected == null ? new Constant[1] : Arrays.copyOf(injected, injected.length + 1); if (signature[i].equals(metaAccess.lookupJavaType(MetaAccessProvider.class))) { injected[injected.length - 1] = Constant.forObject(metaAccess); + } else if (signature[i].equals(metaAccess.lookupJavaType(ForeignCallsProvider.class))) { + injected[injected.length - 1] = Constant.forObject(providers.getForeignCalls()); } else { throw new GraalInternalError("Cannot handle injected argument of type %s in %s", toJavaName(signature[i]), format("%H.%n(%p)", c)); } diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Sat Oct 12 01:15:05 2013 +0200 @@ -68,9 +68,9 @@ private final Set forcedSubstitutions; private final Map, SnippetTemplateCache> snippetTemplateCache; - public ReplacementsImpl(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, CodeCacheProvider codeCache, LoweringProvider lowerer, Assumptions assumptions, - TargetDescription target) { - this.providers = new Providers(metaAccess, codeCache, constantReflection, lowerer, this); + public ReplacementsImpl(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, LoweringProvider lowerer, + Assumptions assumptions, TargetDescription target) { + this.providers = new Providers(metaAccess, codeCache, constantReflection, foreignCalls, lowerer, this); this.target = target; this.assumptions = assumptions; this.graphs = new ConcurrentHashMap<>(); @@ -289,7 +289,7 @@ * Does final processing of a snippet graph. */ protected void finalizeGraph(StructuredGraph graph, boolean removeAllFrameStates) { - new NodeIntrinsificationPhase(providers.getMetaAccess()).apply(graph); + new NodeIntrinsificationPhase(providers).apply(graph); if (!SnippetTemplate.hasConstantParameter(method)) { NodeIntrinsificationVerificationPhase.verify(graph); } @@ -336,7 +336,8 @@ @Override public void run() { MetaAccessProvider metaAccess = providers.getMetaAccess(); - new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(graph); + ForeignCallsProvider foreignCalls = providers.getForeignCalls(); + new GraphBuilderPhase(metaAccess, foreignCalls, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(graph); new WordTypeVerificationPhase(metaAccess, target.wordKind).apply(graph); new WordTypeRewriterPhase(metaAccess, target.wordKind).apply(graph); @@ -369,7 +370,7 @@ * Called after all inlining for a given graph is complete. */ protected void afterInlining(StructuredGraph graph) { - new NodeIntrinsificationPhase(providers.getMetaAccess()).apply(graph); + new NodeIntrinsificationPhase(providers).apply(graph); new DeadCodeEliminationPhase().apply(graph); if (OptCanonicalizer.getValue()) { new CanonicalizerPhase(true).apply(graph, new PhaseContext(providers, assumptions)); @@ -388,7 +389,8 @@ if (callee == method) { final StructuredGraph originalGraph = new StructuredGraph(original); MetaAccessProvider metaAccess = providers.getMetaAccess(); - new GraphBuilderPhase(metaAccess, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(originalGraph); + ForeignCallsProvider foreignCalls = providers.getForeignCalls(); + new GraphBuilderPhase(metaAccess, foreignCalls, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(originalGraph); new WordTypeVerificationPhase(metaAccess, target.wordKind).apply(graph); new WordTypeRewriterPhase(metaAccess, target.wordKind).apply(graph); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Sat Oct 12 01:15:05 2013 +0200 @@ -435,7 +435,7 @@ Debug.dump(snippetCopy, "Before specialization"); if (!nodeReplacements.isEmpty()) { // Do deferred intrinsification of node intrinsics - new NodeIntrinsificationPhase(metaAccess).apply(snippetCopy); + new NodeIntrinsificationPhase(providers).apply(snippetCopy); new CanonicalizerPhase(true).apply(snippetCopy, phaseContext); } NodeIntrinsificationVerificationPhase.verify(snippetCopy); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Sat Oct 12 01:15:05 2013 +0200 @@ -96,7 +96,8 @@ */ protected StructuredGraph lowerReplacement(final StructuredGraph replacementGraph, LoweringTool tool) { replacementGraph.setGuardsStage(graph().getGuardsStage()); - final PhaseContext c = new PhaseContext(tool.getMetaAccess(), tool.getCodeCache(), tool.getConstantReflection(), tool.getLowerer(), tool.assumptions(), tool.getReplacements()); + final PhaseContext c = new PhaseContext(tool.getMetaAccess(), tool.getCodeCache(), tool.getConstantReflection(), tool.getForeignCalls(), tool.getLowerer(), tool.assumptions(), + tool.getReplacements()); Debug.scope("LoweringReplacement", replacementGraph, new Runnable() { public void run() { diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Sat Oct 12 01:15:05 2013 +0200 @@ -59,7 +59,7 @@ // Make sure Truffle runtime is initialized. Assert.assertTrue(Truffle.getRuntime() instanceof GraalTruffleRuntime); Replacements truffleReplacements = ((GraalTruffleRuntime) Truffle.getRuntime()).getReplacements(); - Providers providers = new Providers(getMetaAccess(), getCodeCache(), getConstantReflection(), getLowerer(), truffleReplacements); + Providers providers = new Providers(getMetaAccess(), getCodeCache(), getConstantReflection(), getForeignCalls(), getLowerer(), truffleReplacements); TruffleCache truffleCache = new TruffleCache(providers, GraphBuilderConfiguration.getDefault(), TruffleCompilerImpl.Optimizations); this.partialEvaluator = new PartialEvaluator(providers, truffleCache); @@ -182,7 +182,7 @@ // Additional inlining. final PhasePlan plan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), GraphBuilderConfiguration.getEagerDefault(), TruffleCompilerImpl.Optimizations); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(getMetaAccess(), getForeignCalls(), GraphBuilderConfiguration.getEagerDefault(), TruffleCompilerImpl.Optimizations); plan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); canonicalizer.addToPhasePlan(plan, context); plan.addPhase(PhasePosition.AFTER_PARSING, new DeadCodeEliminationPhase()); @@ -191,8 +191,7 @@ canonicalizer.apply(graph, context); new DeadCodeEliminationPhase().apply(graph); - HighTierContext highTierContext = new HighTierContext(getProviders(), assumptions, null, plan, - OptimisticOptimizations.NONE); + HighTierContext highTierContext = new HighTierContext(getProviders(), assumptions, null, plan, OptimisticOptimizations.NONE); InliningPhase inliningPhase = new InliningPhase(canonicalizer); inliningPhase.apply(graph, highTierContext); removeFrameStates(graph); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Sat Oct 12 01:15:05 2013 +0200 @@ -115,7 +115,7 @@ @Override public void run() { - new GraphBuilderPhase(providers.getMetaAccess(), config, TruffleCompilerImpl.Optimizations).apply(graph); + new GraphBuilderPhase(providers.getMetaAccess(), providers.getForeignCalls(), config, TruffleCompilerImpl.Optimizations).apply(graph); // Replace thisNode with constant. LocalNode thisNode = graph.getLocal(0); diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Sat Oct 12 01:15:05 2013 +0200 @@ -96,7 +96,7 @@ final StructuredGraph graph = new StructuredGraph(method); PhaseContext phaseContext = new PhaseContext(providers, new Assumptions(false)); - new GraphBuilderPhase(phaseContext.getMetaAccess(), config, optimisticOptimizations).apply(graph); + new GraphBuilderPhase(phaseContext.getMetaAccess(), providers.getForeignCalls(), config, optimisticOptimizations).apply(graph); for (LocalNode l : graph.getNodes(LocalNode.class)) { if (l.kind() == Kind.Object) { diff -r 819c0394c6e3 -r 7b1f522884ee graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Sat Oct 12 01:15:05 2013 +0200 @@ -68,9 +68,8 @@ OptimisticOptimizations.Optimization.RemoveNeverExecutedCode, OptimisticOptimizations.Optimization.UseTypeCheckedInlining, OptimisticOptimizations.Optimization.UseTypeCheckHints); public TruffleCompilerImpl() { - this.providers = new Providers(Graal.getRequiredCapability(MetaAccessProvider.class), Graal.getRequiredCapability(CodeCacheProvider.class), - Graal.getRequiredCapability(ConstantReflectionProvider.class), Graal.getRequiredCapability(LoweringProvider.class), - ((GraalTruffleRuntime) Truffle.getRuntime()).getReplacements()); + Replacements truffleReplacements = ((GraalTruffleRuntime) Truffle.getRuntime()).getReplacements(); + this.providers = GraalCompiler.getGraalProviders().copyWith(truffleReplacements); this.suites = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); this.backend = Graal.getRequiredCapability(Backend.class); this.graalRuntime = HotSpotGraalRuntime.graalRuntime(); @@ -202,7 +201,7 @@ private PhasePlan createPhasePlan(final GraphBuilderConfiguration config) { final PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(providers.getMetaAccess(), config, TruffleCompilerImpl.Optimizations); + GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(providers.getMetaAccess(), providers.getForeignCalls(), config, TruffleCompilerImpl.Optimizations); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); return phasePlan; } diff -r 819c0394c6e3 -r 7b1f522884ee 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 Sat Oct 12 00:47:33 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleReplacements.java Sat Oct 12 01:15:05 2013 +0200 @@ -41,9 +41,9 @@ private final Replacements graalReplacements; - private TruffleReplacements(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, CodeCacheProvider codeCache, LoweringProvider lowerer, Assumptions assumptions, - TargetDescription target, Replacements graalReplacements) { - super(metaAccess, constantReflection, codeCache, lowerer, assumptions, target); + private TruffleReplacements(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, LoweringProvider lowerer, + Assumptions assumptions, TargetDescription target, Replacements graalReplacements) { + super(metaAccess, constantReflection, codeCache, foreignCalls, lowerer, assumptions, target); this.graalReplacements = graalReplacements; } @@ -51,10 +51,12 @@ MetaAccessProvider metaAccess = Graal.getRequiredCapability(MetaAccessProvider.class); CodeCacheProvider codeCache = Graal.getRequiredCapability(CodeCacheProvider.class); ConstantReflectionProvider constantReflection = Graal.getRequiredCapability(ConstantReflectionProvider.class); + ForeignCallsProvider foreignCalls = Graal.getRequiredCapability(ForeignCallsProvider.class); LoweringProvider lowerer = Graal.getRequiredCapability(LoweringProvider.class); TargetDescription targetDescription = Graal.getRequiredCapability(CodeCacheProvider.class).getTarget(); Replacements graalReplacements = Graal.getRequiredCapability(Replacements.class); - Replacements truffleReplacements = new TruffleReplacements(metaAccess, constantReflection, codeCache, lowerer, graalReplacements.getAssumptions(), targetDescription, graalReplacements); + Replacements truffleReplacements = new TruffleReplacements(metaAccess, constantReflection, codeCache, foreignCalls, lowerer, graalReplacements.getAssumptions(), targetDescription, + graalReplacements); truffleReplacements.registerSubstitutions(CompilerAssertsSubstitutions.class); truffleReplacements.registerSubstitutions(CompilerDirectivesSubstitutions.class);