public class HostedReplacements extends SubstrateReplacements
SubstrateReplacements. This ensures
that snippets do not use analysis-specific nodes - they are parsed using the same
BytecodeParser subclass also used for parsing the snippets we use for runtime
compilation. The parsing using the AnalysisUniverse.
We cannot parse snippets again before compilation with the HostedUniverse: the static
analysis does not see the individual methods that are inlined into snippets, only the final graph
for snippets after aggressive inlining and constant folding. Therefore, many methods used inside
snippets are not marked as invoked.
Therefore, we re-use the snippets parsed before static analysis also for compilation. We need to
transplant these snippets from the AnalysisUniverse to the HostedUniverse, i.e.,
we need to change out all metadata objects (types, methods, fields, ...). This is easy because
the snippets are encoded anyway, so we have a single Object[] array with all objects referenced
from the snippet graphs. The object replacement is done in HostedReplacements.replaceAnalysisObjects(java.lang.Object).SubstrateReplacements.Builder, SubstrateReplacements.GraphMakerFactory, SubstrateReplacements.SnippetInlineInvokePlugin| Constructor and Description |
|---|
HostedReplacements(HostedUniverse hUniverse,
org.graalvm.compiler.phases.util.Providers providers,
org.graalvm.compiler.api.replacements.SnippetReflectionProvider snippetReflection,
jdk.vm.ci.code.TargetDescription target,
com.oracle.graal.pointsto.meta.HostedProviders anaylysisProviders,
org.graalvm.compiler.bytecode.BytecodeProvider bytecodeProvider,
org.graalvm.compiler.options.OptionValues options) |
| Modifier and Type | Method and Description |
|---|---|
void |
encodeSnippets() |
void |
registerSnippet(jdk.vm.ci.meta.ResolvedJavaMethod m,
boolean trackNodeSourcePosition)
Compiles the snippet and stores the graph.
|
copyFrom, createGraphMaker, getDelayedInvocationPluginMethods, getSnippet, getSnippetGraphs, getSnippetMethods, getSnippetNodeClasses, getSubstitution, getSubstitutionBytecode, hasSubstitution, registerImmutableObjects, setGraphBuilderPluginsgetDefaultReplacementBytecodeProvider, getGraphBuilderPlugins, getOptions, getSnippet, getSnippetTemplateCache, hasGeneratedInvocationPluginAnnotation, hasGenericInvocationPluginAnnotation, makeGraph, notifyNotInlined, openDebugContext, registerSnippetTemplateCache, shouldInlineInvokepublic HostedReplacements(HostedUniverse hUniverse, org.graalvm.compiler.phases.util.Providers providers, org.graalvm.compiler.api.replacements.SnippetReflectionProvider snippetReflection, jdk.vm.ci.code.TargetDescription target, com.oracle.graal.pointsto.meta.HostedProviders anaylysisProviders, org.graalvm.compiler.bytecode.BytecodeProvider bytecodeProvider, org.graalvm.compiler.options.OptionValues options)
public void registerSnippet(jdk.vm.ci.meta.ResolvedJavaMethod m,
boolean trackNodeSourcePosition)
SubstrateReplacementsregisterSnippet in interface org.graalvm.compiler.nodes.spi.ReplacementsregisterSnippet in class SubstrateReplacementspublic void encodeSnippets()
encodeSnippets in class SubstrateReplacements