1 /* 2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 25 package org.graalvm.compiler.hotspot.meta; 26 27 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider; 28 import org.graalvm.compiler.core.common.spi.ConstantFieldProvider; 29 import org.graalvm.compiler.hotspot.word.HotSpotWordTypes; 30 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; 31 import org.graalvm.compiler.nodes.spi.LoweringProvider; 32 import org.graalvm.compiler.nodes.spi.Replacements; 33 import org.graalvm.compiler.phases.tiers.SuitesProvider; 34 import org.graalvm.compiler.phases.util.Providers; 35 36 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; 37 import jdk.vm.ci.meta.ConstantReflectionProvider; 38 import jdk.vm.ci.meta.MetaAccessProvider; 39 40 /** 41 * Extends {@link Providers} to include a number of extra capabilities used by the HotSpot parts of 42 * the compiler. 43 */ 44 public class HotSpotProviders extends Providers { 45 46 private final SuitesProvider suites; 47 private final HotSpotRegistersProvider registers; 48 private final SnippetReflectionProvider snippetReflection; 49 private final HotSpotWordTypes wordTypes; 50 private final Plugins graphBuilderPlugins; 51 52 public HotSpotProviders(MetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantField, 53 HotSpotForeignCallsProvider foreignCalls, LoweringProvider lowerer, Replacements replacements, SuitesProvider suites, 54 HotSpotRegistersProvider registers, 55 SnippetReflectionProvider snippetReflection, HotSpotWordTypes wordTypes, Plugins graphBuilderPlugins) { 56 super(metaAccess, codeCache, constantReflection, constantField, foreignCalls, lowerer, replacements, new HotSpotStampProvider()); 57 this.suites = suites; 58 this.registers = registers; 59 this.snippetReflection = snippetReflection; 60 this.wordTypes = wordTypes; 61 this.graphBuilderPlugins = graphBuilderPlugins; 62 } 63 64 @Override 65 public HotSpotCodeCacheProvider getCodeCache() { 66 return (HotSpotCodeCacheProvider) super.getCodeCache(); 67 } 68 69 @Override 70 public HotSpotForeignCallsProvider getForeignCalls() { 71 return (HotSpotForeignCallsProvider) super.getForeignCalls(); 72 } 73 74 public SuitesProvider getSuites() { 75 return suites; 76 } 77 78 public HotSpotRegistersProvider getRegisters() { 79 return registers; 80 } 81 82 public SnippetReflectionProvider getSnippetReflection() { 83 return snippetReflection; 84 } 85 86 public Plugins getGraphBuilderPlugins() { 87 return graphBuilderPlugins; 88 } 89 90 public HotSpotWordTypes getWordTypes() { 91 return wordTypes; 92 } 93 }