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) { 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 } | 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.core.common.spi.ForeignCallsProvider; 30 import org.graalvm.compiler.hotspot.word.HotSpotWordTypes; 31 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; 32 import org.graalvm.compiler.nodes.spi.LoweringProvider; 33 import org.graalvm.compiler.nodes.spi.Replacements; 34 import org.graalvm.compiler.phases.tiers.SuitesProvider; 35 import org.graalvm.compiler.phases.util.Providers; 36 37 import jdk.vm.ci.code.CodeCacheProvider; 38 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; 39 import jdk.vm.ci.meta.ConstantReflectionProvider; 40 import jdk.vm.ci.meta.MetaAccessProvider; 41 42 /** 43 * Extends {@link Providers} to include a number of extra capabilities used by the HotSpot parts of 44 * the compiler. 45 */ 46 public class HotSpotProviders extends Providers { 47 48 private final SuitesProvider suites; 49 private final HotSpotRegistersProvider registers; 50 private final SnippetReflectionProvider snippetReflection; 51 private final HotSpotWordTypes wordTypes; 52 private final Plugins graphBuilderPlugins; 53 54 public HotSpotProviders(MetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantField, 55 HotSpotForeignCallsProvider foreignCalls, LoweringProvider lowerer, Replacements replacements, SuitesProvider suites, 56 HotSpotRegistersProvider registers, 57 SnippetReflectionProvider snippetReflection, HotSpotWordTypes wordTypes, Plugins graphBuilderPlugins) { 75 76 public SuitesProvider getSuites() { 77 return suites; 78 } 79 80 public HotSpotRegistersProvider getRegisters() { 81 return registers; 82 } 83 84 public SnippetReflectionProvider getSnippetReflection() { 85 return snippetReflection; 86 } 87 88 public Plugins getGraphBuilderPlugins() { 89 return graphBuilderPlugins; 90 } 91 92 public HotSpotWordTypes getWordTypes() { 93 return wordTypes; 94 } 95 96 @Override 97 public Providers copyWith(MetaAccessProvider substitution) { 98 return new HotSpotProviders(substitution, getCodeCache(), getConstantReflection(), getConstantFieldProvider(), getForeignCalls(), getLowerer(), getReplacements(), getSuites(), 99 getRegisters(), getSnippetReflection(), getWordTypes(), getGraphBuilderPlugins()); 100 } 101 102 @Override 103 public Providers copyWith(CodeCacheProvider substitution) { 104 return new HotSpotProviders(getMetaAccess(), (HotSpotCodeCacheProvider) substitution, getConstantReflection(), getConstantFieldProvider(), getForeignCalls(), getLowerer(), getReplacements(), 105 getSuites(), 106 getRegisters(), getSnippetReflection(), getWordTypes(), getGraphBuilderPlugins()); 107 } 108 109 @Override 110 public Providers copyWith(ConstantReflectionProvider substitution) { 111 return new HotSpotProviders(getMetaAccess(), getCodeCache(), substitution, getConstantFieldProvider(), getForeignCalls(), getLowerer(), getReplacements(), getSuites(), 112 getRegisters(), getSnippetReflection(), getWordTypes(), getGraphBuilderPlugins()); 113 } 114 115 @Override 116 public Providers copyWith(ConstantFieldProvider substitution) { 117 return new HotSpotProviders(getMetaAccess(), getCodeCache(), getConstantReflection(), substitution, getForeignCalls(), getLowerer(), getReplacements(), getSuites(), 118 getRegisters(), getSnippetReflection(), getWordTypes(), getGraphBuilderPlugins()); 119 } 120 121 @Override 122 public Providers copyWith(ForeignCallsProvider substitution) { 123 return new HotSpotProviders(getMetaAccess(), getCodeCache(), getConstantReflection(), getConstantFieldProvider(), (HotSpotForeignCallsProvider) substitution, getLowerer(), getReplacements(), 124 getSuites(), 125 getRegisters(), getSnippetReflection(), getWordTypes(), getGraphBuilderPlugins()); 126 } 127 128 @Override 129 public Providers copyWith(LoweringProvider substitution) { 130 return new HotSpotProviders(getMetaAccess(), getCodeCache(), getConstantReflection(), getConstantFieldProvider(), getForeignCalls(), substitution, getReplacements(), getSuites(), 131 getRegisters(), getSnippetReflection(), getWordTypes(), getGraphBuilderPlugins()); 132 } 133 134 @Override 135 public Providers copyWith(Replacements substitution) { 136 return new HotSpotProviders(getMetaAccess(), getCodeCache(), getConstantReflection(), getConstantFieldProvider(), getForeignCalls(), getLowerer(), substitution, getSuites(), 137 getRegisters(), getSnippetReflection(), getWordTypes(), getGraphBuilderPlugins()); 138 } 139 140 public Providers copyWith(Plugins substitution) { 141 return new HotSpotProviders(getMetaAccess(), getCodeCache(), getConstantReflection(), getConstantFieldProvider(), getForeignCalls(), getLowerer(), getReplacements(), getSuites(), 142 getRegisters(), getSnippetReflection(), getWordTypes(), substitution); 143 } 144 } |