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

Glavo duke at openjdk.org
Fri May 26 18:41:21 UTC 2023


On Fri, 26 May 2023 17:28:11 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> Heh - believe me, I get where you are coming from. But my feeling is that what you are thinking about a world where instances of value classes are "flat" and have a layout which overlaps exactly with the layout of their corresponding struct in C. This is not the case, at least to date, with value types. E.g. the JVM will reserve the right of insert extra padding, align fields, pretty much in every way it wants. So there's no guarantee that a record (even if a value record) is going to be "bulk-copy compatible" with a memory segment.

I think you misunderstood my meaning. I understand that we cannot assume the actual memory layout of valhalla value objects, so we cannot truly equate a Java object with a C struct value. 

But these are all for objects stored on the heap. For local variables, the JVM can handle them in a completely different way, scalar replacement is an example.

So, what I hope to do is not treat the struct value as a record **object**, but rather treat the struct value as a record **variable**.

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

PR Comment: https://git.openjdk.org/panama-foreign/pull/833#issuecomment-1564782151


More information about the panama-dev mailing list