MemoryLayout api

Remi Forax forax at univ-mlv.fr
Tue Jan 21 15:17:35 UTC 2020


Hi all,
i've played a little bit with the current version used by the jdk 15 and the one in the branch foreign-memaccess (for the benchmarks).

I really like the API, the MemoryLayout part in particular.

I will do a presentation in two weeks about the foreign API (and everythings else introduced in jdk 14)
  https://github.com/forax/do-synthetic-methods-dream-of-electric-switch-expressions
All my tests are available as a python notebook (see the README).

There is something i don't understand.
The memory layout API let you create layouts that are invalid, i.e. that you can not create any VarHandle on it,
by example a group (struct or union) that contains a sequence without a size, or a layout that starts with two sequences with no size.

I get why you can have one sequence free, but you can not have more than one, otherwise you can not compute the size of the inner layout.

So why the layout API let users create such badly shaped layout ?
May i have overlooked something ?

regards,
Rémi




More information about the panama-dev mailing list