Casting reference array to any-T array.

MacGregor, Duncan (GE Energy Management) duncan.macgregor at
Sat Jan 10 02:53:10 UTC 2015

Well... since we are now effectively compiling a mapping of which variables and stack entries refer to which type variables, does this give us enough information to help the compiler make better type decisions?

If we were to annotate the byte code to also record known concrete types (such as a field being declared as List<String>), then would that provide enough information to trace through subsequent usages and method calls in the compiler's graph? We'd have to record all type variables (rather than just anys) in the type variable map, and it clearly wouldn't allow for checkcasts to be removed from the byte code since pre-generics code could still break it (as could reflection or method & var handles), but it might allow for more aggressive inlining and optimisations.

From: valhalla-dev [valhalla-dev-bounces at] on behalf of Brian Goetz [brian.goetz at]
Sent: 07 January 2015 21:48
To: Vitaly Davidovich
Cc: valhalla-dev at
Subject: Re: Casting reference array to any-T array.

> As a side note, is the plan to continue erasing T
> for ref types or will the specializer ultimately create a non-erased T
> array for them?

The current functionality continues with the erasure plan.  However, I
wouldn't mind doing better!

More information about the valhalla-dev mailing list