Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
40bc2ec
Print heap base as part of diagnostics.
christianhaeubl Jun 24, 2021
b45921f
Use the state of the initial error if an error happens while printing…
christianhaeubl Jun 24, 2021
2c2c40d
Allow implicit exceptions while printing diagnostics.
christianhaeubl Jun 24, 2021
427d3ec
When printing diagnostics, print a hexdump of a short piece of the ma…
christianhaeubl Jun 24, 2021
ddef999
Print more information about signals.
christianhaeubl Jun 24, 2021
54cb5b2
Minor output formatting fix.
christianhaeubl Jun 24, 2021
9fcd79d
Minor renaming.
christianhaeubl Jun 24, 2021
436bc88
Added some stack information to VM diagnostics.
christianhaeubl Jun 24, 2021
fe62415
Improve the robustness of printing diagnostics.
christianhaeubl Jun 29, 2021
3cab5d7
VMMutex and CodeInfo-related changes.
christianhaeubl Jul 1, 2021
dd80fa5
Format pointers more consistently.
christianhaeubl Jul 1, 2021
fab7408
Fixed the code that is used for dumping information about runtime com…
christianhaeubl Jul 1, 2021
d6f58d3
Fixed GreyToBlackObjectVisitor.DiagnosticReporter.
christianhaeubl Jul 1, 2021
c1262ef
Various fixes.
christianhaeubl Jul 1, 2021
742333b
Formatting.
christianhaeubl Jul 2, 2021
44e4e82
StackOverflowCheckImpl.disableStackOverflowChecksForFatalError must n…
christianhaeubl Jul 5, 2021
dae43a4
Renamed mutexes to improve consistency.
christianhaeubl Jul 5, 2021
150f6ec
Print location information.
christianhaeubl Jul 6, 2021
726f646
More location printing and fixes.
christianhaeubl Jul 6, 2021
bbbf297
Style fixes.
christianhaeubl Jul 6, 2021
d15cbf5
Further fixes.
christianhaeubl Jul 7, 2021
da1e6d7
Various changes and refactorings.
christianhaeubl Jul 9, 2021
99f9a34
Enable stack overflow checks on all platforms.
christianhaeubl Jul 9, 2021
6a25603
Enable recursive segfault handling on Posix platforms.
christianhaeubl Jul 9, 2021
34bf53b
Cleanups.
christianhaeubl Jul 9, 2021
e1769eb
Various fixes.
christianhaeubl Jul 30, 2021
910c36d
Further cleanups.
christianhaeubl Jul 30, 2021
7c55d0f
Minor cleanups and documentation.
christianhaeubl Aug 6, 2021
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 @@ -97,6 +97,10 @@ public static Pointer getObjectsStart(AlignedHeader that) {
return HeapChunk.asPointer(that).add(getObjectsStartOffset());
}

public static Pointer getObjectsEnd(AlignedHeader that) {
return HeapChunk.getEndPointer(that);
}

