Mercurial > hg > graal-jvmci-8
changeset 12581:8fde330c11cd
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 25 Oct 2013 01:26:27 +0200 |
parents | 7876c59a7a2f (diff) 04e51b3026c0 (current diff) |
children | a5a4a0bcd863 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProvider.java |
diffstat | 19 files changed, 152 insertions(+), 143 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Fri Oct 25 01:26:27 2013 +0200 @@ -55,7 +55,7 @@ /** * HotSpot AMD64 specific backend. */ -public class AMD64HotSpotBackend extends HotSpotBackend { +public class AMD64HotSpotBackend extends HotSpotHostBackend { private static final Unsafe unsafe = Unsafe.getUnsafe();
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java Fri Oct 25 01:26:27 2013 +0200 @@ -56,8 +56,8 @@ HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target); HotSpotConstantReflectionProvider constantReflection = createConstantReflection(runtime); Value[] nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(runtime.getConfig(), codeCache.getRegisterConfig()); - HotSpotForeignCallsProvider foreignCalls = createForeignCalls(runtime, metaAccess, codeCache, nativeABICallerSaveRegisters); - HotSpotLoweringProvider lowerer = createLowerer(runtime, metaAccess, foreignCalls); + HotSpotHostForeignCallsProvider foreignCalls = createForeignCalls(runtime, metaAccess, codeCache, nativeABICallerSaveRegisters); + HotSpotHostLoweringProvider lowerer = createLowerer(runtime, metaAccess, foreignCalls); // Replacements cannot have speculative optimizations since they have // to be valid for the entire run of the VM. Assumptions assumptions = new Assumptions(false);
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILCompilationResult.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILCompilationResult.java Fri Oct 25 01:26:27 2013 +0200 @@ -85,6 +85,7 @@ if (b == null) { // Fall back to a new instance b = new HSAILHotSpotBackendFactory().createBackend(runtime(), runtime().getHostBackend()); + b.completeInitialization(); } backend = b; }
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotForeignCallsProvider.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotForeignCallsProvider.java Fri Oct 25 01:26:27 2013 +0200 @@ -25,7 +25,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; -import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.*; public class HSAILHotSpotForeignCallsProvider implements HotSpotForeignCallsProvider { @@ -55,7 +54,4 @@ public Value[] getNativeABICallerSaveRegisters() { throw GraalInternalError.unimplemented(); } - - public void initialize(HotSpotProviders providers, HotSpotVMConfig config) { - } }
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLoweringProvider.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLoweringProvider.java Fri Oct 25 01:26:27 2013 +0200 @@ -22,16 +22,13 @@ */ package com.oracle.graal.hotspot.hsail; -import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; -import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; -public class HSAILHotSpotLoweringProvider implements HotSpotLoweringProvider { +public class HSAILHotSpotLoweringProvider implements LoweringProvider { private LoweringProvider host; @@ -51,11 +48,4 @@ public ValueNode reconstructArrayIndex(LocationNode location) { throw GraalInternalError.unimplemented(); } - - public void initialize(HotSpotProviders providers, HotSpotVMConfig config) { - } - - public int getScalingFactor(Kind elementKind) { - throw GraalInternalError.unimplemented(); - } }
--- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackendFactory.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackendFactory.java Fri Oct 25 01:26:27 2013 +0200 @@ -40,7 +40,7 @@ PTXHotSpotCodeCacheProvider codeCache = new PTXHotSpotCodeCacheProvider(runtime, createTarget()); ConstantReflectionProvider constantReflection = host.getConstantReflection(); HotSpotForeignCallsProvider foreignCalls = new PTXHotSpotForeignCallsProvider(); - HotSpotLoweringProvider lowerer = new PTXHotSpotLoweringProvider(host.getLowerer()); + LoweringProvider lowerer = new PTXHotSpotLoweringProvider(host.getLowerer()); Replacements replacements = host.getReplacements(); HotSpotDisassemblerProvider disassembler = host.getDisassembler(); HotSpotSuitesProvider suites = host.getSuites();
--- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotForeignCallsProvider.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotForeignCallsProvider.java Fri Oct 25 01:26:27 2013 +0200 @@ -25,7 +25,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; -import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.*; public class PTXHotSpotForeignCallsProvider implements HotSpotForeignCallsProvider { @@ -49,7 +48,4 @@ public Value[] getNativeABICallerSaveRegisters() { throw GraalInternalError.unimplemented(); } - - public void initialize(HotSpotProviders providers, HotSpotVMConfig config) { - } }
--- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotLoweringProvider.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotLoweringProvider.java Fri Oct 25 01:26:27 2013 +0200 @@ -22,16 +22,13 @@ */ package com.oracle.graal.hotspot.ptx; -import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; -import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; -public class PTXHotSpotLoweringProvider implements HotSpotLoweringProvider { +public class PTXHotSpotLoweringProvider implements LoweringProvider { private final LoweringProvider host; @@ -56,11 +53,4 @@ public ValueNode reconstructArrayIndex(LocationNode location) { throw GraalInternalError.unimplemented(); } - - public void initialize(HotSpotProviders providers, HotSpotVMConfig config) { - } - - public int getScalingFactor(Kind elementKind) { - throw GraalInternalError.unimplemented(); - } }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Fri Oct 25 01:26:27 2013 +0200 @@ -51,7 +51,7 @@ /** * HotSpot SPARC specific backend. */ -public class SPARCHotSpotBackend extends HotSpotBackend { +public class SPARCHotSpotBackend extends HotSpotHostBackend { private static final Unsafe unsafe = Unsafe.getUnsafe();
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java Fri Oct 25 01:26:27 2013 +0200 @@ -28,6 +28,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.util.*; import com.oracle.graal.sparc.*; @@ -54,7 +55,7 @@ HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime); Value[] nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(runtime.getConfig(), codeCache.getRegisterConfig()); HotSpotForeignCallsProvider foreignCalls = new SPARCHotSpotForeignCallsProvider(runtime, metaAccess, codeCache, nativeABICallerSaveRegisters); - HotSpotLoweringProvider lowerer = new SPARCHotSpotLoweringProvider(runtime, metaAccess, foreignCalls); + LoweringProvider lowerer = new SPARCHotSpotLoweringProvider(runtime, metaAccess, foreignCalls); // Replacements cannot have speculative optimizations since they have // to be valid for the entire run of the VM. Assumptions assumptions = new Assumptions(false);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Fri Oct 25 01:26:27 2013 +0200 @@ -80,6 +80,13 @@ return runtime; } + /** + * Performs any remaining initialization that was deferred until the {@linkplain #getRuntime() + * runtime} object was initialized and this backend was registered with it. + */ + public void completeInitialization() { + } + @Override public HotSpotProviders getProviders() { return (HotSpotProviders) super.getProviders();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java Fri Oct 25 01:26:27 2013 +0200 @@ -139,17 +139,17 @@ Class<?>[] argumentTypes = descriptor.getArgumentTypes(); JavaType[] parameterTypes = new JavaType[argumentTypes.length]; for (int i = 0; i < parameterTypes.length; ++i) { - parameterTypes[i] = asJavaType(argumentTypes[i], metaAccess); + parameterTypes[i] = asJavaType(argumentTypes[i], metaAccess, codeCache); } TargetDescription target = codeCache.getTarget(); - JavaType returnType = asJavaType(descriptor.getResultType(), metaAccess); + JavaType returnType = asJavaType(descriptor.getResultType(), metaAccess, codeCache); RegisterConfig regConfig = codeCache.getRegisterConfig(); return regConfig.getCallingConvention(ccType, returnType, parameterTypes, target, false); } - private static JavaType asJavaType(Class type, MetaAccessProvider metaAccess) { + private static JavaType asJavaType(Class type, MetaAccessProvider metaAccess, CodeCacheProvider codeCache) { if (WordBase.class.isAssignableFrom(type)) { - return metaAccess.lookupJavaType(getHostWordKind().toJavaClass()); + return metaAccess.lookupJavaType(codeCache.getTarget().wordKind.toJavaClass()); } else { return metaAccess.lookupJavaType(type); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Fri Oct 25 01:26:27 2013 +0200 @@ -0,0 +1,74 @@ +/* + * 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.hotspot; + +import static com.oracle.graal.phases.GraalOptions.*; + +import java.util.*; + +import com.oracle.graal.api.meta.*; +import com.oracle.graal.debug.*; +import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.nodes.spi.*; + +/** + * Common functionality of HotSpot host backends. + */ +public abstract class HotSpotHostBackend extends HotSpotBackend { + + public HotSpotHostBackend(HotSpotGraalRuntime runtime, HotSpotProviders providers) { + super(runtime, providers); + } + + @Override + public void completeInitialization() { + final HotSpotProviders providers = getProviders(); + HotSpotVMConfig config = getRuntime().getConfig(); + HotSpotHostForeignCallsProvider foreignCalls = (HotSpotHostForeignCallsProvider) providers.getForeignCalls(); + final HotSpotHostLoweringProvider lowerer = (HotSpotHostLoweringProvider) providers.getLowerer(); + foreignCalls.initialize(providers, config); + lowerer.initialize(providers, config); + + // Install intrinsics. + if (Intrinsify.getValue()) { + Debug.scope("RegisterReplacements", new Object[]{new DebugDumpScope("RegisterReplacements")}, new Runnable() { + + @Override + public void run() { + + Replacements replacements = providers.getReplacements(); + ServiceLoader<ReplacementsProvider> sl = ServiceLoader.loadInstalled(ReplacementsProvider.class); + for (ReplacementsProvider replacementsProvider : sl) { + replacementsProvider.registerReplacements(providers.getMetaAccess(), lowerer, replacements, providers.getCodeCache().getTarget()); + } + if (BootstrapReplacements.getValue()) { + for (ResolvedJavaMethod method : replacements.getAllReplacements()) { + replacements.getMacroSubstitution(method); + replacements.getMethodSubstitution(method); + } + } + } + }); + } + } +}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Oct 25 01:26:27 2013 +0200 @@ -48,7 +48,6 @@ import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; import com.oracle.graal.options.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; @@ -180,54 +179,16 @@ } } - final HotSpotProviders hostProviders = runtime.getHostProviders(); + HotSpotBackend hostBackend = runtime.getHostBackend(); + final HotSpotProviders hostProviders = hostBackend.getProviders(); assert VerifyOptionsPhase.checkOptions(hostProviders.getMetaAccess(), hostProviders.getForeignCalls()); - // Install intrinsics. - if (Intrinsify.getValue()) { - Debug.scope("RegisterReplacements", new Object[]{new DebugDumpScope("RegisterReplacements")}, new Runnable() { - - @Override - public void run() { - - List<LoweringProvider> initializedLowerers = new ArrayList<>(); - List<ForeignCallsProvider> initializedForeignCalls = new ArrayList<>(); - - for (Map.Entry<?, HotSpotBackend> e : runtime.getBackends().entrySet()) { - HotSpotBackend backend = e.getValue(); - HotSpotProviders providers = backend.getProviders(); - - HotSpotForeignCallsProvider foreignCalls = providers.getForeignCalls(); - if (!initializedForeignCalls.contains(foreignCalls)) { - initializedForeignCalls.add(foreignCalls); - foreignCalls.initialize(providers, config); - } - HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer(); - if (!initializedLowerers.contains(lowerer)) { - initializedLowerers.add(lowerer); - initializeLowerer(providers, lowerer); - } - } - } - - private void initializeLowerer(HotSpotProviders providers, HotSpotLoweringProvider lowerer) { - final Replacements replacements = providers.getReplacements(); - ServiceLoader<ReplacementsProvider> sl = ServiceLoader.loadInstalled(ReplacementsProvider.class); - TargetDescription target = providers.getCodeCache().getTarget(); - for (ReplacementsProvider replacementsProvider : sl) { - replacementsProvider.registerReplacements(providers.getMetaAccess(), lowerer, replacements, target); - } - lowerer.initialize(providers, config); - if (BootstrapReplacements.getValue()) { - for (ResolvedJavaMethod method : replacements.getAllReplacements()) { - replacements.getMacroSubstitution(method); - replacements.getMethodSubstitution(method); - replacements.getSnippet(method); - } - } - } - }); - + // Complete initialization of backends + hostBackend.completeInitialization(); + for (HotSpotBackend backend : runtime.getBackends().values()) { + if (backend != hostBackend) { + backend.completeInitialization(); + } } // Create compilation queue.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProvider.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProvider.java Fri Oct 25 01:26:27 2013 +0200 @@ -24,15 +24,12 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.*; /** * HotSpot extension of {@link ForeignCallsProvider}. */ public interface HotSpotForeignCallsProvider extends ForeignCallsProvider { - void initialize(HotSpotProviders providers, HotSpotVMConfig config); - /** * Gets the registers that must be saved across a foreign call into the runtime. */
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostLoweringProvider.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostLoweringProvider.java Fri Oct 25 01:26:27 2013 +0200 @@ -57,7 +57,7 @@ /** * HotSpot implementation of {@link LoweringProvider}. */ -public class HotSpotHostLoweringProvider implements HotSpotLoweringProvider { +public class HotSpotHostLoweringProvider implements LoweringProvider { protected final HotSpotGraalRuntime runtime; protected final MetaAccessProvider metaAccess; @@ -79,18 +79,6 @@ } public void initialize(HotSpotProviders providers, HotSpotVMConfig config) { - Replacements r = providers.getReplacements(); - - r.registerSubstitutions(ObjectSubstitutions.class); - r.registerSubstitutions(SystemSubstitutions.class); - r.registerSubstitutions(ThreadSubstitutions.class); - r.registerSubstitutions(UnsafeSubstitutions.class); - r.registerSubstitutions(ClassSubstitutions.class); - r.registerSubstitutions(AESCryptSubstitutions.class); - r.registerSubstitutions(CipherBlockChainingSubstitutions.class); - r.registerSubstitutions(CRC32Substitutions.class); - r.registerSubstitutions(ReflectionSubstitutions.class); - TargetDescription target = providers.getCodeCache().getTarget(); checkcastDynamicSnippets = new CheckCastDynamicSnippets.Templates(providers, target); instanceofSnippets = new InstanceOfSnippets.Templates(providers, target); @@ -100,8 +88,7 @@ boxingSnippets = new BoxingSnippets.Templates(providers, target); exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(providers, target); unsafeLoadSnippets = new UnsafeLoadSnippets.Templates(providers, target); - - r.registerSnippetTemplateCache(new UnsafeArrayCopySnippets.Templates(providers, target)); + providers.getReplacements().registerSnippetTemplateCache(new UnsafeArrayCopySnippets.Templates(providers, target)); } @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java Thu Oct 24 23:47:41 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2011, 2012, 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.hotspot.meta; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.*; -import com.oracle.graal.nodes.spi.*; - -/** - * HotSpot extension of {@link LoweringProvider}. - */ -public interface HotSpotLoweringProvider extends LoweringProvider { - - void initialize(HotSpotProviders providers, HotSpotVMConfig config); - - int getScalingFactor(Kind elementKind); -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Fri Oct 25 01:26:27 2013 +0200 @@ -0,0 +1,46 @@ +/* + * 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.hotspot.replacements; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.runtime.*; +import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.replacements.*; + +@ServiceProvider(ReplacementsProvider.class) +public class HotSpotSubstitutions implements ReplacementsProvider { + + @Override + public void registerReplacements(MetaAccessProvider metaAccess, LoweringProvider loweringProvider, Replacements replacements, TargetDescription target) { + replacements.registerSubstitutions(ObjectSubstitutions.class); + replacements.registerSubstitutions(SystemSubstitutions.class); + replacements.registerSubstitutions(ThreadSubstitutions.class); + replacements.registerSubstitutions(UnsafeSubstitutions.class); + replacements.registerSubstitutions(ClassSubstitutions.class); + replacements.registerSubstitutions(AESCryptSubstitutions.class); + replacements.registerSubstitutions(CipherBlockChainingSubstitutions.class); + replacements.registerSubstitutions(CRC32Substitutions.class); + replacements.registerSubstitutions(ReflectionSubstitutions.class); + } +}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Thu Oct 24 23:47:41 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java Fri Oct 25 01:26:27 2013 +0200 @@ -332,7 +332,7 @@ Kind elementKind = elementType.getKind(); ConstantNode hub = ConstantNode.forConstant(arrayType.klass(), providers.getMetaAccess(), graph); final int headerSize = HotSpotGraalRuntime.getArrayBaseOffset(elementKind); - HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer(); + HotSpotHostLoweringProvider lowerer = (HotSpotHostLoweringProvider) providers.getLowerer(); int log2ElementSize = CodeUtil.log2(lowerer.getScalingFactor(elementKind)); Arguments args = new Arguments(allocateArray, graph.getGuardsStage());