Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import com.oracle.graal.pointsto.api.HostVM;
import com.oracle.graal.pointsto.api.PointstoOptions;
import com.oracle.graal.pointsto.constraints.UnsupportedFeatures;
import com.oracle.graal.pointsto.flow.AllSynchronizedTypeFlow;
import com.oracle.graal.pointsto.flow.AnyPrimitiveSourceTypeFlow;
import com.oracle.graal.pointsto.flow.FieldTypeFlow;
import com.oracle.graal.pointsto.flow.FormalParamTypeFlow;
Expand Down Expand Up @@ -104,7 +103,6 @@ public abstract class PointsToAnalysis extends AbstractAnalysisEngine {
*/
private final boolean trackPrimitiveValues;
private AnyPrimitiveSourceTypeFlow anyPrimitiveSourceTypeFlow;
private TypeFlow<?> allSynchronizedTypeFlow;

protected final boolean trackTypeFlowInputs;
protected final boolean reportAnalysisStatistics;
Expand Down Expand Up @@ -132,7 +130,6 @@ public PointsToAnalysis(OptionValues options, AnalysisUniverse universe, HostVM
* instantiated types yet, so the state is empty at first.
*/
objectType.getTypeFlow(this, true);
allSynchronizedTypeFlow = new AllSynchronizedTypeFlow();

trackTypeFlowInputs = PointstoOptions.TrackInputFlows.getValue(options);
reportAnalysisStatistics = PointstoOptions.PrintPointsToStatistics.getValue(options);
Expand Down Expand Up @@ -258,7 +255,6 @@ public boolean trackConcreteAnalysisObjects(@SuppressWarnings("unused") Analysis
@Override
public void cleanupAfterAnalysis() {
super.cleanupAfterAnalysis();
allSynchronizedTypeFlow = null;
anyPrimitiveSourceTypeFlow = null;
unsafeLoads = null;
unsafeStores = null;
Expand Down Expand Up @@ -287,25 +283,13 @@ public Iterable<AnalysisType> getAllInstantiatedTypes() {
return getAllInstantiatedTypeFlow().getState().types(this);
}

public TypeFlow<?> getAllSynchronizedTypeFlow() {
return allSynchronizedTypeFlow;
}

public AnyPrimitiveSourceTypeFlow getAnyPrimitiveSourceTypeFlow() {
return anyPrimitiveSourceTypeFlow;
}

@Override
public Iterable<AnalysisType> getAllSynchronizedTypes() {
/*
* If all-synchrnonized type flow, i.e., the type flow that keeps track of the types of all
* monitor objects, is saturated then we need to assume that any type can be used for
* monitors.
*/
if (allSynchronizedTypeFlow.isSaturated()) {
return getAllInstantiatedTypes();
}
return allSynchronizedTypeFlow.getState().types(this);
return getAllInstantiatedTypes();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
import jdk.graal.compiler.nodes.java.LoadFieldNode;
import jdk.graal.compiler.nodes.java.LoadIndexedNode;
import jdk.graal.compiler.nodes.java.MethodCallTargetNode;
import jdk.graal.compiler.nodes.java.MonitorEnterNode;
import jdk.graal.compiler.nodes.java.NewArrayNode;
import jdk.graal.compiler.nodes.java.NewArrayWithExceptionNode;
import jdk.graal.compiler.nodes.java.NewInstanceNode;
Expand Down Expand Up @@ -1122,18 +1121,6 @@ protected void node(FixedNode n) {
});
cloneBuilder.addObserverDependency(inputBuilder);
state.add(node.asFixedNode(), cloneBuilder);
} else if (n instanceof MonitorEnterNode) {
MonitorEnterNode node = (MonitorEnterNode) n;
TypeFlowBuilder<?> objectBuilder = state.lookup(node.object());

TypeFlowBuilder<?> monitorEntryBuilder = TypeFlowBuilder.create(bb, node, MonitorEnterTypeFlow.class, () -> {
MonitorEnterTypeFlow monitorEntryFlow = new MonitorEnterTypeFlow(AbstractAnalysisEngine.sourcePosition(node), bb);
flowsGraph.addMiscEntryFlow(monitorEntryFlow);
return monitorEntryFlow;
});
monitorEntryBuilder.addUseDependency(objectBuilder);
/* Monitor enters must not be removed. */
typeFlowGraphBuilder.registerSinkBuilder(monitorEntryBuilder);
} else if (n instanceof MacroInvokable node) {
/*
* Macro nodes can either be constant folded during compilation, or lowered back to
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import com.oracle.graal.pointsto.flow.LoadFieldTypeFlow.LoadInstanceFieldTypeFlow;
import com.oracle.graal.pointsto.flow.LoadFieldTypeFlow.LoadStaticFieldTypeFlow;
import com.oracle.graal.pointsto.flow.MergeTypeFlow;
import com.oracle.graal.pointsto.flow.MonitorEnterTypeFlow;
import com.oracle.graal.pointsto.flow.NewInstanceTypeFlow;
import com.oracle.graal.pointsto.flow.NullCheckTypeFlow;
import com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.LoadIndexedTypeFlow;
Expand Down Expand Up @@ -506,9 +505,6 @@ private static String asString(TypeFlow<?> flow) {
return "Source @ " + formatSource(flow);
} else if (flow instanceof CloneTypeFlow) {
return "Clone @ " + formatSource(flow);
} else if (flow instanceof MonitorEnterTypeFlow) {
MonitorEnterTypeFlow monitor = (MonitorEnterTypeFlow) flow;
return "MonitorEnter @ " + formatMethod(monitor.getSource().getMethod());
} else {
return ClassUtil.getUnqualifiedName(flow.getClass()) + "@" + formatSource(flow);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private void fixupReferencesBeforeCompaction(ChunkReleaser chunkReleaser, Timers

Timer oldFixupImageHeapTimer = timers.oldFixupImageHeap.open();
try {
for (ImageHeapInfo info = HeapImpl.getFirstImageHeapInfo(); info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
GCImpl.walkImageHeapRoots(info, fixupVisitor);
}
if (AuxiliaryImageHeap.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ private void blackenDirtyImageHeapRoots() {

Timer blackenImageHeapRootsTimer = timers.blackenImageHeapRoots.open();
try {
for (ImageHeapInfo info = HeapImpl.getFirstImageHeapInfo(); info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
blackenDirtyImageHeapChunkRoots(info.getFirstWritableAlignedChunk(), info.getFirstWritableUnalignedChunk(), info.getLastWritableUnalignedChunk());
}

Expand Down Expand Up @@ -964,7 +964,7 @@ private void blackenImageHeapRoots() {

Timer blackenImageHeapRootsTimer = timers.blackenImageHeapRoots.open();
try {
for (ImageHeapInfo info = HeapImpl.getFirstImageHeapInfo(); info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
blackenImageHeapRoots(info);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import com.oracle.svm.core.jdk.UninterruptibleUtils.AtomicReference;
import com.oracle.svm.core.jfr.JfrTicks;
import com.oracle.svm.core.jfr.events.SystemGCEvent;
import com.oracle.svm.core.layeredimagesingleton.MultiLayeredImageSingleton;
import com.oracle.svm.core.locks.VMCondition;
import com.oracle.svm.core.locks.VMMutex;
import com.oracle.svm.core.log.Log;
Expand Down Expand Up @@ -105,7 +106,6 @@ public final class HeapImpl extends Heap {
private final ObjectHeaderImpl objectHeaderImpl = new ObjectHeaderImpl();
private final GCImpl gcImpl;
private final RuntimeCodeInfoGCSupportImpl runtimeCodeInfoGcSupport;
private final ImageHeapInfo firstImageHeapInfo = new ImageHeapInfo();
private final HeapAccounting accounting = new HeapAccounting();

/** Head of the linked list of currently pending (ready to be enqueued) {@link Reference}s. */
Expand Down Expand Up @@ -140,9 +140,9 @@ public static HeapImpl getHeapImpl() {
return (HeapImpl) heap;
}

@Fold
public static ImageHeapInfo getFirstImageHeapInfo() {
return getHeapImpl().firstImageHeapInfo;
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static ImageHeapInfo[] getImageHeapInfos() {
return MultiLayeredImageSingleton.getAllLayers(ImageHeapInfo.class);
}

@Fold
Expand Down Expand Up @@ -177,7 +177,7 @@ public boolean isInPrimaryImageHeap(Object obj) {
@Override
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public boolean isInPrimaryImageHeap(Pointer objPointer) {
for (ImageHeapInfo info = firstImageHeapInfo; info != null; info = info.next) {
for (ImageHeapInfo info : getImageHeapInfos()) {
if (info.isInImageHeap(objPointer)) {
return true;
}
Expand Down Expand Up @@ -284,9 +284,10 @@ void logChunks(Log log) {
getChunkProvider().logFreeChunks(log);
}

@SuppressWarnings("static-method")
void logImageHeapPartitionBoundaries(Log log) {
log.string("Native image heap boundaries:").indent(true);
for (ImageHeapInfo info = firstImageHeapInfo; info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
info.print(log);
}
log.indent(false);
Expand Down Expand Up @@ -331,8 +332,8 @@ static void logZapValues(Log log) {
@Override
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public int getClassCount() {
int count = firstImageHeapInfo.dynamicHubCount;
for (ImageHeapInfo info = firstImageHeapInfo.next; info != null; info = info.next) {
int count = 0;
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
count += info.dynamicHubCount;
}
return count;
Expand All @@ -354,7 +355,7 @@ private ArrayList<Class<?>> findAllDynamicHubs() {
int dynamicHubCount = getClassCount();

ArrayList<Class<?>> list = new ArrayList<>(dynamicHubCount);
for (ImageHeapInfo info = firstImageHeapInfo; info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
ImageHeapWalker.walkRegions(info, new ClassListBuilderVisitor(list.size() + info.dynamicHubCount, list));
}

Expand Down Expand Up @@ -467,7 +468,7 @@ public boolean walkImageHeapObjects(ObjectVisitor visitor) {
if (visitor == null) {
return true;
}
for (ImageHeapInfo info = firstImageHeapInfo; info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
if (!ImageHeapWalker.walkImageHeapObjects(info, visitor)) {
return false;
}
Expand Down Expand Up @@ -731,7 +732,7 @@ public UnsignedWord getUsedMemoryAfterLastGC() {
}

private boolean printLocationInfo(Log log, Pointer ptr, boolean allowJavaHeapAccess, boolean allowUnsafeOperations) {
for (ImageHeapInfo info = firstImageHeapInfo; info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
if (info.isInReadOnlyRegularPartition(ptr)) {
log.string("points into the image heap (read-only)");
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public boolean verify(Occasion occasion) {

protected boolean verifyImageHeap() {
boolean success = true;
for (ImageHeapInfo info = HeapImpl.getFirstImageHeapInfo(); info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
success &= verifyAlignedChunks(null, info.getFirstWritableAlignedChunk());
success &= verifyUnalignedChunks(null, info.getFirstWritableUnalignedChunk(), info.getLastWritableUnalignedChunk());
}
Expand Down Expand Up @@ -129,7 +129,7 @@ private static boolean verifyRememberedSets() {
boolean success = true;
RememberedSet rememberedSet = RememberedSet.get();

for (ImageHeapInfo info = HeapImpl.getFirstImageHeapInfo(); info != null; info = info.next) {
for (ImageHeapInfo info : HeapImpl.getImageHeapInfos()) {
success &= rememberedSet.verify(info.getFirstWritableAlignedChunk());
success &= rememberedSet.verify(info.getFirstWritableUnalignedChunk(), info.getLastWritableUnalignedChunk());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*/
package com.oracle.svm.core.genscavenge;

import java.util.EnumSet;

import org.graalvm.word.Pointer;
import org.graalvm.word.UnsignedWord;
import org.graalvm.word.WordFactory;
Expand All @@ -35,6 +37,9 @@
import com.oracle.svm.core.heap.UnknownObjectField;
import com.oracle.svm.core.heap.UnknownPrimitiveField;
import com.oracle.svm.core.hub.LayoutEncoding;
import com.oracle.svm.core.layeredimagesingleton.LayeredImageSingletonBuilderFlags;
import com.oracle.svm.core.layeredimagesingleton.MultiLayeredImageSingleton;
import com.oracle.svm.core.layeredimagesingleton.UnsavedSingleton;
import com.oracle.svm.core.log.Log;
import com.oracle.svm.core.snippets.KnownIntrinsics;

Expand All @@ -44,7 +49,7 @@
* Information on the multiple partitions that make up the image heap, which don't necessarily form
* a contiguous block of memory (there can be holes in between), and their boundaries.
*/
public final class ImageHeapInfo {
public final class ImageHeapInfo implements MultiLayeredImageSingleton, UnsavedSingleton {
/** Indicates no chunk with {@link #initialize} chunk offset parameters. */
public static final long NO_CHUNK = -1;

Expand Down Expand Up @@ -73,14 +78,7 @@ public final class ImageHeapInfo {

@UnknownPrimitiveField(availability = AfterHeapLayout.class) public int dynamicHubCount;

public final ImageHeapInfo next;

public ImageHeapInfo() {
this(null);
}

public ImageHeapInfo(ImageHeapInfo next) {
this.next = next;
}

@SuppressWarnings("hiding")
Expand Down Expand Up @@ -205,4 +203,9 @@ public void print(Log log) {
log.string("Writable Huge: ").zhex(Word.objectToUntrackedPointer(firstWritableHugeObject)).string(" - ").zhex(getObjectEnd(lastWritableHugeObject)).newline();
log.string("ReadOnly Huge: ").zhex(Word.objectToUntrackedPointer(firstReadOnlyHugeObject)).string(" - ").zhex(getObjectEnd(lastReadOnlyHugeObject)).newline();
}

@Override
public EnumSet<LayeredImageSingletonBuilderFlags> getImageBuilderFlags() {
return LayeredImageSingletonBuilderFlags.ALL_ACCESS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public void afterRegistration(AfterRegistrationAccess access) {

@Override
public void duringSetup(DuringSetupAccess access) {
HeapImpl heap = new HeapImpl();
ImageSingletons.add(Heap.class, heap);
ImageSingletons.add(Heap.class, new HeapImpl());
ImageSingletons.add(ImageHeapInfo.class, new ImageHeapInfo());
ImageSingletons.add(GCAllocationSupport.class, new GenScavengeAllocationSupport());

if (ImageSingletons.contains(PerfManager.class)) {
Expand Down Expand Up @@ -125,16 +125,19 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
access.registerAsUsed(Object[].class);
}

private static ImageHeapInfo getImageHeapInfo() {
return ImageSingletons.lookup(ImageHeapInfo.class);
}

@Override
public void afterAnalysis(AfterAnalysisAccess access) {
ImageHeapLayouter heapLayouter = new ChunkedImageHeapLayouter(HeapImpl.getFirstImageHeapInfo(), Heap.getHeap().getImageHeapOffsetInAddressSpace());
ImageHeapLayouter heapLayouter = new ChunkedImageHeapLayouter(getImageHeapInfo(), Heap.getHeap().getImageHeapOffsetInAddressSpace());
ImageSingletons.add(ImageHeapLayouter.class, heapLayouter);
}

@Override
public void beforeCompilation(BeforeCompilationAccess access) {
ImageHeapInfo imageHeapInfo = HeapImpl.getFirstImageHeapInfo();
access.registerAsImmutable(imageHeapInfo);
access.registerAsImmutable(getImageHeapInfo());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private static Object doClone(Object original) throws CloneNotSupportedException
int firstFieldOffset = ConfigurationValues.getObjectLayout().getFirstFieldOffset();
int curOffset = firstFieldOffset;

NonmovableArray<Byte> referenceMapEncoding = DynamicHubSupport.getReferenceMapEncoding();
NonmovableArray<Byte> referenceMapEncoding = DynamicHubSupport.forLayer(hub.getLayerId()).getReferenceMapEncoding();
int referenceSize = ConfigurationValues.getObjectLayout().getReferenceSize();
int referenceMapIndex = hub.getReferenceMapIndex();
int entryCount = NonmovableByteArrayReader.getS4(referenceMapEncoding, referenceMapIndex);
Expand Down
Loading