[foreign-memaccess] RFR 8234814: Eager layout size computation trips on unbound sequence layouts

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Nov 26 13:41:36 UTC 2019


This is a regression that was introduced by [1]; by making computation 
of layout sizes for compound layouts more eager, we now trip up on 
layouts which contain unbound sequence layouts.

I've rewrite the code to be more friendly to unbound sequences - the 
code now acknowledges that _any_ compound layout can potentially lack a 
definite size (because it contains deeply nested unbound sequence layouts).

I've added a bunch of tests to verify that some edge cases work 
correctly and that var handle can correctly be derived from layouts, 
even in the presence of 'trailing' unbound sequence layouts (which is 
the common case).

As I was writing the patch I realized that we were not handling the 
alignment of empty groups properly (now we return minimal alignment, 1) 
- and I've also hit a jshell bug when printing the stack trace of an out 
of bound access - which is caused by jshell not considering that the 
file attached to a stack trace element can be null (in the case of 
hidden stack trace elements such as the ones associated with 
VarHandles). Jshell fix has been discussed with Jan.

Webrev:
http://cr.openjdk.java.net/~mcimadamore/panama/8234814/


Cheers
Maurizio

[1] - https://bugs.openjdk.java.net/browse/JDK-8231402



More information about the panama-dev mailing list