RFR: 7903626: Add struct helper method to reintrepret an array of structs [v2]

Jorn Vernee jvernee at openjdk.org
Tue Jan 16 15:58:50 UTC 2024


On Tue, 16 Jan 2024 15:45:56 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>>> Should the simpler reinterpret method call the array one with length of 1 ?
>> 
>> yes, good suggestion
>
> As for using asSlice as an alignment check. We don't have an asSlice method in MS which takes an element count, so we would also have to create a SequenceLayout on the fly. Not sure what to do... kinda feels like we need a reinterpret overload that takes an alignment, or another more convenient way to check alignment.
> 
> I think in principle checking alignment here is a good idea, since we're 'sanitizing' a raw address here, and an alignment check is a good way to catch corrupt pointers.

I'll leave it for now.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/178#discussion_r1453632157


More information about the jextract-dev mailing list