Bug: MappedMemorySegmentImpl uses internal FileChannelImpl

Ty Young youngty1997 at gmail.com
Mon Jun 29 17:49:05 UTC 2020


On 6/29/20 11:32 AM, Maurizio Cimadamore wrote:
> Note that to be able to map a file we need a file descriptor. The file 
> system you provided has support for channels, etc. but note that the 
> channels implementation do not support mapping using MappedByteBuffer:
>
> https://github.com/google/jimfs/blob/master/jimfs/src/main/java/com/google/common/jimfs/JimfsFileChannel.java#L592 
>
>
> So I don't really see how we could make this work. At the end of the 
> day, MemorySegment.mapFromPath has to end up calling `mmap` - and we 
> need to be able to retrieve the parameters of the mmap call from 
> somewhere.


Would FMA having its own platform independant mmap bindings be a 
possible solution? I guess I could just do it myself either way.


>
> Maurizio
>
>
> On 29/06/2020 16:55, Ty Young wrote:
>> Tried using Google's in-memory filesystem:
>>
>>
>> https://github.com/google/jimfs
>>
>>
>> for storing mmap files but ran into an issue because 
>> MappedMemorySegmentImpl uses internal FileChannelImpl method:
>>
>>
>> https://github.com/openjdk/panama-foreign/blob/acc11115db42cc0e17efdf361d58c65f4e922f39/src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/MappedMemorySegmentImpl.java#L105 
>>
>>
>>
>> which causes a class casting exception when using Google's in-memory 
>> Java filesystem and probably other implementations as well.
>>
>>
>>


More information about the panama-dev mailing list