@@ -1921,8 +1921,6 @@ public void finish() {
1921
1921
}
1922
1922
}
1923
1923
1924
- // Note: all the mmap related messages are behind Truffle boundary until GR-29663 is resolved
1925
-
1926
1924
public static final class MMapHandle {
1927
1925
private static final MMapHandle NONE = new MMapHandle (null , 0 );
1928
1926
private SeekableByteChannel channel ;
@@ -2004,7 +2002,6 @@ public SeekableByteChannel truncate(long size) throws IOException {
2004
2002
2005
2003
@ ExportMessage
2006
2004
@ SuppressWarnings ("static-method" )
2007
- @ TruffleBoundary
2008
2005
final MMapHandle mmap (long length , int prot , int flags , int fd , long offset ,
2009
2006
@ Shared ("defaultDirProfile" ) @ Cached ConditionProfile isAnonymousProfile ) throws PosixException {
2010
2007
if (prot == PROT_NONE ) {
@@ -2058,7 +2055,6 @@ private static SeekableByteChannel newByteChannel(TruffleFile file, Set<Standard
2058
2055
2059
2056
@ ExportMessage
2060
2057
@ SuppressWarnings ("static-method" )
2061
- @ TruffleBoundary
2062
2058
public byte mmapReadByte (Object mmap , long index ,
2063
2059
@ Shared ("errorBranch" ) @ Cached BranchProfile errBranch ) throws PosixException {
2064
2060
if (mmap == MMapHandle .NONE ) {
@@ -2076,7 +2072,6 @@ public byte mmapReadByte(Object mmap, long index,
2076
2072
2077
2073
@ ExportMessage
2078
2074
@ SuppressWarnings ("static-method" )
2079
- @ TruffleBoundary
2080
2075
public int mmapReadBytes (Object mmap , long index , byte [] bytes , int length ,
2081
2076
@ Shared ("errorBranch" ) @ Cached BranchProfile errBranch ) throws PosixException {
2082
2077
if (mmap == MMapHandle .NONE ) {
@@ -2111,7 +2106,6 @@ private static int readBytes(MMapHandle handle, long index, ByteBuffer readingBu
2111
2106
2112
2107
@ ExportMessage
2113
2108
@ SuppressWarnings ("static-method" )
2114
- @ TruffleBoundary
2115
2109
public void mmapWriteBytes (Object mmap , long index , byte [] bytes , int length ,
2116
2110
@ Shared ("errorBranch" ) @ Cached BranchProfile errBranch ) throws PosixException {
2117
2111
if (mmap == MMapHandle .NONE ) {
@@ -2120,8 +2114,9 @@ public void mmapWriteBytes(Object mmap, long index, byte[] bytes, int length,
2120
2114
}
2121
2115
MMapHandle handle = (MMapHandle ) mmap ;
2122
2116
try {
2123
- position (handle .channel , handle .offset + index );
2124
- int written = handle .channel .write (ByteBuffer .wrap (bytes , 0 , length ));
2117
+ SeekableByteChannel channel = handle .channel ;
2118
+ position (channel , handle .offset + index );
2119
+ int written = writeChannel (channel , bytes , length );
2125
2120
if (written != length ) {
2126
2121
throw posixException (OSErrorEnum .EIO );
2127
2122
}
@@ -2132,9 +2127,13 @@ public void mmapWriteBytes(Object mmap, long index, byte[] bytes, int length,
2132
2127
}
2133
2128
}
2134
2129
2130
+ @ TruffleBoundary
2131
+ private static int writeChannel (SeekableByteChannel channel , byte [] bytes , int length ) throws IOException {
2132
+ return channel .write (ByteBuffer .wrap (bytes , 0 , length ));
2133
+ }
2134
+
2135
2135
@ ExportMessage
2136
2136
@ SuppressWarnings ({"static-method" , "unused" })
2137
- @ TruffleBoundary
2138
2137
public void mmapFlush (Object mmap , long offset , long length ) {
2139
2138
// Intentionally noop
2140
2139
// If we had access to the underlying NIO FileChannel, we could explicitly set force(true)
@@ -2145,7 +2144,6 @@ public void mmapFlush(Object mmap, long offset, long length) {
2145
2144
2146
2145
@ ExportMessage
2147
2146
@ SuppressWarnings ("static-method" )
2148
- @ TruffleBoundary
2149
2147
public void mmapUnmap (Object mmap , @ SuppressWarnings ("unused" ) long length ) throws PosixException {
2150
2148
if (mmap == MMapHandle .NONE ) {
2151
2149
return ;
0 commit comments