[foreign-memaccess] on endianness
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Jun 20 17:08:57 UTC 2019
Hi,
currently, the memory access prototype uses native endianness where not
specified. I think that is slightly undesirable, as it makes things
implicit (and against our design principles); this is particularly
evident when interacting with byte buffers, which have BIG_ENDIAN by
default.
So, I think we have a number of choices:
1) endianness should always be explicit
2) allow implicit endianness - but what is the default value?
a) BIG_ENDIAN, as for byte buffers (users will have less surprises?)
b) native, in name of simplifying interaction with native code
c) some magic NO_ENDIAN state, which will have to be set later
(before memory access)
I'm currently (strongly) leaning for (1). This option is explicit, and
correct, and leaves the door open to adding more convenient
endianness-less defaults in the future. This choice would affect both
the Layout API (e.g. ValueLayout factories) and the VarHandle
combinators under MemoryAccessVarHandles.
Comments?
Maurizio
More information about the panama-dev
mailing list