< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java

Print this page
rev 56282 : [mq]: graal


  29 import static org.graalvm.compiler.hotspot.HotSpotBackend.GHASH_PROCESS_BLOCKS;
  30 import static org.graalvm.compiler.hotspot.meta.HotSpotAOTProfilingPlugin.Options.TieredAOT;
  31 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.JAVA_THREAD_THREAD_OBJECT_LOCATION;
  32 import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing;
  33 
  34 import java.lang.invoke.ConstantCallSite;
  35 import java.lang.invoke.MutableCallSite;
  36 import java.lang.invoke.VolatileCallSite;
  37 import java.lang.reflect.Array;
  38 import java.math.BigInteger;
  39 import java.util.zip.CRC32;
  40 
  41 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
  42 import org.graalvm.compiler.bytecode.BytecodeProvider;
  43 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
  44 import org.graalvm.compiler.core.common.type.ObjectStamp;
  45 import org.graalvm.compiler.core.common.type.StampFactory;
  46 import org.graalvm.compiler.core.common.type.TypeReference;
  47 import org.graalvm.compiler.debug.GraalError;
  48 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;

  49 import org.graalvm.compiler.hotspot.nodes.CurrentJavaThreadNode;
  50 import org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions;
  51 import org.graalvm.compiler.hotspot.replacements.ArraysSupportSubstitutions;
  52 import org.graalvm.compiler.hotspot.replacements.BigIntegerSubstitutions;
  53 import org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions;
  54 import org.graalvm.compiler.hotspot.replacements.CRC32Substitutions;
  55 import org.graalvm.compiler.hotspot.replacements.CallSiteTargetNode;
  56 import org.graalvm.compiler.hotspot.replacements.CipherBlockChainingSubstitutions;
  57 import org.graalvm.compiler.hotspot.replacements.ClassGetHubNode;
  58 import org.graalvm.compiler.hotspot.replacements.CounterModeSubstitutions;
  59 import org.graalvm.compiler.hotspot.replacements.DigestBaseSubstitutions;
  60 import org.graalvm.compiler.hotspot.replacements.HotSpotArraySubstitutions;
  61 import org.graalvm.compiler.hotspot.replacements.HotSpotClassSubstitutions;
  62 import org.graalvm.compiler.hotspot.replacements.IdentityHashCodeNode;
  63 import org.graalvm.compiler.hotspot.replacements.ObjectCloneNode;
  64 import org.graalvm.compiler.hotspot.replacements.ObjectSubstitutions;
  65 import org.graalvm.compiler.hotspot.replacements.ReflectionGetCallerClassNode;
  66 import org.graalvm.compiler.hotspot.replacements.ReflectionSubstitutions;
  67 import org.graalvm.compiler.hotspot.replacements.SHA2Substitutions;
  68 import org.graalvm.compiler.hotspot.replacements.SHA5Substitutions;


 111 import jdk.vm.ci.meta.ConstantReflectionProvider;
 112 import jdk.vm.ci.meta.DeoptimizationAction;
 113 import jdk.vm.ci.meta.JavaKind;
 114 import jdk.vm.ci.meta.MetaAccessProvider;
 115 import jdk.vm.ci.meta.ResolvedJavaMethod;
 116 import sun.misc.Unsafe;
 117 
 118 /**
 119  * Defines the {@link Plugins} used when running on HotSpot.
 120  */
 121 public class HotSpotGraphBuilderPlugins {
 122 
 123     /**
 124      * Creates a {@link Plugins} object that should be used when running on HotSpot.
 125      *
 126      * @param constantReflection
 127      * @param snippetReflection
 128      * @param foreignCalls
 129      * @param options
 130      */
 131     public static Plugins create(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotWordTypes wordTypes, MetaAccessProvider metaAccess,
 132                     ConstantReflectionProvider constantReflection, SnippetReflectionProvider snippetReflection, ForeignCallsProvider foreignCalls, ReplacementsImpl replacements,







 133                     OptionValues options) {
 134         InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(config, compilerConfiguration);
 135 
 136         Plugins plugins = new Plugins(invocationPlugins);
 137         NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, wordTypes);
 138         HotSpotWordOperationPlugin wordOperationPlugin = new HotSpotWordOperationPlugin(snippetReflection, wordTypes);
 139         HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin, config, wordTypes);
 140 
 141         plugins.appendTypePlugin(nodePlugin);
 142         plugins.appendNodePlugin(nodePlugin);
 143         if (!GeneratePIC.getValue(options)) {
 144             plugins.appendNodePlugin(new MethodHandlePlugin(constantReflection.getMethodHandleAccess(), true));
 145         }
 146         plugins.appendInlineInvokePlugin(replacements);
 147         if (InlineDuringParsing.getValue(options)) {
 148             plugins.appendInlineInvokePlugin(new InlineDuringParsingPlugin());
 149         }
 150 
 151         if (GeneratePIC.getValue(options)) {
 152             plugins.setClassInitializationPlugin(new HotSpotClassInitializationPlugin());
 153             if (TieredAOT.getValue(options)) {
 154                 plugins.setProfilingPlugin(new HotSpotAOTProfilingPlugin());




 155             }
 156         }
 157 
 158         invocationPlugins.defer(new Runnable() {
 159 
 160             @Override
 161             public void run() {
 162                 BytecodeProvider replacementBytecodeProvider = replacements.getDefaultReplacementBytecodeProvider();
 163                 registerObjectPlugins(invocationPlugins, options, config, replacementBytecodeProvider);
 164                 registerClassPlugins(plugins, config, replacementBytecodeProvider);
 165                 registerSystemPlugins(invocationPlugins, foreignCalls);
 166                 registerThreadPlugins(invocationPlugins, metaAccess, wordTypes, config, replacementBytecodeProvider);
 167                 if (!GeneratePIC.getValue(options)) {
 168                     registerCallSitePlugins(invocationPlugins);
 169                 }
 170                 registerReflectionPlugins(invocationPlugins, replacementBytecodeProvider);
 171                 registerConstantPoolPlugins(invocationPlugins, wordTypes, config, replacementBytecodeProvider);
 172                 registerAESPlugins(invocationPlugins, config, replacementBytecodeProvider);
 173                 registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider);
 174                 registerCRC32CPlugins(invocationPlugins, config, replacementBytecodeProvider);




  29 import static org.graalvm.compiler.hotspot.HotSpotBackend.GHASH_PROCESS_BLOCKS;
  30 import static org.graalvm.compiler.hotspot.meta.HotSpotAOTProfilingPlugin.Options.TieredAOT;
  31 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.JAVA_THREAD_THREAD_OBJECT_LOCATION;
  32 import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing;
  33 
  34 import java.lang.invoke.ConstantCallSite;
  35 import java.lang.invoke.MutableCallSite;
  36 import java.lang.invoke.VolatileCallSite;
  37 import java.lang.reflect.Array;
  38 import java.math.BigInteger;
  39 import java.util.zip.CRC32;
  40 
  41 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
  42 import org.graalvm.compiler.bytecode.BytecodeProvider;
  43 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
  44 import org.graalvm.compiler.core.common.type.ObjectStamp;
  45 import org.graalvm.compiler.core.common.type.StampFactory;
  46 import org.graalvm.compiler.core.common.type.TypeReference;
  47 import org.graalvm.compiler.debug.GraalError;
  48 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
  49 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
  50 import org.graalvm.compiler.hotspot.nodes.CurrentJavaThreadNode;
  51 import org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions;
  52 import org.graalvm.compiler.hotspot.replacements.ArraysSupportSubstitutions;
  53 import org.graalvm.compiler.hotspot.replacements.BigIntegerSubstitutions;
  54 import org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions;
  55 import org.graalvm.compiler.hotspot.replacements.CRC32Substitutions;
  56 import org.graalvm.compiler.hotspot.replacements.CallSiteTargetNode;
  57 import org.graalvm.compiler.hotspot.replacements.CipherBlockChainingSubstitutions;
  58 import org.graalvm.compiler.hotspot.replacements.ClassGetHubNode;
  59 import org.graalvm.compiler.hotspot.replacements.CounterModeSubstitutions;
  60 import org.graalvm.compiler.hotspot.replacements.DigestBaseSubstitutions;
  61 import org.graalvm.compiler.hotspot.replacements.HotSpotArraySubstitutions;
  62 import org.graalvm.compiler.hotspot.replacements.HotSpotClassSubstitutions;
  63 import org.graalvm.compiler.hotspot.replacements.IdentityHashCodeNode;
  64 import org.graalvm.compiler.hotspot.replacements.ObjectCloneNode;
  65 import org.graalvm.compiler.hotspot.replacements.ObjectSubstitutions;
  66 import org.graalvm.compiler.hotspot.replacements.ReflectionGetCallerClassNode;
  67 import org.graalvm.compiler.hotspot.replacements.ReflectionSubstitutions;
  68 import org.graalvm.compiler.hotspot.replacements.SHA2Substitutions;
  69 import org.graalvm.compiler.hotspot.replacements.SHA5Substitutions;


 112 import jdk.vm.ci.meta.ConstantReflectionProvider;
 113 import jdk.vm.ci.meta.DeoptimizationAction;
 114 import jdk.vm.ci.meta.JavaKind;
 115 import jdk.vm.ci.meta.MetaAccessProvider;
 116 import jdk.vm.ci.meta.ResolvedJavaMethod;
 117 import sun.misc.Unsafe;
 118 
 119 /**
 120  * Defines the {@link Plugins} used when running on HotSpot.
 121  */
 122 public class HotSpotGraphBuilderPlugins {
 123 
 124     /**
 125      * Creates a {@link Plugins} object that should be used when running on HotSpot.
 126      *
 127      * @param constantReflection
 128      * @param snippetReflection
 129      * @param foreignCalls
 130      * @param options
 131      */
 132     public static Plugins create(HotSpotGraalRuntimeProvider graalRuntime,
 133                     CompilerConfiguration compilerConfiguration,
 134                     GraalHotSpotVMConfig config,
 135                     HotSpotWordTypes wordTypes,
 136                     MetaAccessProvider metaAccess,
 137                     ConstantReflectionProvider constantReflection,
 138                     SnippetReflectionProvider snippetReflection,
 139                     ForeignCallsProvider foreignCalls,
 140                     ReplacementsImpl replacements,
 141                     OptionValues options) {
 142         InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(graalRuntime, config, compilerConfiguration);
 143 
 144         Plugins plugins = new Plugins(invocationPlugins);
 145         NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, wordTypes);
 146         HotSpotWordOperationPlugin wordOperationPlugin = new HotSpotWordOperationPlugin(snippetReflection, wordTypes);
 147         HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin, config, wordTypes);
 148 
 149         plugins.appendTypePlugin(nodePlugin);
 150         plugins.appendNodePlugin(nodePlugin);
 151         if (!GeneratePIC.getValue(options)) {
 152             plugins.appendNodePlugin(new MethodHandlePlugin(constantReflection.getMethodHandleAccess(), true));
 153         }
 154         plugins.appendInlineInvokePlugin(replacements);
 155         if (InlineDuringParsing.getValue(options)) {
 156             plugins.appendInlineInvokePlugin(new InlineDuringParsingPlugin());
 157         }
 158 
 159         if (GeneratePIC.getValue(options)) {
 160             plugins.setClassInitializationPlugin(new HotSpotAOTClassInitializationPlugin());
 161             if (TieredAOT.getValue(options)) {
 162                 plugins.setProfilingPlugin(new HotSpotAOTProfilingPlugin());
 163             }
 164         } else {
 165             if (config.instanceKlassInitThreadOffset != -1) {
 166                 plugins.setClassInitializationPlugin(new HotSpotJITClassInitializationPlugin());
 167             }
 168         }
 169 
 170         invocationPlugins.defer(new Runnable() {
 171 
 172             @Override
 173             public void run() {
 174                 BytecodeProvider replacementBytecodeProvider = replacements.getDefaultReplacementBytecodeProvider();
 175                 registerObjectPlugins(invocationPlugins, options, config, replacementBytecodeProvider);
 176                 registerClassPlugins(plugins, config, replacementBytecodeProvider);
 177                 registerSystemPlugins(invocationPlugins, foreignCalls);
 178                 registerThreadPlugins(invocationPlugins, metaAccess, wordTypes, config, replacementBytecodeProvider);
 179                 if (!GeneratePIC.getValue(options)) {
 180                     registerCallSitePlugins(invocationPlugins);
 181                 }
 182                 registerReflectionPlugins(invocationPlugins, replacementBytecodeProvider);
 183                 registerConstantPoolPlugins(invocationPlugins, wordTypes, config, replacementBytecodeProvider);
 184                 registerAESPlugins(invocationPlugins, config, replacementBytecodeProvider);
 185                 registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider);
 186                 registerCRC32CPlugins(invocationPlugins, config, replacementBytecodeProvider);


< prev index next >