[foreign] RFR 8217738: Refactor LayoutUtils code for handling structs and unions
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Jan 24 17:57:14 UTC 2019
Hi,
I think it is a very good piece of code, which tries to put some sense
into the monolithic blabbering I wrote few months ago :-)
As discussed privately, I think there might be a further opportunity for
improvement in the struct layout computer - that is, if we could fold
the size/offset field together (which could be tricky), then we could
have an helper method to add padding like this:
void addPaddingIfNeeded(long expectedOffset) {
addFieldLayout(Padding.of(expectedOffset - offset));
offfset = expectedOffset;
}
And then you can call this in the two places where padding is required
(this relies on the fact that, at the end of struct processing, the
offset we end up with should be the same as the size computed so far).
But this can be addressed as a separate improvement.
Maurizio
On 24/01/2019 17:15, Sundararajan Athijegannathan wrote:
> Please review.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8217738
> Webrev: https://cr.openjdk.java.net/~sundar/8217738/webrev.01/
>
> Thanks,
> -Sundar
>
More information about the panama-dev
mailing list