RFR: 7903606: Move layout and function descriptor generation closer to code builders [v3]

Jorn Vernee jvernee at openjdk.org
Mon Dec 11 19:43:49 UTC 2023


On Mon, 11 Dec 2023 19:05:38 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/main/java/org/openjdk/jextract/impl/StructBuilder.java line 167:
>> 
>>> 165:         appendIndentedLines(STR."""
>>> 166:             public static \{type.getSimpleName()} \{javaName}$get(MemorySegment \{seg}) {
>>> 167:                 return \{seg}.get(\{layoutString(1, layout)}, \{offset});
>> 
>> So, It seems that using the layout string directly here is fine since we only reference primitives?
>> 
>> Also, this (and the `set` method) don't need indentation. It results in this:
>> 
>> 
>>     public static int x$get(MemorySegment seg) {
>>         return seg.get(    JAVA_INT, 8);
>>     }
>
> what do you mean "using layout string directly" ? We have no other way to emit the layout string.

I mean, we don't use a reference to a layout constant we generated elsewhere, but always generate the layout string inline

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

PR Review Comment: https://git.openjdk.org/jextract/pull/156#discussion_r1423039933


More information about the jextract-dev mailing list