Skip to content

Commit ee4c1f1

Browse files
committed
Put all emulated mmap messages behind Truffle boundary to fix native-image build
1 parent baaedc9 commit ee4c1f1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/EmulatedPosixSupport.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,21 +1919,18 @@ public void finish() {
19191919
}
19201920
}
19211921

1922+
// Note: all the mmap related messages are behind Truffle boundary until GR-29663 is resolved
1923+
19221924
public static final class MMapHandle {
19231925
private static final MMapHandle NONE = new MMapHandle(null, 0);
19241926
private SeekableByteChannel channel;
19251927
private final long offset;
19261928

19271929
public MMapHandle(SeekableByteChannel channel, long offset) {
1928-
setChannel(channel);
1930+
this.channel = channel;
19291931
this.offset = offset;
19301932
}
19311933

1932-
@TruffleBoundary
1933-
private void setChannel(SeekableByteChannel channel) {
1934-
// this.channel = channel;
1935-
}
1936-
19371934
@Override
19381935
public String toString() {
19391936
CompilerAsserts.neverPartOfCompilation();
@@ -2005,6 +2002,7 @@ public SeekableByteChannel truncate(long size) throws IOException {
20052002

20062003
@ExportMessage
20072004
@SuppressWarnings("static-method")
2005+
@TruffleBoundary
20082006
final MMapHandle mmap(long length, int prot, int flags, int fd, long offset,
20092007
@Shared("defaultDirProfile") @Cached ConditionProfile isAnonymousProfile) throws PosixException {
20102008
if (prot == PROT_NONE) {
@@ -2058,6 +2056,7 @@ private static SeekableByteChannel newByteChannel(TruffleFile file, Set<Standard
20582056

20592057
@ExportMessage
20602058
@SuppressWarnings("static-method")
2059+
@TruffleBoundary
20612060
public byte mmapReadByte(Object mmap, long index,
20622061
@Shared("errorBranch") @Cached BranchProfile errBranch) throws PosixException {
20632062
if (mmap == MMapHandle.NONE) {
@@ -2075,6 +2074,7 @@ public byte mmapReadByte(Object mmap, long index,
20752074

20762075
@ExportMessage
20772076
@SuppressWarnings("static-method")
2077+
@TruffleBoundary
20782078
public int mmapReadBytes(Object mmap, long index, byte[] bytes, int length,
20792079
@Shared("errorBranch") @Cached BranchProfile errBranch) throws PosixException {
20802080
if (mmap == MMapHandle.NONE) {
@@ -2109,6 +2109,7 @@ private static int readBytes(MMapHandle handle, long index, ByteBuffer readingBu
21092109

21102110
@ExportMessage
21112111
@SuppressWarnings("static-method")
2112+
@TruffleBoundary
21122113
public void mmapWriteBytes(Object mmap, long index, byte[] bytes, int length,
21132114
@Shared("errorBranch") @Cached BranchProfile errBranch) throws PosixException {
21142115
if (mmap == MMapHandle.NONE) {
@@ -2131,6 +2132,7 @@ public void mmapWriteBytes(Object mmap, long index, byte[] bytes, int length,
21312132

21322133
@ExportMessage
21332134
@SuppressWarnings({"static-method", "unused"})
2135+
@TruffleBoundary
21342136
public void mmapFlush(Object mmap, long offset, long length) {
21352137
// Intentionally noop
21362138
// If we had access to the underlying NIO FileChannel, we could explicitly set force(true)
@@ -2141,6 +2143,7 @@ public void mmapFlush(Object mmap, long offset, long length) {
21412143

21422144
@ExportMessage
21432145
@SuppressWarnings("static-method")
2146+
@TruffleBoundary
21442147
public void mmapUnmap(Object mmap, @SuppressWarnings("unused") long length) throws PosixException {
21452148
if (mmap == MMapHandle.NONE) {
21462149
return;

0 commit comments

Comments
 (0)