protected void lowerAtomicReadAndWriteNode(AtomicReadAndWriteNode n) { StructuredGraph graph = n.graph(); JavaKind valueKind = n.getValueKind(); ValueNode newValue = implicitStoreConvert(graph, valueKind, n.newValue()); AddressNode address = graph.unique(new OffsetAddressNode(n.object(), n.offset())); BarrierType barrierType = guessStoreBarrierType(n.object(), n.newValue()); LIRKind lirAccessKind = LIRKind.fromJavaKind(target.arch, valueKind); LoweredAtomicReadAndWriteNode memoryRead = graph.add(new LoweredAtomicReadAndWriteNode(address, n.getLocationIdentity(), newValue, lirAccessKind, barrierType)); memoryRead.setStateAfter(n.stateAfter()); ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead); n.stateAfter().replaceFirstInput(n, memoryRead); n.replaceAtUsages(readValue); graph.replaceFixedWithFixed(n, memoryRead); }
@Override public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) { // Emits a null-check for the otherwise unused receiver unsafe.get(); createUnsafeAccess(object, b, (obj, loc) -> new AtomicReadAndWriteNode(obj, offset, value, kind, loc)); return true; } });
checkUnsafeOffset(node.object(), node.offset()); if (node.object().getStackKind() == JavaKind.Object && node.newValue().getStackKind() == JavaKind.Object) { AnalysisType objectType = (AnalysisType) StampTool.typeOrNull(node.object()); TypeFlowBuilder<?> objectBuilder = state.lookup(node.object()); TypeFlowBuilder<?> newValueBuilder = state.lookup(node.newValue());
@Override public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) { // Emits a null-check for the otherwise unused receiver unsafe.get(); b.addPush(kind, new AtomicReadAndWriteNode(object, offset, value, kind, LocationIdentity.any())); b.getGraph().markUnsafeAccess(); return true; } });