[foreign-memaccess+abi] RFR: Change classes into records and fix finality [v2]
Per Minborg
duke at openjdk.org
Tue Sep 20 12:38:03 UTC 2022
On Mon, 19 Sep 2022 15:02:19 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> For Binding there's a builder, but it just calls the constructor of the respective Binding class. i.e. there's no additional instantiation logic encapsulated that can lead to a malformed object. Although, it is possible to lead to malformed recipes, that is not a consequence of the public constructors of the Binding classes.
>>
>> VMStorage does encapsulate some instantiation logic, namely the debug name for stack storage. Though, to be fair, there used to be more of that in an earlier version where I also checked that the wrong `type` was not being used. So, maybe it's time to revisit 🤔
>>
>> Thinking about it now, I think the real addition of extra instantiation logic happens in the architecture classes (e.g. https://github.com/openjdk/panama-foreign/blob/cb272592d5043aaa2d9f013eac37620de50418ef/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/AArch64Architecture.java#L139) where the type of stack storage is actually known.
>>
>> Maybe it would be better to make `VMStorage` just a dumb record, and drop the factory methods from it altogether.
>
> although this seems to deserve its own targeted PR
Yes. Let's do this in a separate PR.
-------------
PR: https://git.openjdk.org/panama-foreign/pull/725
More information about the panama-dev
mailing list