diff --git a/substratevm/src/com.oracle.graal.pointsto.standalone/src/com/oracle/graal/pointsto/standalone/features/StandaloneAnalysisFeatureImpl.java b/substratevm/src/com.oracle.graal.pointsto.standalone/src/com/oracle/graal/pointsto/standalone/features/StandaloneAnalysisFeatureImpl.java index 2b9beff9946..c68b2ebc63c 100644 --- a/substratevm/src/com.oracle.graal.pointsto.standalone/src/com/oracle/graal/pointsto/standalone/features/StandaloneAnalysisFeatureImpl.java +++ b/substratevm/src/com.oracle.graal.pointsto.standalone/src/com/oracle/graal/pointsto/standalone/features/StandaloneAnalysisFeatureImpl.java @@ -49,7 +49,6 @@ import com.oracle.graal.pointsto.meta.AnalysisType; import com.oracle.graal.pointsto.meta.AnalysisUniverse; import com.oracle.graal.pointsto.standalone.StandaloneHost; -import com.oracle.svm.util.UnsafePartitionKind; import jdk.graal.compiler.debug.DebugContext; @@ -226,14 +225,8 @@ public void registerAsFrozenUnsafeAccessed(AnalysisField aField) { registerAsUnsafeAccessed(aField, "registered from standalone feature"); } - public void registerAsUnsafeAccessed(Field field, UnsafePartitionKind partitionKind, Object reason) { - registerAsUnsafeAccessed(getMetaAccess().lookupJavaField(field), partitionKind, reason); - } - - public void registerAsUnsafeAccessed(AnalysisField aField, UnsafePartitionKind partitionKind, Object reason) { - if (!aField.isUnsafeAccessed()) { - aField.registerAsUnsafeAccessed(partitionKind, reason); - } + public void registerAsUnsafeAccessed(Field field, Object reason) { + registerAsUnsafeAccessed(getMetaAccess().lookupJavaField(field), reason); } public void registerAsInvoked(Executable method, boolean invokeSpecial, Object reason) { diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/PointsToAnalysis.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/PointsToAnalysis.java index 13031a1a62d..7eae513143d 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/PointsToAnalysis.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/PointsToAnalysis.java @@ -80,8 +80,6 @@ import jdk.graal.compiler.api.replacements.SnippetReflectionProvider; import jdk.graal.compiler.debug.DebugContext; import jdk.graal.compiler.debug.Indent; -import jdk.graal.compiler.graph.Node; -import jdk.graal.compiler.graph.NodeList; import jdk.graal.compiler.options.OptionValues; import jdk.graal.compiler.word.WordTypes; import jdk.vm.ci.meta.ConstantReflectionProvider; @@ -280,14 +278,6 @@ public AnalysisType getObjectArrayType() { return metaAccess.lookupJavaType(Object[].class); } - public AnalysisType getGraalNodeType() { - return metaAccess.lookupJavaType(Node.class); - } - - public AnalysisType getGraalNodeListType() { - return metaAccess.lookupJavaType(NodeList.class); - } - public TypeFlow getAllInstantiatedTypeFlow() { return objectType.getTypeFlow(this, true); } diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/api/DefaultUnsafePartition.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/api/DefaultUnsafePartition.java deleted file mode 100644 index 8082f808943..00000000000 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/api/DefaultUnsafePartition.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.pointsto.api; - -import com.oracle.svm.util.UnsafePartitionKind; - -/** - * Marker for default unsafe accesses. - */ -public final class DefaultUnsafePartition implements UnsafePartitionKind { - - private static final DefaultUnsafePartition thisPartition = new DefaultUnsafePartition(); - - private DefaultUnsafePartition() { - } - - public static UnsafePartitionKind get() { - return thisPartition; - } - - @Override - public String toString() { - return "DEFAULT"; - } -} diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/MethodTypeFlowBuilder.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/MethodTypeFlowBuilder.java index f83d937e307..14610cb150d 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/MethodTypeFlowBuilder.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/MethodTypeFlowBuilder.java @@ -44,9 +44,7 @@ import com.oracle.graal.pointsto.flow.MethodFlowsGraph.GraphKind; import com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.LoadIndexedTypeFlow; import com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.UnsafeLoadTypeFlow; -import com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.UnsafePartitionLoadTypeFlow; import com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.StoreIndexedTypeFlow; -import com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.UnsafePartitionStoreTypeFlow; import com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.UnsafeStoreTypeFlow; import com.oracle.graal.pointsto.flow.StoreFieldTypeFlow.StoreInstanceFieldTypeFlow; import com.oracle.graal.pointsto.flow.StoreFieldTypeFlow.StoreStaticFieldTypeFlow; @@ -57,8 +55,6 @@ import com.oracle.graal.pointsto.meta.AnalysisType; import com.oracle.graal.pointsto.meta.HostedProviders; import com.oracle.graal.pointsto.meta.PointsToAnalysisMethod; -import com.oracle.graal.pointsto.nodes.UnsafePartitionLoadNode; -import com.oracle.graal.pointsto.nodes.UnsafePartitionStoreNode; import com.oracle.graal.pointsto.phases.InlineBeforeAnalysis; import com.oracle.graal.pointsto.results.StrengthenGraphs; import com.oracle.graal.pointsto.typestate.TypeState; @@ -1060,65 +1056,6 @@ protected void node(FixedNode n) { processStoreIndexed(node, node.array(), node.value(), node.value().getStackKind(), state); processImplicitNonNull(node.array(), state); - } else if (n instanceof UnsafePartitionLoadNode) { - UnsafePartitionLoadNode node = (UnsafePartitionLoadNode) n; - assert node.object().getStackKind() == JavaKind.Object : node.object(); - - checkUnsafeOffset(node.object(), node.offset()); - - AnalysisType partitionType = (AnalysisType) node.partitionType(); - - AnalysisType objectType = (AnalysisType) StampTool.typeOrNull(node.object(), bb.getMetaAccess()); - assert bb.getGraalNodeType().isAssignableFrom(objectType) : objectType; - - /* Use the Object type as a conservative type for the values loaded. */ - AnalysisType componentType = bb.getObjectType(); - - TypeFlowBuilder objectBuilder = state.lookup(node.object()); - TypeFlowBuilder unsafeLoadBuilder = TypeFlowBuilder.create(bb, node, UnsafePartitionLoadTypeFlow.class, () -> { - UnsafePartitionLoadTypeFlow loadTypeFlow = new UnsafePartitionLoadTypeFlow(AbstractAnalysisEngine.sourcePosition(node), objectType, componentType, objectBuilder.get(), - node.unsafePartitionKind(), partitionType); - flowsGraph.addMiscEntryFlow(loadTypeFlow); - return loadTypeFlow; - }); - unsafeLoadBuilder.addObserverDependency(objectBuilder); - state.add(node, unsafeLoadBuilder); - - } else if (n instanceof UnsafePartitionStoreNode) { - UnsafePartitionStoreNode node = (UnsafePartitionStoreNode) n; - - assert node.object().getStackKind() == JavaKind.Object : node.object(); - assert node.value().getStackKind() == JavaKind.Object : node.value(); - - checkUnsafeOffset(node.object(), node.offset()); - - AnalysisType partitionType = (AnalysisType) node.partitionType(); - - AnalysisType objectType = (AnalysisType) StampTool.typeOrNull(node.object(), bb.getMetaAccess()); - assert bb.getGraalNodeType().isAssignableFrom(objectType) : objectType; - - /* Use the Object type as a conservative type for the values stored. */ - AnalysisType componentType = bb.getObjectType(); - - AnalysisType valueType = (AnalysisType) StampTool.typeOrNull(node.value(), bb.getMetaAccess()); - assert valueType.isJavaLangObject() || bb.getGraalNodeType().isAssignableFrom(valueType) || bb.getGraalNodeListType().isAssignableFrom(valueType) : valueType; - - TypeFlowBuilder objectBuilder = state.lookup(node.object()); - TypeFlowBuilder valueBuilder = state.lookup(node.value()); - - TypeFlowBuilder unsafeStoreBuilder = TypeFlowBuilder.create(bb, node, UnsafePartitionStoreTypeFlow.class, () -> { - UnsafePartitionStoreTypeFlow storeTypeFlow = new UnsafePartitionStoreTypeFlow(AbstractAnalysisEngine.sourcePosition(node), objectType, componentType, objectBuilder.get(), - valueBuilder.get(), - node.partitionKind(), partitionType); - flowsGraph.addMiscEntryFlow(storeTypeFlow); - return storeTypeFlow; - }); - unsafeStoreBuilder.addUseDependency(valueBuilder); - unsafeStoreBuilder.addObserverDependency(objectBuilder); - - /* Unsafe stores must not be removed. */ - typeFlowGraphBuilder.registerSinkBuilder(unsafeStoreBuilder); - } else if (n instanceof RawLoadNode node) { modelUnsafeReadOnlyFlow(node, node.object(), node.offset()); } else if (n instanceof RawStoreNode node) { diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/OffsetLoadTypeFlow.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/OffsetLoadTypeFlow.java index cb9a2b3917e..ca3c6d4713c 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/OffsetLoadTypeFlow.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/OffsetLoadTypeFlow.java @@ -29,7 +29,6 @@ import com.oracle.graal.pointsto.meta.AnalysisField; import com.oracle.graal.pointsto.meta.AnalysisType; import com.oracle.graal.pointsto.typestate.TypeState; -import com.oracle.svm.util.UnsafePartitionKind; import jdk.vm.ci.code.BytecodePosition; @@ -250,58 +249,4 @@ public String toString() { return "UnsafeLoadTypeFlow<" + getState() + ">"; } } - - public static class UnsafePartitionLoadTypeFlow extends AbstractUnsafeLoadTypeFlow { - - protected final UnsafePartitionKind partitionKind; - protected final AnalysisType partitionType; - - public UnsafePartitionLoadTypeFlow(BytecodePosition loadLocation, AnalysisType objectType, AnalysisType componentType, TypeFlow arrayFlow, - UnsafePartitionKind partitionKind, AnalysisType partitionType) { - super(loadLocation, objectType, componentType, arrayFlow); - this.partitionKind = partitionKind; - this.partitionType = partitionType; - } - - private UnsafePartitionLoadTypeFlow(PointsToAnalysis bb, MethodFlowsGraph methodFlows, UnsafePartitionLoadTypeFlow original) { - super(bb, methodFlows, original); - this.partitionKind = original.partitionKind; - this.partitionType = original.partitionType; - } - - @Override - public AbstractUnsafeLoadTypeFlow copy(PointsToAnalysis bb, MethodFlowsGraph methodFlows) { - return new UnsafePartitionLoadTypeFlow(bb, methodFlows, this); - } - - @Override - public TypeState filter(PointsToAnalysis bb, TypeState update) { - if (partitionType.equals(bb.getObjectType())) { - /* No need to filter. */ - return update; - } else { - /* Filter the incoming state with the partition type. */ - return TypeState.forIntersection(bb, update, partitionType.getAssignableTypes(true)); - } - } - - @Override - public void onObservedUpdate(PointsToAnalysis bb) { - TypeState objectState = getObjectState(); - - for (AnalysisObject object : objectState.objects(bb)) { - AnalysisType objectType = object.type(); - assert !objectType.isArray() : objectType; - - for (AnalysisField field : objectType.unsafeAccessedFields(partitionKind)) { - processField(bb, object, field); - } - } - } - - @Override - public String toString() { - return "UnsafePartitionLoadTypeFlow<" + getState() + "> : " + partitionKind; - } - } } diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/OffsetStoreTypeFlow.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/OffsetStoreTypeFlow.java index 4501111a9f1..a5b2e2ea43e 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/OffsetStoreTypeFlow.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/flow/OffsetStoreTypeFlow.java @@ -27,13 +27,11 @@ import java.util.List; import com.oracle.graal.pointsto.PointsToAnalysis; -import com.oracle.graal.pointsto.api.DefaultUnsafePartition; import com.oracle.graal.pointsto.flow.context.object.AnalysisObject; import com.oracle.graal.pointsto.meta.AnalysisField; import com.oracle.graal.pointsto.meta.AnalysisType; import com.oracle.graal.pointsto.meta.PointsToAnalysisType; import com.oracle.graal.pointsto.typestate.TypeState; -import com.oracle.svm.util.UnsafePartitionKind; import jdk.vm.ci.code.BytecodePosition; @@ -271,7 +269,7 @@ public void onObservedUpdate(PointsToAnalysis bb) { TypeFlow elementsFlow = object.getArrayElementsFlow(bb, true); this.addUse(bb, elementsFlow); } else { - handleUnsafeAccessedFields(bb, type.unsafeAccessedFields(DefaultUnsafePartition.get()), object); + handleUnsafeAccessedFields(bb, type.unsafeAccessedFields(), object); } } } @@ -305,63 +303,4 @@ public String toString() { return "UnsafeStoreTypeFlow<" + getState() + ">"; } } - - public static class UnsafePartitionStoreTypeFlow extends AbstractUnsafeStoreTypeFlow { - - protected final UnsafePartitionKind partitionKind; - protected final AnalysisType partitionType; - - public UnsafePartitionStoreTypeFlow(BytecodePosition storeLocation, AnalysisType objectType, AnalysisType componentType, TypeFlow objectFlow, TypeFlow valueFlow, - UnsafePartitionKind partitionKind, AnalysisType partitionType) { - super(storeLocation, objectType, componentType, objectFlow, valueFlow); - this.partitionKind = partitionKind; - this.partitionType = partitionType; - } - - public UnsafePartitionStoreTypeFlow(PointsToAnalysis bb, MethodFlowsGraph methodFlows, UnsafePartitionStoreTypeFlow original) { - super(bb, methodFlows, original); - this.partitionKind = original.partitionKind; - this.partitionType = original.partitionType; - } - - @Override - public UnsafePartitionStoreTypeFlow makeCopy(PointsToAnalysis bb, MethodFlowsGraph methodFlows) { - return new UnsafePartitionStoreTypeFlow(bb, methodFlows, this); - } - - @Override - public TypeState filter(PointsToAnalysis bb, TypeState update) { - if (partitionType.equals(bb.getObjectType())) { - /* No need to filter. */ - return update; - } else { - /* Filter the incoming state with the partition type. */ - return TypeState.forIntersection(bb, update, partitionType.getAssignableTypes(true)); - } - } - - @Override - public void onObservedUpdate(PointsToAnalysis bb) { - TypeState objectState = objectFlow.getState(); - - /* Iterate over the receiver objects. */ - for (AnalysisObject object : objectState.objects(bb)) { - AnalysisType type = object.type(); - assert !type.isArray() : type; - - handleUnsafeAccessedFields(bb, type.unsafeAccessedFields(partitionKind), object); - } - } - - @Override - public void onObservedSaturated(PointsToAnalysis bb, TypeFlow observed) { - /* When receiver object flow saturates start observing the flow of the object type. */ - replaceObservedWith(bb, objectType); - } - - @Override - public String toString() { - return "UnsafePartitionStoreTypeFlow<" + getState() + "> : " + partitionKind; - } - } } diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java index 1522ce0e662..86446ccfeb6 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java @@ -32,7 +32,6 @@ import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; -import com.oracle.graal.pointsto.api.DefaultUnsafePartition; import com.oracle.graal.pointsto.api.HostVM; import com.oracle.graal.pointsto.api.PointstoOptions; import com.oracle.graal.pointsto.flow.ContextInsensitiveFieldTypeFlow; @@ -44,7 +43,6 @@ import com.oracle.graal.pointsto.util.AnalysisError; import com.oracle.graal.pointsto.util.AnalysisFuture; import com.oracle.graal.pointsto.util.AtomicUtils; -import com.oracle.svm.util.UnsafePartitionKind; import jdk.graal.compiler.debug.GraalError; import jdk.vm.ci.code.BytecodePosition; @@ -323,11 +321,7 @@ public void registerAsFolded(Object reason) { } } - public void registerAsUnsafeAccessed(Object reason) { - registerAsUnsafeAccessed(DefaultUnsafePartition.get(), reason); - } - - public boolean registerAsUnsafeAccessed(UnsafePartitionKind partitionKind, Object reason) { + public boolean registerAsUnsafeAccessed(Object reason) { assert isValidReason(reason) : "Registering a field as unsafe accessed needs to provide a valid reason."; registerAsAccessed(reason); /* @@ -356,7 +350,7 @@ public boolean registerAsUnsafeAccessed(UnsafePartitionKind partitionKind, Objec } else { /* Register the instance field as unsafe accessed on the declaring type. */ AnalysisType declaringType = getDeclaringClass(); - declaringType.registerUnsafeAccessedField(this, partitionKind); + declaringType.registerUnsafeAccessedField(this); } return true; } diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java index 73837a55095..b3e066b3ade 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java @@ -26,14 +26,12 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; @@ -46,7 +44,6 @@ import com.oracle.graal.pointsto.BigBang; import com.oracle.graal.pointsto.ObjectScanner.ScanReason; import com.oracle.graal.pointsto.PointsToAnalysis; -import com.oracle.graal.pointsto.api.DefaultUnsafePartition; import com.oracle.graal.pointsto.constraints.UnsupportedFeatureException; import com.oracle.graal.pointsto.flow.AllInstantiatedTypeFlow; import com.oracle.graal.pointsto.flow.TypeFlow; @@ -63,7 +60,6 @@ import com.oracle.graal.pointsto.util.ConcurrentLightHashMap; import com.oracle.graal.pointsto.util.ConcurrentLightHashSet; import com.oracle.svm.util.LogUtils; -import com.oracle.svm.util.UnsafePartitionKind; import jdk.graal.compiler.debug.GraalError; import jdk.vm.ci.code.BytecodePosition; @@ -78,9 +74,8 @@ public abstract class AnalysisType extends AnalysisElement implements WrappedJavaType, OriginalClassProvider, Comparable { - @SuppressWarnings("rawtypes")// - private static final AtomicReferenceFieldUpdater UNSAFE_ACCESS_FIELDS_UPDATER = // - AtomicReferenceFieldUpdater.newUpdater(AnalysisType.class, ConcurrentHashMap.class, "unsafeAccessedFields"); + private static final AtomicReferenceFieldUpdater UNSAFE_ACCESS_FIELDS_UPDATER = // + AtomicReferenceFieldUpdater.newUpdater(AnalysisType.class, Object.class, "unsafeAccessedFields"); private static final AtomicReferenceFieldUpdater UNIQUE_CONSTANT_UPDATER = // AtomicReferenceFieldUpdater.newUpdater(AnalysisType.class, AnalysisObject.class, "uniqueConstant"); @@ -124,15 +119,8 @@ public abstract class AnalysisType extends AnalysisElement implements WrappedJav @SuppressWarnings("unused") private volatile int isAnySubtypeInstantiated; private boolean reachabilityListenerNotified; private boolean unsafeFieldsRecomputed; - private boolean unsafeAccessedFieldsRegistered; - /** - * Unsafe accessed fields for this type. - * - * This field can be initialized during the multithreaded analysis phase in case of the computed - * value fields, thus we use the UNSAFE_ACCESS_FIELDS_UPDATER to initialize it. - */ - private volatile ConcurrentHashMap> unsafeAccessedFields; + private volatile Object unsafeAccessedFields; /** Immediate subtypes and this type itself. */ private final Set subTypes; @@ -803,30 +791,8 @@ public void registerUnsafeFieldsRecomputed() { * This is controlled by the isUnsafeAccessed flag in the AnalysField. Also, a field cannot be * part of more than one partitions. */ - public void registerUnsafeAccessedField(AnalysisField field, UnsafePartitionKind partitionKind) { - - unsafeAccessedFieldsRegistered = true; - - if (unsafeAccessedFields == null) { - /* Lazily initialize the map, not all types have unsafe accessed fields. */ - UNSAFE_ACCESS_FIELDS_UPDATER.compareAndSet(this, null, new ConcurrentHashMap<>()); - } - - Collection unsafePartition = unsafeAccessedFields.get(partitionKind); - if (unsafePartition == null) { - /* - * We use a thread safe collection to store an unsafe accessed fields partition. Since - * elements can be added to it concurrently using a non thread safe collection, such as - * an array list, can result in null being added to the list. Since we don't need index - * access ConcurrentLinkedQueue is a good match. - */ - Collection newPartition = new ConcurrentLinkedQueue<>(); - Collection oldPartition = unsafeAccessedFields.putIfAbsent(partitionKind, newPartition); - unsafePartition = oldPartition != null ? oldPartition : newPartition; - } - - assert !unsafePartition.contains(field) : "Field " + field + " already registered as unsafe accessed with " + this; - unsafePartition.add(field); + public void registerUnsafeAccessedField(AnalysisField field) { + ConcurrentLightHashSet.addElement(this, UNSAFE_ACCESS_FIELDS_UPDATER, field); } private boolean hasUnsafeAccessedFields() { @@ -840,14 +806,10 @@ private boolean hasUnsafeAccessedFields() { * is registered as unsafe during the analysis and then walk down the type hierarchy and * invalidate the cached value of all the sub-types. */ - return unsafeAccessedFieldsRegistered || (getSuperclass() != null && getSuperclass().hasUnsafeAccessedFields()); + return ConcurrentLightHashSet.size(unsafeAccessedFields) > 0 || (getSuperclass() != null && getSuperclass().hasUnsafeAccessedFields()); } public List unsafeAccessedFields() { - return unsafeAccessedFields(DefaultUnsafePartition.get()); - } - - public List unsafeAccessedFields(UnsafePartitionKind partitionKind) { if (!hasUnsafeAccessedFields()) { /* * Do a quick check if this type has unsafe accessed fields before constructing the data @@ -856,10 +818,10 @@ public List unsafeAccessedFields(UnsafePartitionKind partitionKin */ return Collections.emptyList(); } - return allUnsafeAccessedFields(partitionKind); + return allUnsafeAccessedFields(); } - private List allUnsafeAccessedFields(UnsafePartitionKind partitionKind) { + private List allUnsafeAccessedFields() { /* * Walk up the type hierarchy and build the unsafe partition containing all the unsafe * fields of the current type and all its super types. The unsafePartition collection @@ -874,9 +836,9 @@ private List allUnsafeAccessedFields(UnsafePartitionKind partitio * race conditions. */ List unsafePartition = new ArrayList<>(); - unsafePartition.addAll(unsafeAccessedFields != null && unsafeAccessedFields.containsKey(partitionKind) ? unsafeAccessedFields.get(partitionKind) : Collections.emptyList()); + ConcurrentLightHashSet.forEach(this, UNSAFE_ACCESS_FIELDS_UPDATER, (AnalysisField field) -> unsafePartition.add(field)); if (getSuperclass() != null) { - List superFileds = getSuperclass().allUnsafeAccessedFields(partitionKind); + List superFileds = getSuperclass().allUnsafeAccessedFields(); unsafePartition.addAll(superFileds); } diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/PointsToAnalysisField.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/PointsToAnalysisField.java index 042bd2743d5..eed43a1e5e0 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/PointsToAnalysisField.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/PointsToAnalysisField.java @@ -31,7 +31,6 @@ import com.oracle.graal.pointsto.flow.StoreFieldTypeFlow.StoreInstanceFieldTypeFlow; import com.oracle.graal.pointsto.typestate.TypeState; import com.oracle.graal.pointsto.util.AtomicUtils; -import com.oracle.svm.util.UnsafePartitionKind; import jdk.vm.ci.code.BytecodePosition; import jdk.vm.ci.meta.ResolvedJavaField; @@ -81,8 +80,8 @@ public void cleanupAfterAnalysis() { } @Override - public boolean registerAsUnsafeAccessed(UnsafePartitionKind partitionKind, Object reason) { - if (super.registerAsUnsafeAccessed(partitionKind, reason)) { + public boolean registerAsUnsafeAccessed(Object reason) { + if (super.registerAsUnsafeAccessed(reason)) { if (fieldType.getStorageKind().isPrimitive()) { /* * Primitive type states are not propagated through unsafe loads/stores. Instead, diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/nodes/UnsafePartitionLoadNode.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/nodes/UnsafePartitionLoadNode.java deleted file mode 100644 index 0083df9f9db..00000000000 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/nodes/UnsafePartitionLoadNode.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.pointsto.nodes; - -import jdk.graal.compiler.graph.NodeClass; -import jdk.graal.compiler.nodeinfo.NodeInfo; -import jdk.graal.compiler.nodes.ValueNode; -import jdk.graal.compiler.nodes.extended.RawLoadNode; -import org.graalvm.word.LocationIdentity; - -import com.oracle.svm.util.UnsafePartitionKind; - -import jdk.vm.ci.meta.JavaKind; -import jdk.vm.ci.meta.ResolvedJavaType; - -@NodeInfo -public class UnsafePartitionLoadNode extends RawLoadNode { - public static final NodeClass TYPE = NodeClass.create(UnsafePartitionLoadNode.class); - - protected final UnsafePartitionKind partitionKind; - protected final ResolvedJavaType partitionType; - - public UnsafePartitionLoadNode(ValueNode object, ValueNode offset, JavaKind accessKind, LocationIdentity locationIdentity, UnsafePartitionKind partitionKind, - ResolvedJavaType partitionType) { - super(TYPE, object, offset, accessKind, locationIdentity); - this.partitionKind = partitionKind; - this.partitionType = partitionType; - } - - public UnsafePartitionKind unsafePartitionKind() { - return partitionKind; - } - - public ResolvedJavaType partitionType() { - return partitionType; - } -} diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/nodes/UnsafePartitionStoreNode.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/nodes/UnsafePartitionStoreNode.java deleted file mode 100644 index 8f359c87282..00000000000 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/nodes/UnsafePartitionStoreNode.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.pointsto.nodes; - -import jdk.graal.compiler.core.common.memory.MemoryOrderMode; -import jdk.graal.compiler.graph.NodeClass; -import jdk.graal.compiler.nodeinfo.NodeInfo; -import jdk.graal.compiler.nodes.ValueNode; -import jdk.graal.compiler.nodes.extended.RawStoreNode; -import org.graalvm.word.LocationIdentity; - -import com.oracle.svm.util.UnsafePartitionKind; - -import jdk.vm.ci.meta.JavaKind; -import jdk.vm.ci.meta.ResolvedJavaType; - -@NodeInfo -public class UnsafePartitionStoreNode extends RawStoreNode { - public static final NodeClass TYPE = NodeClass.create(UnsafePartitionStoreNode.class); - - protected final UnsafePartitionKind partitionKind; - protected final ResolvedJavaType partitionType; - - public UnsafePartitionStoreNode(ValueNode object, ValueNode offset, ValueNode value, JavaKind accessKind, LocationIdentity locationIdentity, UnsafePartitionKind partitionKind, - ResolvedJavaType partitionType) { - super(TYPE, object, offset, value, accessKind, locationIdentity, true, MemoryOrderMode.PLAIN, null, false); - this.partitionKind = partitionKind; - this.partitionType = partitionType; - } - - public UnsafePartitionKind partitionKind() { - return partitionKind; - } - - public ResolvedJavaType partitionType() { - return partitionType; - } -} diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/typestate/PointsToStats.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/typestate/PointsToStats.java index f5ca99aeee6..4eacb47b864 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/typestate/PointsToStats.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/typestate/PointsToStats.java @@ -67,9 +67,7 @@ import com.oracle.graal.pointsto.flow.NullCheckTypeFlow; import com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.LoadIndexedTypeFlow; import com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.UnsafeLoadTypeFlow; -import com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.UnsafePartitionLoadTypeFlow; import com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.StoreIndexedTypeFlow; -import com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.UnsafePartitionStoreTypeFlow; import com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.UnsafeStoreTypeFlow; import com.oracle.graal.pointsto.flow.SourceTypeFlow; import com.oracle.graal.pointsto.flow.StoreFieldTypeFlow.StoreInstanceFieldTypeFlow; @@ -465,8 +463,6 @@ private static String asString(TypeFlow flow) { return "IndexedStore @ " + formatSource(flow); } else if (flow instanceof UnsafeStoreTypeFlow) { return "UnsafeStore @ " + formatSource(flow); - } else if (flow instanceof UnsafePartitionStoreTypeFlow) { - return "UnsafePartitionStore @ " + formatSource(flow); } else if (flow instanceof UnsafeWriteSinkTypeFlow) { UnsafeWriteSinkTypeFlow sink = (UnsafeWriteSinkTypeFlow) flow; return "UnsafeWriteSink(" + formatField(sink.getSource()) + ")"; @@ -474,8 +470,6 @@ private static String asString(TypeFlow flow) { return "IndexedLoad @ " + formatSource(flow); } else if (flow instanceof UnsafeLoadTypeFlow) { return "UnsafeLoad @ " + formatSource(flow); - } else if (flow instanceof UnsafePartitionLoadTypeFlow) { - return "UnsafePartitionLoad @ " + formatSource(flow); } else if (flow instanceof ArrayElementsTypeFlow) { ArrayElementsTypeFlow arrayFlow = (ArrayElementsTypeFlow) flow; return "ArrayElements(" + (arrayFlow.object() != null ? arrayFlow.object().type().toJavaName(false) : "?") + ")"; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/GraalEdgeUnsafePartition.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/GraalEdgeUnsafePartition.java deleted file mode 100644 index b137585110b..00000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/GraalEdgeUnsafePartition.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.graal; - -import com.oracle.svm.util.UnsafePartitionKind; - -/** - * Marker for unsafe accesses to Graal edges. - */ -public final class GraalEdgeUnsafePartition implements UnsafePartitionKind { - - private static final GraalEdgeUnsafePartition thisPartition = new GraalEdgeUnsafePartition(); - - private GraalEdgeUnsafePartition() { - } - - public static UnsafePartitionKind get() { - return thisPartition; - } - - @Override - public String toString() { - return "GRAAL_EDGE"; - } -} diff --git a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/FieldsOffsetsFeature.java b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/FieldsOffsetsFeature.java index 2020c3e2cd5..04fab61102e 100644 --- a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/FieldsOffsetsFeature.java +++ b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/FieldsOffsetsFeature.java @@ -34,11 +34,9 @@ import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.hosted.Feature; -import com.oracle.graal.pointsto.api.DefaultUnsafePartition; import com.oracle.graal.pointsto.meta.AnalysisField; import com.oracle.svm.core.BuildPhaseProvider; import com.oracle.svm.core.fieldvaluetransformer.FieldValueTransformerWithAvailability; -import com.oracle.svm.core.graal.GraalEdgeUnsafePartition; import com.oracle.svm.core.util.VMError; import com.oracle.svm.graal.GraalCompilerSupport; import com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl; @@ -46,7 +44,6 @@ import com.oracle.svm.hosted.FeatureImpl.DuringAnalysisAccessImpl; import com.oracle.svm.hosted.FeatureImpl.DuringSetupAccessImpl; import com.oracle.svm.hosted.meta.HostedMetaAccess; -import com.oracle.svm.util.UnsafePartitionKind; import jdk.graal.compiler.core.common.FieldIntrospection; import jdk.graal.compiler.core.common.Fields; @@ -192,31 +189,31 @@ private static void registerFields(FieldIntrospection introspection, BeforeAn NodeClass nodeClass = (NodeClass) introspection; Fields dataFields = nodeClass.getData(); - registerFields(dataFields, DefaultUnsafePartition.get(), config, "Graal node data field"); + registerFields(dataFields, config, "Graal node data field"); Fields inputEdges = nodeClass.getInputEdges(); - registerFields(inputEdges, GraalEdgeUnsafePartition.get(), config, "Graal node input edge"); + registerFields(inputEdges, config, "Graal node input edge"); Fields successorEdges = nodeClass.getSuccessorEdges(); - registerFields(successorEdges, GraalEdgeUnsafePartition.get(), config, "Graal node successor edge"); + registerFields(successorEdges, config, "Graal node successor edge"); /* Ensure field shortName is initialized, so that the instance is immutable. */ nodeClass.shortName(); } else { for (Fields fields : introspection.getAllFields()) { - registerFields(fields, DefaultUnsafePartition.get(), config, "Graal field"); + registerFields(fields, config, "Graal field"); } } } - private static void registerFields(Fields fields, UnsafePartitionKind partitionKind, BeforeAnalysisAccessImpl config, Object reason) { + private static void registerFields(Fields fields, BeforeAnalysisAccessImpl config, Object reason) { getReplacements().put(fields.getOffsets(), new FieldsOffsetsReplacement(fields)); for (int i = 0; i < fields.getCount(); i++) { AnalysisField aField = config.getMetaAccess().lookupJavaField(findField(fields, i)); aField.getType().registerAsReachable(aField); - config.registerAsUnsafeAccessed(aField, partitionKind, reason); + config.registerAsUnsafeAccessed(aField, reason); } } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java index ba462db5a54..1e6e49492c4 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java @@ -54,7 +54,6 @@ import com.oracle.graal.pointsto.BigBang; import com.oracle.graal.pointsto.ObjectScanner; -import com.oracle.graal.pointsto.api.DefaultUnsafePartition; import com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor; import com.oracle.graal.pointsto.meta.AnalysisField; import com.oracle.graal.pointsto.meta.AnalysisMetaAccess; @@ -87,7 +86,6 @@ import com.oracle.svm.hosted.meta.HostedUniverse; import com.oracle.svm.hosted.option.HostedOptionProvider; import com.oracle.svm.util.ReflectionUtil; -import com.oracle.svm.util.UnsafePartitionKind; import jdk.graal.compiler.debug.Assertions; import jdk.graal.compiler.debug.DebugContext; @@ -403,16 +401,8 @@ public void registerAsUnsafeAccessed(Field field, Object reason) { } public boolean registerAsUnsafeAccessed(AnalysisField aField, Object reason) { - return registerAsUnsafeAccessed(aField, DefaultUnsafePartition.get(), reason); - } - - public void registerAsUnsafeAccessed(Field field, UnsafePartitionKind partitionKind, Object reason) { - registerAsUnsafeAccessed(getMetaAccess().lookupJavaField(field), partitionKind, reason); - } - - public boolean registerAsUnsafeAccessed(AnalysisField aField, UnsafePartitionKind partitionKind, Object reason) { assert !AnnotationAccess.isAnnotationPresent(aField, Delete.class); - return aField.registerAsUnsafeAccessed(partitionKind, reason); + return aField.registerAsUnsafeAccessed(reason); } public void registerAsFrozenUnsafeAccessed(Field field, Object reason) { diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/PointsToJsonObject.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/PointsToJsonObject.java index 39a178d4a86..504303be3ac 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/PointsToJsonObject.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/PointsToJsonObject.java @@ -428,8 +428,6 @@ public static class DashboardTypeFlowNames { names.put(OffsetStoreTypeFlow.StoreIndexedTypeFlow.class, "storeIndexed"); names.put(OffsetLoadTypeFlow.UnsafeLoadTypeFlow.class, "unsafeLoad"); names.put(OffsetStoreTypeFlow.UnsafeStoreTypeFlow.class, "unsafeStore"); - names.put(OffsetLoadTypeFlow.UnsafePartitionLoadTypeFlow.class, "unsafeLoad"); - names.put(OffsetStoreTypeFlow.UnsafePartitionStoreTypeFlow.class, "unsafeStore"); names.put(AllInstantiatedTypeFlow.class, "allInstantiated"); names.put(AllSynchronizedTypeFlow.class, "allSynchronized"); names.put(ArrayElementsTypeFlow.class, "arrayElements"); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java index 8b35c2e56b4..bb17223c64d 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/SubstrateGraphBuilderPlugins.java @@ -48,7 +48,6 @@ import org.graalvm.nativeimage.hosted.RuntimeProxyCreation; import org.graalvm.nativeimage.hosted.RuntimeReflection; import org.graalvm.nativeimage.hosted.RuntimeSerialization; -import org.graalvm.word.LocationIdentity; import org.graalvm.word.Pointer; import org.graalvm.word.PointerBase; import org.graalvm.word.UnsignedWord; @@ -56,8 +55,6 @@ import com.oracle.graal.pointsto.AbstractAnalysisEngine; import com.oracle.graal.pointsto.infrastructure.OriginalClassProvider; import com.oracle.graal.pointsto.meta.AnalysisType; -import com.oracle.graal.pointsto.nodes.UnsafePartitionLoadNode; -import com.oracle.graal.pointsto.nodes.UnsafePartitionStoreNode; import com.oracle.svm.common.meta.MultiMethod; import com.oracle.svm.core.FrameAccess; import com.oracle.svm.core.MissingRegistrationSupport; @@ -68,7 +65,6 @@ import com.oracle.svm.core.SubstrateOptions; import com.oracle.svm.core.classinitialization.EnsureClassInitializedNode; import com.oracle.svm.core.config.ConfigurationValues; -import com.oracle.svm.core.graal.GraalEdgeUnsafePartition; import com.oracle.svm.core.graal.jdk.SubstrateObjectCloneWithExceptionNode; import com.oracle.svm.core.graal.nodes.DeoptEntryNode; import com.oracle.svm.core.graal.nodes.FarReturnNode; @@ -98,15 +94,11 @@ import com.oracle.svm.hosted.ReachabilityRegistrationNode; import com.oracle.svm.hosted.nodes.DeoptProxyNode; import com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor; -import com.oracle.svm.util.ClassUtil; import jdk.graal.compiler.core.common.CompressEncoding; import jdk.graal.compiler.core.common.type.AbstractObjectStamp; import jdk.graal.compiler.core.common.type.IntegerStamp; import jdk.graal.compiler.core.common.type.StampFactory; -import jdk.graal.compiler.graph.Edges; -import jdk.graal.compiler.graph.Node; -import jdk.graal.compiler.graph.NodeList; import jdk.graal.compiler.java.BytecodeParser; import jdk.graal.compiler.java.LambdaUtils; import jdk.graal.compiler.nodes.AbstractBeginNode; @@ -198,7 +190,6 @@ public static void registerInvocationPlugins(AnnotationSubstitutionProcessor ann registerStackValuePlugins(plugins); registerArrayPlugins(plugins); registerClassPlugins(plugins); - registerEdgesPlugins(plugins); registerVMConfigurationPlugins(plugins); registerPlatformPlugins(plugins); registerSizeOfPlugins(plugins); @@ -1102,27 +1093,6 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec }); } - private static void registerEdgesPlugins(InvocationPlugins plugins) { - Registration r = new Registration(plugins, Edges.class).setAllowOverwrite(true); - for (Class c : new Class[]{Node.class, NodeList.class}) { - r.register(new RequiredInvocationPlugin("get" + ClassUtil.getUnqualifiedName(c) + "Unsafe", Node.class, long.class) { - @Override - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode node, ValueNode offset) { - b.addPush(JavaKind.Object, new UnsafePartitionLoadNode(node, offset, JavaKind.Object, LocationIdentity.any(), GraalEdgeUnsafePartition.get(), b.getMetaAccess().lookupJavaType(c))); - return true; - } - }); - - r.register(new RequiredInvocationPlugin("put" + ClassUtil.getUnqualifiedName(c) + "Unsafe", Node.class, long.class, c) { - @Override - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode node, ValueNode offset, ValueNode value) { - b.add(new UnsafePartitionStoreNode(node, offset, value, JavaKind.Object, LocationIdentity.any(), GraalEdgeUnsafePartition.get(), b.getMetaAccess().lookupJavaType(c))); - return true; - } - }); - } - } - protected static long longValue(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode node, String name) { if (!node.isConstant()) { throw b.bailout("parameter " + name + " is not a compile time constant for call to " + targetMethod.format("%H.%n(%p)") + " in " + b.getMethod().asStackTraceElement(b.bci())); diff --git a/substratevm/src/com.oracle.svm.util/src/com/oracle/svm/util/UnsafePartitionKind.java b/substratevm/src/com.oracle.svm.util/src/com/oracle/svm/util/UnsafePartitionKind.java deleted file mode 100644 index 12df320e834..00000000000 --- a/substratevm/src/com.oracle.svm.util/src/com/oracle/svm/util/UnsafePartitionKind.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.util; - -/** - * Markers for unsafe accesses. - */ -public interface UnsafePartitionKind { -}