Search in sources :

Example 6 with ConstantReflectionProvider

use of jdk.vm.ci.meta.ConstantReflectionProvider in project graal by oracle.

the class ReplaceConstantNodesPhase method handleLoadMethodCounters.

/**
 * Replace {@link LoadMethodCountersNode} with indirect load
 * {@link ResolveMethodAndLoadCountersNode}, expose a klass constant of the holder.
 *
 * @param graph
 * @param stateMapper
 * @param node
 * @param context
 */
private static void handleLoadMethodCounters(StructuredGraph graph, FrameStateMapperClosure stateMapper, LoadMethodCountersNode node, PhaseContext context) {
    ResolvedJavaType type = node.getMethod().getDeclaringClass();
    Stamp hubStamp = context.getStampProvider().createHubStamp((ObjectStamp) StampFactory.objectNonNull());
    ConstantReflectionProvider constantReflection = context.getConstantReflection();
    ConstantNode klassHint = ConstantNode.forConstant(hubStamp, constantReflection.asObjectHub(type), context.getMetaAccess(), graph);
    FixedWithNextNode replacement = graph.add(new ResolveMethodAndLoadCountersNode(node.getMethod(), klassHint));
    insertReplacement(graph, stateMapper, node, replacement);
    node.replaceAtUsages(replacement, n -> !(n instanceof ResolveMethodAndLoadCountersNode));
}
Also used : FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) ResolveDynamicConstantNode(org.graalvm.compiler.hotspot.nodes.aot.ResolveDynamicConstantNode) ResolveConstantNode(org.graalvm.compiler.hotspot.nodes.aot.ResolveConstantNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) Stamp(org.graalvm.compiler.core.common.type.Stamp) ResolveMethodAndLoadCountersNode(org.graalvm.compiler.hotspot.nodes.aot.ResolveMethodAndLoadCountersNode) ConstantReflectionProvider(jdk.vm.ci.meta.ConstantReflectionProvider) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) HotSpotResolvedJavaType(jdk.vm.ci.hotspot.HotSpotResolvedJavaType)

Aggregations

ConstantReflectionProvider (jdk.vm.ci.meta.ConstantReflectionProvider)6 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)3 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)2 ConstantFieldProvider (org.graalvm.compiler.core.common.spi.ConstantFieldProvider)2 Stamp (org.graalvm.compiler.core.common.type.Stamp)2 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)2 StampProvider (org.graalvm.compiler.nodes.spi.StampProvider)2 SubstrateAMD64RegisterConfig (com.oracle.svm.core.graal.code.amd64.SubstrateAMD64RegisterConfig)1 ConfigKind (com.oracle.svm.core.graal.code.amd64.SubstrateAMD64RegisterConfig.ConfigKind)1 RuntimeConfiguration (com.oracle.svm.core.graal.meta.RuntimeConfiguration)1 SubstrateCodeCacheProvider (com.oracle.svm.core.graal.meta.SubstrateCodeCacheProvider)1 SubstrateForeignCallsProvider (com.oracle.svm.core.graal.meta.SubstrateForeignCallsProvider)1 SubstrateLoweringProvider (com.oracle.svm.core.graal.meta.SubstrateLoweringProvider)1 SubstrateSnippetReflectionProvider (com.oracle.svm.core.graal.meta.SubstrateSnippetReflectionProvider)1 SubstrateStampProvider (com.oracle.svm.core.graal.meta.SubstrateStampProvider)1 EnumMap (java.util.EnumMap)1 CodeCacheProvider (jdk.vm.ci.code.CodeCacheProvider)1 RegisterConfig (jdk.vm.ci.code.RegisterConfig)1 HotSpotObjectConstant (jdk.vm.ci.hotspot.HotSpotObjectConstant)1 HotSpotResolvedJavaField (jdk.vm.ci.hotspot.HotSpotResolvedJavaField)1