@@ -1928,8 +1928,6 @@ public void finish() {
1928
1928
}
1929
1929
}
1930
1930
1931
- // Note: all the mmap related messages are behind Truffle boundary until GR-29663 is resolved
1932
-
1933
1931
public static final class MMapHandle {
1934
1932
private static final MMapHandle NONE = new MMapHandle (null , 0 );
1935
1933
private SeekableByteChannel channel ;
@@ -2011,7 +2009,6 @@ public SeekableByteChannel truncate(long size) throws IOException {
2011
2009
2012
2010
@ ExportMessage
2013
2011
@ SuppressWarnings ("static-method" )
2014
- @ TruffleBoundary
2015
2012
final MMapHandle mmap (long length , int prot , int flags , int fd , long offset ,
2016
2013
@ Shared ("defaultDirProfile" ) @ Cached ConditionProfile isAnonymousProfile ) throws PosixException {
2017
2014
if (prot == PROT_NONE .value ) {
@@ -2065,7 +2062,6 @@ private static SeekableByteChannel newByteChannel(TruffleFile file, Set<Standard
2065
2062
2066
2063
@ ExportMessage
2067
2064
@ SuppressWarnings ("static-method" )
2068
- @ TruffleBoundary
2069
2065
public byte mmapReadByte (Object mmap , long index ,
2070
2066
@ Shared ("errorBranch" ) @ Cached BranchProfile errBranch ) throws PosixException {
2071
2067
if (mmap == MMapHandle .NONE ) {
@@ -2083,7 +2079,6 @@ public byte mmapReadByte(Object mmap, long index,
2083
2079
2084
2080
@ ExportMessage
2085
2081
@ SuppressWarnings ("static-method" )
2086
- @ TruffleBoundary
2087
2082
public int mmapReadBytes (Object mmap , long index , byte [] bytes , int length ,
2088
2083
@ Shared ("errorBranch" ) @ Cached BranchProfile errBranch ) throws PosixException {
2089
2084
if (mmap == MMapHandle .NONE ) {
@@ -2118,7 +2113,6 @@ private static int readBytes(MMapHandle handle, long index, ByteBuffer readingBu
2118
2113
2119
2114
@ ExportMessage
2120
2115
@ SuppressWarnings ("static-method" )
2121
- @ TruffleBoundary
2122
2116
public void mmapWriteBytes (Object mmap , long index , byte [] bytes , int length ,
2123
2117
@ Shared ("errorBranch" ) @ Cached BranchProfile errBranch ) throws PosixException {
2124
2118
if (mmap == MMapHandle .NONE ) {
@@ -2127,8 +2121,9 @@ public void mmapWriteBytes(Object mmap, long index, byte[] bytes, int length,
2127
2121
}
2128
2122
MMapHandle handle = (MMapHandle ) mmap ;
2129
2123
try {
2130
- position (handle .channel , handle .offset + index );
2131
- int written = handle .channel .write (ByteBuffer .wrap (bytes , 0 , length ));
2124
+ SeekableByteChannel channel = handle .channel ;
2125
+ position (channel , handle .offset + index );
2126
+ int written = writeChannel (channel , bytes , length );
2132
2127
if (written != length ) {
2133
2128
throw posixException (OSErrorEnum .EIO );
2134
2129
}
@@ -2139,9 +2134,13 @@ public void mmapWriteBytes(Object mmap, long index, byte[] bytes, int length,
2139
2134
}
2140
2135
}
2141
2136
2137
+ @ TruffleBoundary
2138
+ private static int writeChannel (SeekableByteChannel channel , byte [] bytes , int length ) throws IOException {
2139
+ return channel .write (ByteBuffer .wrap (bytes , 0 , length ));
2140
+ }
2141
+
2142
2142
@ ExportMessage
2143
2143
@ SuppressWarnings ({"static-method" , "unused" })
2144
- @ TruffleBoundary
2145
2144
public void mmapFlush (Object mmap , long offset , long length ) {
2146
2145
// Intentionally noop
2147
2146
// If we had access to the underlying NIO FileChannel, we could explicitly set force(true)
@@ -2152,7 +2151,6 @@ public void mmapFlush(Object mmap, long offset, long length) {
2152
2151
2153
2152
@ ExportMessage
2154
2153
@ SuppressWarnings ("static-method" )
2155
- @ TruffleBoundary
2156
2154
public void mmapUnmap (Object mmap , @ SuppressWarnings ("unused" ) long length ) throws PosixException {
2157
2155
if (mmap == MMapHandle .NONE ) {
2158
2156
return ;
0 commit comments