[foreign-memaccess+abi] RFR: 8291639: Improve the ability to visualize a MemorySegment in human readable forms [v18]

Per Minborg pminborg at openjdk.org
Tue Sep 5 07:37:05 UTC 2023


On Wed, 7 Sep 2022 14:13:16 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR improves the ability to visualize a memory abstraction (e.g. `MemorySegment`, `ByteBuffer`, `byte[]`) in human-readable forms.
>> 
>> The existing `HexFormat` class will get a new configurable `MemoryDumper` that can produce dumps of MemorySegments, byte arrays and ByteBuffers:
>> 
>> 
>> 0000000000000000 54 68 65 20 71 75 69 63 6B 20 62 72 6F 77 6E 20 |The quick brown |
>> 0000000000000010 66 6F 78 20 6A 75 6D 70 65 64 20 6F 76 65 72 20 |fox jumped over |
>> 0000000000000020 74 68 65 20 6C 61 7A 79 20 64 6F 67 0A 53 65 63 |the lazy dog.Sec|
>> 0000000000000030 6F 6E 64 20 6C 69 6E 65 09 3A 68 65 72 65 00 00 |ond line.:here..|
>> 0000000000000040 00 00 00 00                                     |....            |
>> 
>> 
>> A MemoryDumper can contain any number of columns (either index or data) which can be formatted in a large number of ways using composable `HexFormat` instances. Even more configuration possibilities can be achieved by providing custom formatting lambdas.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove MemoryInspection and fix JavaDocs

We anticipate much more general functionality with https://github.com/openjdk/panama-foreign/pull/833 and so, I am going to close this PR.

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

PR Comment: https://git.openjdk.org/panama-foreign/pull/695#issuecomment-1706094225


More information about the panama-dev mailing list