protected VirtualInstanceNode createVirtualInstanceNode(boolean hasIdentity) { return new VirtualInstanceNode(instanceClass(), hasIdentity); }
protected void processNewInstance(NewInstanceNode node, TypeFlowsOfNodes state) { AnalysisType type = (AnalysisType) node.instanceClass(); assert type.isInstantiated(); Object key = uniqueKey(node); BytecodeLocation allocationLabel = bb.analysisPolicy().createAllocationSite(bb, key, method); TypeFlowBuilder<?> newInstanceBuilder = TypeFlowBuilder.create(bb, node, NewInstanceTypeFlow.class, () -> { NewInstanceTypeFlow newInstance = createNewInstanceTypeFlow(node, type, allocationLabel); /* Instance fields of a new object are initialized to null state in AnalysisField. */ methodFlow.addAllocation(newInstance); return newInstance; }); state.add(node, newInstanceBuilder); }
@Override public void lower(NewInstanceNode node, LoweringTool tool) { if (node.graph().getGuardsStage() != StructuredGraph.GuardsStage.AFTER_FSA) { return; } SharedType type = (SharedType) node.instanceClass(); Arguments args = new Arguments(newInstance, node.graph().getGuardsStage(), tool.getLoweringStage()); args.add("hub", type.getHub()); args.addConst("encoding", type.getHub().getLayoutEncoding()); args.addConst("fillContents", node.fillContents()); addCounterArgs(args, node, type); template(node, args).instantiate(providers.getMetaAccess(), node, SnippetTemplate.DEFAULT_REPLACER, args); }
/** * Lowers a {@link NewInstanceNode}. */ public void lower(NewInstanceNode newInstanceNode, HotSpotRegistersProvider registers, LoweringTool tool) { StructuredGraph graph = newInstanceNode.graph(); HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) newInstanceNode.instanceClass(); assert !type.isArray(); ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), type.klass(), providers.getMetaAccess(), graph); int size = instanceSize(type); OptionValues localOptions = graph.getOptions(); SnippetInfo snippet = GeneratePIC.getValue(localOptions) ? allocateInstancePIC : allocateInstance; Arguments args = new Arguments(snippet, graph.getGuardsStage(), tool.getLoweringStage()); args.addConst("size", size); args.add("hub", hub); args.add("prototypeMarkWord", type.prototypeMarkWord()); args.addConst("fillContents", newInstanceNode.fillContents()); args.addConst("threadRegister", registers.getThreadRegister()); args.addConst("constantSize", true); args.addConst("typeContext", ProfileAllocations.getValue(localOptions) ? type.toJavaName(false) : ""); args.addConst("counters", counters); SnippetTemplate template = template(newInstanceNode, args); graph.getDebug().log("Lowering allocateInstance in %s: node=%s, template=%s, arguments=%s", graph, newInstanceNode, template, args); template.instantiate(providers.getMetaAccess(), newInstanceNode, DEFAULT_REPLACER, args); }
AnalysisType type = (AnalysisType) node.instanceClass(); type.registerAsAllocated(node);
NewInstanceNode newInstanceNode = (NewInstanceNode) node; PEAppendGraphBuilderContext graphBuilderContext = new PEAppendGraphBuilderContext(methodScope, newInstanceNode); ResolvedJavaType type = newInstanceNode.instanceClass(); for (NodePlugin nodePlugin : nodePlugins) { if (nodePlugin.handleNewInstance(graphBuilderContext, type)) {