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 uses 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) |
Modifier and Type | Method and Description |
---|---|
void |
encodeSnippets() |
void |
registerSnippet(jdk.vm.ci.meta.ResolvedJavaMethod method,
jdk.vm.ci.meta.ResolvedJavaMethod original,
Object receiver,
boolean trackNodeSourcePosition,
org.graalvm.compiler.options.OptionValues options)
Compiles the snippet and stores the graph.
|
copyFrom, createGraphMaker, getDelayedInvocationPluginMethods, getIntrinsicGraph, getMethodSubstitution, getSnippet, getSnippetGraphs, getSnippetMethods, getSnippetNodeClasses, getSubstitution, hasSubstitution, registerImmutableObjects, setGraphBuilderPlugins
getDefaultReplacementBytecodeProvider, getGraphBuilderPlugins, getIntrinsifyingPlugin, getMethodSubstitution, getProviders, getSnippetTemplateCache, makeGraph, makeGraph, notifyNotInlined, openDebugContext, registerConditionalPlugin, registerMethodSubstitution, registerSnippetTemplateCache, setProviders, shouldInlineInvoke
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public 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)
public void registerSnippet(jdk.vm.ci.meta.ResolvedJavaMethod method, jdk.vm.ci.meta.ResolvedJavaMethod original, Object receiver, boolean trackNodeSourcePosition, org.graalvm.compiler.options.OptionValues options)
SubstrateReplacements
registerSnippet
in interface org.graalvm.compiler.nodes.spi.Replacements
registerSnippet
in class SubstrateReplacements
public void encodeSnippets()
encodeSnippets
in class SubstrateReplacements