RFR S 8214742 [lworld][c1] Block merging need to preserve type info for flattened arrays

Tobias Hartmann tobias.hartmann at oracle.com
Tue Dec 4 10:07:02 UTC 2018


Hi Ioi,

I would prefer to make this more generic (later we might want to propagate type information for
other bytecodes as well, not only for arrays). So the comment for Phi::_exact_type should be more
general and ValueStack::merge_if_flattened_array_types should be renamed to ValueStack::merge_types
or something. I think that method can also be simplified to:

if (new_value->is_flattened_array() &&
    (existing_value == NULL || existing_value->is_flattened_array())) {
  assert(existing_value == NULL || existing_value->exact_type() == new_value->exact_type(), "must be
guaranteed by verifier");
  return new_value->exact_type();
}
return NULL;

and a comment can be added stating that we currently only merge types of flattened arrays.

Thanks,
Tobias

On 04.12.18 00:51, Ioi Lam wrote:
> https://bugs.openjdk.java.net/browse/JDK-8214742
> http://cr.openjdk.java.net/~iklam/valhalla/8214742-preserve-typeinfo-for-flattened-array.v01/
> 
> The fix is for code like this, where the aaload bytecode needs to know that the array is flattened.
> 
>     static int test(boolean b) {
>         VT[] va;
>         if (b) {
>             va = new VT[5];
>         } else {
>             va = new VT[10];
>         }
>         return va[0].v1;  <<<< here
>     }
> 
> Thanks
> 
> - Ioi
> 


More information about the valhalla-dev mailing list