Skip to content

Commit 766e915

Browse files
committed
put more channel code behind boundary
1 parent b49a6d1 commit 766e915

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PosixModuleBuiltins.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ abstract static class ReadFromChannelNode extends PNodeWithContext {
846846
ByteSequenceStorage readSeekable(SeekableByteChannel channel, int size) {
847847
long availableSize;
848848
try {
849-
availableSize = channel.size() - channel.position();
849+
availableSize = availableSize(channel);
850850
} catch (IOException e) {
851851
gotException.enter();
852852
throw raise(OSError, e.getMessage());
@@ -858,6 +858,11 @@ ByteSequenceStorage readSeekable(SeekableByteChannel channel, int size) {
858858
return readReadable(channel, sz);
859859
}
860860

861+
@TruffleBoundary(transferToInterpreterOnException = false)
862+
private static long availableSize(SeekableByteChannel channel) throws IOException {
863+
return channel.size() - channel.position();
864+
}
865+
861866
@Specialization
862867
ByteSequenceStorage readReadable(ReadableByteChannel channel, int size) {
863868
int sz = Math.min(size, ReadNode.MAX_READ);

0 commit comments

Comments
 (0)