[foreign] RFR 8218153: Read/Write of Value layout should honor declared endianness

John Rose john.r.rose at oracle.com
Sun Feb 3 20:16:25 UTC 2019


On Feb 3, 2019, at 12:04 PM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
>> I quite like this because it has a nice correspondence between layout API and description: in both cases there's no explicit support for NE - which is encoded always as a lack of explicit endianness info.

Well, I like it too.  Thanks for teasing out the details.

One other advantage:  The NE state can naturally be upgraded
after the fact to BE or LE (or vm-specific PE of course).  This means
that we have more options for layout strings produced by jextract
or by hand:  They can be conveniently left in the NE state, and
the BE or LE state can be pushed into the layout string from context.

This gets an effect very similar to what Henry wants, which is a
sensible default for simple notation.  It gets this effect not by
eagerly assigning PE to elements in a layout string (which I
don't want) but rather allowing a chance for the context of the
layout string to supply then needed polarity.  The polarity
can be explicit in a central place, such as in a global argument
sent from jextract to the binder.  For casual use with PE, the
polarity can be quietly injected as an optional argument to the
function which parses layouts.

The basic idea behind this, of NE, is that some layouts can
(and should) be "endian pure" in refusing to take a side, and the
endian-ness can be specified where it is needed, in order to
form correct memory accesses.

Thanks, guys.

— John




More information about the panama-dev mailing list