MemorySegment visualization API from Per
Gavin Ray
ray.gavin97 at gmail.com
Mon Jan 23 13:58:52 UTC 2023
Thanks for the reply Maurizio,
> Which of the two pieces of functionalities you find yourselves more in
need of? Memory inspection (e.g. segment + layout -> string), or hexdump?
Or both?
I found it useful to be able to both hex-dump Buffer/ByteBuffer and
MemorySegment types to view the data, and to view the structured
representation
My usecase for MemorySegment and FFM API's is primarily for building
databases (much like Johannes I believe)
It's very useful to be able to both print the hex view of database pages,
and the structured segment view of pages -- this way I can see both the raw
page data and visualize it as structs =)
For example, I'd like to be able to visualize stuff like this:
https://github.com/GavinRay97/rosetta-db/blob/4ed46b104d22310a2c051e8d340611a868e37260/kotlin/app/src/main/kotlin/rosetta/db/App.kt#L497-L529
On Mon, Jan 23, 2023 at 7:49 AM Pedro Lamarão <pedro.lamarao at prodist.com.br>
wrote:
> Em seg., 23 de jan. de 2023 às 07:36, Maurizio Cimadamore <
> maurizio.cimadamore at oracle.com> escreveu:
>
>> The HexDump functionality is, IMHO, more general, and I believe it
>> deserves a more central place in the JDK, rather than some class in
>> java.lang.foreign. In principle, users might want to produce hexdumps of
>> byte buffers, segments, byte arrays, Collection<Byte>, ...
>>
>> (as I write this, I realize that the same argument might be applied to
>> the memory inspection stuff, but I think it's a defensible move to keep
>> layouts and segments together, which we have done in other places).
>>
>> Which of the two pieces of functionalities you find yourselves more in
>> need of? Memory inspection (e.g. segment + layout -> string), or hexdump?
>> Or both?
>>
>
> In my experience, without prejudice to adding a hexdumper to JDK, such
> things are quickly and easily born wherever necessary.
> An inspector does not seem quick and easy to write while debugging, so
> perhaps it would bring more value to the table.
> Maybe the inspector could actually do both and somehow include a hexdump
> as part of the inspection.
>
> --
> Pedro Lamarão
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230123/9bddbcdd/attachment.htm>
More information about the panama-dev
mailing list