RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v15]

Paul Sandoz psandoz at openjdk.org
Wed Mar 29 22:35:31 UTC 2023


On Wed, 22 Mar 2023 14:07:14 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Back to @PaulSandoz  question - "how does the caller know what the structure contains?". The caller typically doesn't care too much about what the returned struct is. But it might care about which "values" can be captured. That said, the set of such interesting values, is not too surprising. As demonstrated in the example in the `Linker.capturedCallState` method, once the client knows the name (and "errno" is likely to be 90% case), everything else follows from there - as the layout can be used to obtain var handles for the required values.
>> 
>> But, perhaps, now that I write this, I realize that what @PaulSandoz might _really_ be asking is: how do I know that e.g. the returned struct will not contain e.g. nested structs, sequences, or other non-sense. So we might specify (in a normative way) that the returned layout is a struct layout, whose member layouts are one or more value layouts (possibly with some added padding layouts). The names of the value layouts reflect the names of the values that can be captured.
>> 
>> And _then_ we show an example of the layout we return for Windows/x64 (as that's more interesting).
>
> I've updated the specs as per how I interpret the comments above. Let me know your thoughts on this.

This is much clearer. Are the names of the struct members guaranteed to be symbols that can be found up via the linker's default lookup? i.e. a small set of important global variables.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13079#discussion_r1152550849


More information about the nio-dev mailing list