1 /* 2 * Copyright (c) 2013, 2016, 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 package org.graalvm.compiler.hotspot.meta; 24 25 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider; 26 import org.graalvm.compiler.core.common.spi.ConstantFieldProvider; 27 import org.graalvm.compiler.hotspot.word.HotSpotWordTypes; 28 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; 29 import org.graalvm.compiler.nodes.spi.LoweringProvider; 30 import org.graalvm.compiler.nodes.spi.NodeCostProvider; 31 import org.graalvm.compiler.nodes.spi.Replacements; 32 import org.graalvm.compiler.phases.tiers.SuitesProvider; 33 import org.graalvm.compiler.phases.util.Providers; 34 35 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; 36 import jdk.vm.ci.meta.ConstantReflectionProvider; 37 import jdk.vm.ci.meta.MetaAccessProvider; 38 39 /** 40 * Extends {@link Providers} to include a number of extra capabilities used by the HotSpot parts of 41 * the compiler. 42 */ 43 public class HotSpotProviders extends Providers { 44 45 private final SuitesProvider suites; 46 private final HotSpotRegistersProvider registers; 47 private final SnippetReflectionProvider snippetReflection; 48 private final HotSpotWordTypes wordTypes; 49 private final Plugins graphBuilderPlugins; 50 51 public HotSpotProviders(MetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantField, 52 HotSpotForeignCallsProvider foreignCalls, LoweringProvider lowerer, Replacements replacements, NodeCostProvider nodeCostProvider, SuitesProvider suites, 53 HotSpotRegistersProvider registers, 54 SnippetReflectionProvider snippetReflection, HotSpotWordTypes wordTypes, Plugins graphBuilderPlugins) { 55 super(metaAccess, codeCache, constantReflection, constantField, foreignCalls, lowerer, replacements, new HotSpotStampProvider(), nodeCostProvider); 56 this.suites = suites; 57 this.registers = registers; 58 this.snippetReflection = snippetReflection; 59 this.wordTypes = wordTypes; 60 this.graphBuilderPlugins = graphBuilderPlugins; 61 } 62 63 @Override 64 public HotSpotCodeCacheProvider getCodeCache() { 65 return (HotSpotCodeCacheProvider) super.getCodeCache(); 66 } 67 68 @Override 69 public HotSpotForeignCallsProvider getForeignCalls() { 70 return (HotSpotForeignCallsProvider) super.getForeignCalls(); 71 } 72 73 public SuitesProvider getSuites() { 74 return suites; 75 } 76 77 public HotSpotRegistersProvider getRegisters() { 78 return registers; 79 } 80 81 public SnippetReflectionProvider getSnippetReflection() { 82 return snippetReflection; 83 } 84 85 public Plugins getGraphBuilderPlugins() { 86 return graphBuilderPlugins; 87 } 88 89 public HotSpotWordTypes getWordTypes() { 90 return wordTypes; 91 } 92 }