RFR: Fix incorrect base offset handling in generated array field accessors [v2]

devjeonghwan duke at openjdk.org
Wed Nov 12 12:25:49 UTC 2025


On Wed, 12 Nov 2025 12:13:35 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> devjeonghwan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update test to use `C_INT.byteSize()` for array field layout assertions
>
> Thanks for fixing!
> 
> I think I've run into this in the past as well, but assumed that the intent was to get the array segment first with the segment getter, and then pass that segment to the array accessor (it didn't really feel right, but then it feel off my radar again).

@JornVernee 

Yeap, same here. I was using it like this


            /*
            TODO: Currently, JExtract has some critical bugs, so I opened an PR to fix them but not yet merged.
                  See also https://github.com/openjdk/jextract/pull/294
             */
            MemorySegment maxBlockDimensionSlice = this.info.asSlice(CudaDeviceInfo_st.maxBlockDimension$offset());
            maxBlockDimensionSlice.setAtIndex(jwcuda.C_INT, 0L, this.descriptor.getMaxBlockDimensionX());
            maxBlockDimensionSlice.setAtIndex(jwcuda.C_INT, 1L, this.descriptor.getMaxBlockDimensionY());
            maxBlockDimensionSlice.setAtIndex(jwcuda.C_INT, 2L, this.descriptor.getMaxBlockDimensionZ());

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

PR Comment: https://git.openjdk.org/jextract/pull/294#issuecomment-3521662010


More information about the jextract-dev mailing list