MemorySegment visualization API from Per
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Jan 23 10:35:26 UTC 2023
I agree that functionalities like these are useful.
IIRC, there were a bunch of design questions - such as, whether to make
this functionalities available only for memory segments, or also for
byte buffer, and as to whether customization was required (especially
for the hexdump format).
IMHO, the most interesting (and Panama related) part is this (e.g.
memory inspection):
https://github.com/openjdk/panama-foreign/pull/715/files
Which allows to dump the contents of a memory segment using a memory
layout (with some names attached). This allows to render structs and
unions with ease, and it amounts at a single extra method on memory
segment (or, from the other side, on memory layout).
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?
Cheers
Maurizio
On 23/01/2023 10:01, Johannes Lichtenberger wrote:
> Wow, this would be immensely useful to debug stuff, IMHO...
>
> kind regards
> Johannes
>
> Am Sa., 21. Jan. 2023 um 22:07 Uhr schrieb Gavin Ray
> <ray.gavin97 at gmail.com>:
>
> A while ago, Per was working on a PR for visualizing MemorySegment
> and Buffer types
>
> It was very valuable:
>
> https://github.com/openjdk/panama-foreign/pull/695
>
> Does anyone know the status of this? I'd be grateful to have it
> available.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230123/87a9c672/attachment.htm>
More information about the panama-dev
mailing list