/** Allocate uninitialized memory within this AlignedHeapChunk. */
static Pointer allocateMemory(AlignedHeader that, UnsignedWord size) {
Pointer result = WordFactory.nullPointer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private void printGCBefore(String cause) {
verboseGCLog.string(" AlignedChunkSize: ").unsigned(HeapPolicy.getAlignedHeapChunkSize()).newline();
verboseGCLog.string(" LargeArrayThreshold: ").unsigned(HeapPolicy.getLargeArrayThreshold()).string("]").newline();
if (HeapOptions.PrintHeapShape.getValue()) {
HeapImpl.getHeapImpl().logImageHeapPartitionBoundaries(verboseGCLog).newline();
HeapImpl.getHeapImpl().logImageHeapPartitionBoundaries(verboseGCLog);
}
}
if (SubstrateGCOptions.VerboseGC.getValue()) {
Expand Down Expand Up @@ -399,10 +399,10 @@ private static void verbosePostCondition() {
log.string("[GCImpl.postcondition: Eden space should be empty after a collection.").newline();
/* Print raw fields before trying to walk the chunk lists. */
log.string(" These should all be 0:").newline();
log.string(" Eden space first AlignedChunk: ").hex(youngGen.getEden().getFirstAlignedHeapChunk()).newline();
log.string(" Eden space last AlignedChunk: ").hex(youngGen.getEden().getLastAlignedHeapChunk()).newline();
log.string(" Eden space first UnalignedChunk: ").hex(youngGen.getEden().getFirstUnalignedHeapChunk()).newline();
log.string(" Eden space last UnalignedChunk: ").hex(youngGen.getEden().getLastUnalignedHeapChunk()).newline();
log.string(" Eden space first AlignedChunk: ").zhex(youngGen.getEden().getFirstAlignedHeapChunk()).newline();
log.string(" Eden space last AlignedChunk: ").zhex(youngGen.getEden().getLastAlignedHeapChunk()).newline();
log.string(" Eden space first UnalignedChunk: ").zhex(youngGen.getEden().getFirstUnalignedHeapChunk()).newline();
log.string(" Eden space last UnalignedChunk: ").zhex(youngGen.getEden().getLastUnalignedHeapChunk()).newline();
youngGen.getEden().report(log, true).newline();
log.string("]").newline();
}
Expand All @@ -411,10 +411,10 @@ private static void verbosePostCondition() {
log.string("[GCImpl.postcondition: Survivor toSpace should be empty after a collection.").newline();
/* Print raw fields before trying to walk the chunk lists. */
log.string(" These should all be 0:").newline();
log.string(" Survivor space ").signed(i).string(" first AlignedChunk: ").hex(youngGen.getSurvivorToSpaceAt(i).getFirstAlignedHeapChunk()).newline();
log.string(" Survivor space ").signed(i).string(" last AlignedChunk: ").hex(youngGen.getSurvivorToSpaceAt(i).getLastAlignedHeapChunk()).newline();
log.string(" Survivor space ").signed(i).string(" first UnalignedChunk: ").hex(youngGen.getSurvivorToSpaceAt(i).getFirstUnalignedHeapChunk()).newline();
log.string(" Survivor space ").signed(i).string(" last UnalignedChunk: ").hex(youngGen.getSurvivorToSpaceAt(i).getLastUnalignedHeapChunk()).newline();
log.string(" Survivor space ").signed(i).string(" first AlignedChunk: ").zhex(youngGen.getSurvivorToSpaceAt(i).getFirstAlignedHeapChunk()).newline();
log.string(" Survivor space ").signed(i).string(" last AlignedChunk: ").zhex(youngGen.getSurvivorToSpaceAt(i).getLastAlignedHeapChunk()).newline();
log.string(" Survivor space ").signed(i).string(" first UnalignedChunk: ").zhex(youngGen.getSurvivorToSpaceAt(i).getFirstUnalignedHeapChunk()).newline();
log.string(" Survivor space ").signed(i).string(" last UnalignedChunk: ").zhex(youngGen.getSurvivorToSpaceAt(i).getLastUnalignedHeapChunk()).newline();
youngGen.getSurvivorToSpaceAt(i).report(log, true).newline();
log.string("]").newline();
}
Expand All @@ -423,10 +423,10 @@ private static void verbosePostCondition() {
log.string("[GCImpl.postcondition: oldGen toSpace should be empty after a collection.").newline();
/* Print raw fields before trying to walk the chunk lists. */
log.string(" These should all be 0:").newline();
log.string(" oldGen toSpace first AlignedChunk: ").hex(oldGen.getToSpace().getFirstAlignedHeapChunk()).newline();
log.string(" oldGen toSpace last AlignedChunk: ").hex(oldGen.getToSpace().getLastAlignedHeapChunk()).newline();
log.string(" oldGen.toSpace first UnalignedChunk: ").hex(oldGen.getToSpace().getFirstUnalignedHeapChunk()).newline();
log.string(" oldGen.toSpace last UnalignedChunk: ").hex(oldGen.getToSpace().getLastUnalignedHeapChunk()).newline();
log.string(" oldGen toSpace first AlignedChunk: ").zhex(oldGen.getToSpace().getFirstAlignedHeapChunk()).newline();
log.string(" oldGen toSpace last AlignedChunk: ").zhex(oldGen.getToSpace().getLastAlignedHeapChunk()).newline();
log.string(" oldGen.toSpace first UnalignedChunk: ").zhex(oldGen.getToSpace().getFirstUnalignedHeapChunk()).newline();
log.string(" oldGen.toSpace last UnalignedChunk: ").zhex(oldGen.getToSpace().getLastUnalignedHeapChunk()).newline();
oldGen.getToSpace().report(log, true).newline();
oldGen.getFromSpace().report(log, true).newline();
log.string("]").newline();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ void setScanStart(Space s) {
space = s;
AlignedHeapChunk.AlignedHeader aChunk = s.getLastAlignedHeapChunk();
alignedHeapChunk = aChunk;
trace.string(" alignedHeapChunk: ").hex(alignedHeapChunk).string(" isNull: ").bool(aChunk.isNull());
trace.string(" alignedHeapChunk: ").zhex(alignedHeapChunk).string(" isNull: ").bool(aChunk.isNull());
alignedTop = (aChunk.isNonNull() ? HeapChunk.getTopPointer(aChunk) : WordFactory.nullPointer());
trace.string(" alignedTop: ").hex(alignedTop);
trace.string(" alignedTop: ").zhex(alignedTop);
unalignedHeapChunk = s.getLastUnalignedHeapChunk();
trace.string(" unalignedChunkPointer: ").hex(unalignedHeapChunk).string("]").newline();
trace.string(" unalignedChunkPointer: ").zhex(unalignedHeapChunk).string("]").newline();
}

/** Compare the snapshot to the current state of the Space to see if there are grey Objects. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public boolean visitObjectInline(Object o) {
}

/** A ring buffer of visited objects for diagnostics. */
static final class DiagnosticReporter implements DiagnosticThunk {
static final class DiagnosticReporter extends DiagnosticThunk {

static class Options {
@Option(help = "Length of GreyToBlackObjectVisitor history for diagnostics. 0 implies no history is kept.") //
Expand Down Expand Up @@ -131,9 +131,14 @@ public void noteObject(Object o) {
historyCount += 1;
}

@Override
public int maxInvocations() {
return 1;
}

@Override
@RestrictHeapAccess(access = RestrictHeapAccess.Access.NO_ALLOCATION, reason = "Must not allocate during printing diagnostics.")
public void invokeWithoutAllocation(Log log) {
public void printDiagnostics(Log log, int invocationCount) {
if (historyCount > 0) {
log.string("[GreyToBlackObjectVisitor.RealDiagnosticReporter.invoke:")
.string(" history / count: ")
Expand All @@ -149,11 +154,11 @@ public void invokeWithoutAllocation(Log log) {
int index = countToIndex(historyCount + count);
log.string(" index: ").unsigned(index, 3, Log.RIGHT_ALIGN);
Word objectEntry = objectHistory[index];
log.string(" objectEntry: ").hex(objectEntry);
log.string(" objectEntry: ").zhex(objectEntry);
UnsignedWord headerEntry = headerHistory[index];
Pointer headerHub = (Pointer) ObjectHeaderImpl.clearBits(headerEntry);
UnsignedWord headerHeaderBits = ObjectHeaderImpl.getHeaderBitsFromHeaderCarefully(headerEntry);
log.string(" headerEntry: ").hex(headerEntry).string(" = ").hex(headerHub).string(" | ").hex(headerHeaderBits).string(" / ");
log.string(" headerEntry: ").zhex(headerEntry).string(" = ").zhex(headerHub).string(" | ").zhex(headerHeaderBits).string(" / ");
boolean headerInImageHeap = imageHeapInfo.isInReadOnlyReferencePartition(headerHub) ||
imageHeapInfo.isInReadOnlyRelocatablePartition(headerHub);
if (headerInImageHeap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ AlignedHeader produceAlignedChunk() {
log().string("[HeapChunkProvider.produceAlignedChunk chunk size: ").unsigned(chunkSize).newline();

AlignedHeader result = popUnusedAlignedChunk();
log().string(" unused chunk: ").hex(result).newline();
log().string(" unused chunk: ").zhex(result).newline();

if (result.isNull()) {
/* Unused list was empty, need to allocate memory. */
Expand All @@ -110,7 +110,7 @@ AlignedHeader produceAlignedChunk() {
if (result.isNull()) {
throw ALIGNED_OUT_OF_MEMORY_ERROR;
}
log().string(" new chunk: ").hex(result).newline();
log().string(" new chunk: ").zhex(result).newline();

AlignedHeapChunk.initialize(result, chunkSize);
}
Expand All @@ -123,7 +123,7 @@ AlignedHeader produceAlignedChunk() {

HeapPolicy.increaseEdenUsedBytes(chunkSize);

log().string(" result chunk: ").hex(result).string(" ]").newline();
log().string(" result chunk: ").zhex(result).string(" ]").newline();
return result;
}

Expand Down Expand Up @@ -174,13 +174,13 @@ private void pushUnusedAlignedChunk(AlignedHeader chunk) {
if (SubstrateOptions.MultiThreaded.getValue()) {
VMThreads.guaranteeOwnsThreadMutex("Should hold the lock when pushing to the global list.");
}
log().string(" old list top: ").hex(unusedAlignedChunks.get()).string(" list bytes ").signed(bytesInUnusedAlignedChunks.get()).newline();
log().string(" old list top: ").zhex(unusedAlignedChunks.get()).string(" list bytes ").signed(bytesInUnusedAlignedChunks.get()).newline();

HeapChunk.setNext(chunk, unusedAlignedChunks.get());
unusedAlignedChunks.set(chunk);
bytesInUnusedAlignedChunks.addAndGet(HeapPolicy.getAlignedHeapChunkSize());

log().string(" new list top: ").hex(unusedAlignedChunks.get()).string(" list bytes ").signed(bytesInUnusedAlignedChunks.get()).newline();
log().string(" new list top: ").zhex(unusedAlignedChunks.get()).string(" list bytes ").signed(bytesInUnusedAlignedChunks.get()).newline();
}

/**
Expand All @@ -193,14 +193,14 @@ private void pushUnusedAlignedChunk(AlignedHeader chunk) {
* uninterruptible so it can not be interrupted by a safepoint.
*/
private AlignedHeader popUnusedAlignedChunk() {
log().string(" old list top: ").hex(unusedAlignedChunks.get()).string(" list bytes ").signed(bytesInUnusedAlignedChunks.get()).newline();
log().string(" old list top: ").zhex(unusedAlignedChunks.get()).string(" list bytes ").signed(bytesInUnusedAlignedChunks.get()).newline();

AlignedHeader result = popUnusedAlignedChunkUninterruptibly();
if (result.isNull()) {
return WordFactory.nullPointer();
} else {
bytesInUnusedAlignedChunks.subtractAndGet(HeapPolicy.getAlignedHeapChunkSize());
log().string(" new list top: ").hex(unusedAlignedChunks.get()).string(" list bytes ").signed(bytesInUnusedAlignedChunks.get()).newline();
log().string(" new list top: ").zhex(unusedAlignedChunks.get()).string(" list bytes ").signed(bytesInUnusedAlignedChunks.get()).newline();
return result;
}
}
Expand All @@ -224,7 +224,7 @@ private AlignedHeader popUnusedAlignedChunkUninterruptibly() {
/** Acquire an UnalignedHeapChunk from the operating system. */
UnalignedHeader produceUnalignedChunk(UnsignedWord objectSize) {
UnsignedWord chunkSize = UnalignedHeapChunk.getChunkSizeForObject(objectSize);
log().string("[HeapChunkProvider.produceUnalignedChunk objectSize: ").unsigned(objectSize).string(" chunkSize: ").hex(chunkSize).newline();
log().string("[HeapChunkProvider.produceUnalignedChunk objectSize: ").unsigned(objectSize).string(" chunkSize: ").zhex(chunkSize).newline();

noteFirstAllocationTime();
UnalignedHeader result = (UnalignedHeader) CommittedMemoryProvider.get().allocate(chunkSize, CommittedMemoryProvider.UNALIGNED, false);
Expand All @@ -241,7 +241,7 @@ UnalignedHeader produceUnalignedChunk(UnsignedWord objectSize) {

HeapPolicy.increaseEdenUsedBytes(chunkSize);

log().string(" returns ").hex(result).string(" ]").newline();
log().string(" returns ").zhex(result).string(" ]").newline();
return result;
}

Expand All @@ -256,27 +256,27 @@ static void consumeUnalignedChunks(UnalignedHeader firstChunk) {
private static void zap(Header<?> chunk, WordBase value) {
Pointer start = HeapChunk.getTopPointer(chunk);
Pointer limit = HeapChunk.getEndPointer(chunk);
log().string(" zap chunk: ").hex(chunk).string(" start: ").hex(start).string(" limit: ").hex(limit).string(" value: ").hex(value).newline();
log().string(" zap chunk: ").zhex(chunk).string(" start: ").zhex(start).string(" limit: ").zhex(limit).string(" value: ").zhex(value).newline();
for (Pointer p = start; p.belowThan(limit); p = p.add(FrameAccess.wordSize())) {
p.writeWord(0, value);
}
}

Log report(Log log, boolean traceHeapChunks) {
log.string("[Unused:").indent(true);
log.string("Unused:").indent(true);
log.string("aligned: ").signed(bytesInUnusedAlignedChunks.get())
.string("/")
.signed(bytesInUnusedAlignedChunks.get().unsignedDivide(HeapPolicy.getAlignedHeapChunkSize()));
if (traceHeapChunks) {
if (unusedAlignedChunks.get().isNonNull()) {
log.newline().string("aligned chunks:").redent(true);
for (AlignedHeapChunk.AlignedHeader aChunk = unusedAlignedChunks.get(); aChunk.isNonNull(); aChunk = HeapChunk.getNext(aChunk)) {
log.newline().hex(aChunk).string(" (").hex(AlignedHeapChunk.getObjectsStart(aChunk)).string("-").hex(HeapChunk.getTopPointer(aChunk)).string(")");
log.newline().zhex(aChunk).string(" (").zhex(AlignedHeapChunk.getObjectsStart(aChunk)).string("-").zhex(HeapChunk.getTopPointer(aChunk)).string(")");
}
log.redent(false);
}
}
log.redent(false).string("]");
log.redent(false);
return log;
}

Expand Down
Loading