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 @@ -71,6 +71,8 @@
import com.oracle.svm.core.heap.dump.HeapDumpMetadata.FieldNameAccess;
import com.oracle.svm.core.hub.DynamicHub;
import com.oracle.svm.core.hub.LayoutEncoding;
import com.oracle.svm.core.jdk.UninterruptibleUtils.CharReplacer;
import com.oracle.svm.core.jdk.UninterruptibleUtils.ReplaceDotWithSlash;
import com.oracle.svm.core.layeredimagesingleton.MultiLayeredImageSingleton;
import com.oracle.svm.core.log.Log;
import com.oracle.svm.core.nmt.NmtCategory;
Expand Down Expand Up @@ -400,6 +402,7 @@ public class HeapDumpWriter {
private static final int HEAP_DUMP_SEGMENT_TARGET_SIZE = 1 * 1024 * 1024;

private final NoAllocationVerifier noAllocationVerifier = NoAllocationVerifier.factory("HeapDumpWriter", false);
private final ReplaceDotWithSlash dotWithSlashReplacer = new ReplaceDotWithSlash();
private final DumpStackFrameVisitor dumpStackFrameVisitor = new DumpStackFrameVisitor();
private final DumpObjectsVisitor dumpObjectsVisitor = new DumpObjectsVisitor();
private final CodeMetadataVisitor codeMetadataVisitor = new CodeMetadataVisitor();
Expand Down Expand Up @@ -547,15 +550,19 @@ private void writeClassNames() {
for (int i = 0; i < metadata.getClassInfoCount(); i++) {
ClassInfo classInfo = metadata.getClassInfo(i);
if (ClassInfoAccess.isValid(classInfo)) {
writeSymbol(classInfo.getHub().getName());
writeSymbol(classInfo.getHub().getName(), dotWithSlashReplacer);
}
}
}

private void writeSymbol(String value) {
writeSymbol(value, null);
}

private void writeSymbol(String value, CharReplacer replacer) {
startTopLevelRecord(HProfTopLevelRecord.UTF8);
writeObjectId(value);
writeUTF8(value);
writeUTF8(value, replacer);
endTopLevelRecord();
}

Expand Down Expand Up @@ -1109,7 +1116,11 @@ private void writeId0(long value) {
}

private void writeUTF8(String value) {
boolean success = file().writeUTF8(f, value);
writeUTF8(value, null);
}

private void writeUTF8(String value, CharReplacer replacer) {
boolean success = file().writeUTF8(f, value, replacer);
handleError(success);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import static com.oracle.svm.core.Uninterruptible.CALLED_FROM_UNINTERRUPTIBLE_CODE;

import jdk.graal.compiler.word.Word;
import org.graalvm.word.Pointer;
import org.graalvm.word.PointerBase;
import org.graalvm.word.UnsignedWord;
Expand All @@ -37,6 +36,7 @@
import com.oracle.svm.core.util.VMError;

import jdk.graal.compiler.core.common.SuppressFBWarnings;
import jdk.graal.compiler.word.Word;
import jdk.internal.misc.Unsafe;

/**
Expand Down Expand Up @@ -714,6 +714,17 @@ public interface CharReplacer {
char replace(char val);
}

public static final class ReplaceDotWithSlash implements CharReplacer {
@Override
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public char replace(char ch) {
if (ch == '.') {
return '/';
}
return ch;
}
}

public static class CodeUtil {
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
public static long signExtend(long value, int inputBits) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.oracle.svm.core.heap.Heap;
import com.oracle.svm.core.jdk.UninterruptibleUtils;
import com.oracle.svm.core.jdk.UninterruptibleUtils.CharReplacer;
import com.oracle.svm.core.jdk.UninterruptibleUtils.ReplaceDotWithSlash;
import com.oracle.svm.core.jfr.traceid.JfrTraceIdEpoch;
import com.oracle.svm.core.locks.VMMutex;
import com.oracle.svm.core.nmt.NmtCategory;
Expand Down Expand Up @@ -244,15 +245,4 @@ void teardown() {
buffer = Word.nullPointer();
}
}

private static final class ReplaceDotWithSlash implements CharReplacer {
@Override
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public char replace(char ch) {
if (ch == '.') {
return '/';
}
return ch;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.oracle.svm.core.hub.DynamicHub;
import com.oracle.svm.core.hub.LayoutEncoding;
import com.oracle.svm.core.jdk.UninterruptibleUtils;
import com.oracle.svm.core.jdk.UninterruptibleUtils.CharReplacer;
import com.oracle.svm.core.memory.NullableNativeMemory;
import com.oracle.svm.core.nmt.NmtCategory;
import com.oracle.svm.core.os.BufferedFileOperationSupport.BufferedFileOperationSupportHolder;
Expand Down Expand Up @@ -343,17 +344,26 @@ public boolean writeDouble(BufferedFile f, double v) {
return writeLong(f, Double.doubleToLongBits(v));
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public boolean writeUTF8(BufferedFile f, String string) {
return writeUTF8(f, string, null);
}

/**
* Writes the String characters encoded as UTF8 to the current file position and advances the
* file position.
*
* @return true if the data was written, false otherwise.
*/
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public boolean writeUTF8(BufferedFile f, String string) {
public boolean writeUTF8(BufferedFile f, String string, CharReplacer replacer) {
boolean success = true;
for (int index = 0; index < string.length() && success; index++) {
success &= writeUTF8(f, UninterruptibleUtils.String.charAt(string, index));
char ch = UninterruptibleUtils.String.charAt(string, index);
if (replacer != null) {
ch = replacer.replace(ch);
}
success &= writeUTF8(f, ch);
}
return success;
}
Expand Down
Loading