[foreign-memaccess] RFR: Add MemoryLayout::byteOffset

Chris Hegarty chegar at openjdk.java.net
Mon May 11 10:14:05 UTC 2020


On Mon, 11 May 2020 09:54:44 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Looks very good - many thanks!
>
>> This reminds me something I meant to bring up awhile ago: it would be
>> nice to have a counterpart method "ofPaddingBytes" and pre-defined
>> layouts like "PAD_BYTE_1" to the existing Bit based versions.
> 
> Right now all factories take bits (not bytes) as input, as that's more "primitive" and scales more to things like
> packed layouts. That said, I see your point. My feeling is that layout construction typically happens once, and then
> information is derived from the layout. When you construct you don't care much whether to use bits or bytes (other than
> for stylistic preferences) - but when you access layout information, you might be interested in getting either bits or
> bytes out, depending on which code you might need to interact with. So, in my view, fixing methods like "offset" takes
> the priority here. We'll keep evaluating against use cases and see how annoying that is. Thanks for bringing this up.

> This seems like it should go to the `foreign-memaccess` branch, but is currently targeting the `foreign-jextract`
> branch. If you click the "Edit" button on the right next to the title of the PR, you should be able to change the
> target branch from the drop-down just below the PR title.

Thanks Jorn, the intent was to target the `foreign-memaccess` branch. PR target branch updated.

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/157


More information about the panama-dev mailing list