memory mapped i/o?

Andrew Haley aph@redhat.com
Fri Dec 22 10:59:00 GMT 2000


Bryce McKinlay <bryce@albatross.co.nz> wrote:

:> I just did a bit more poking around.  It appears that the RealTime Java
:> API has some memory region APIs (chapter 5) that in principle ought to
:> be able expose memory mapped I/O ... or controller registers, etc.

: It looks to me like RawMemoryAccess class in this proposal isn't quite what
: you want, because it still involves copying from regular arrays to and from
: the "raw memory" area.

I don't think it does.  RawMemoryAccess and RawMemoryFloatAccess allow
you to index directly into the raw memory area with methods like
getInt(long offset), so a subclass of RawMemoryAccess could easily
represent, say, a memory-mapped array of longs.  

I reckon the Right Thing to do here is to create a subclass of
RawMemoryAccess called MappedFileMemoryAccess.

I'm not sure what to do about checking, though.  Perhaps a special
UncheckedRawMemoryAccess could be the ancestor of all of them, with
bounds checking delegated to the subclasses.

If the compiler special cases RawMemoryAccess and its friends accesses
could easily be inlined as memory fecthes and stores.

Andrew.


More information about the Java mailing list