Possibly inefficient code gen of instanceof patterns

Claes Redestad claes.redestad at oracle.com
Thu Jan 28 19:40:40 UTC 2021

On 2021-01-28 15:25, Remi Forax wrote:
>> - Storing c into a new slot 4 also seem unfortunate, but is more
>> understandable (I guess this is a limitation of the LVT not allowing
>> overlapping a new variable with a new type into the same slot?)
> The new syntax declares a supplementary local variable so it has to be visible in the bytecode for debuggers.

It was just an observation based on the perhaps far-flung thought that
as long as two variable refers to the exact same thing just with added
type information - evident through the LVT - they could technically
share a slot until such a time that either local is assigned a new
value. An optimization that could perhaps be worthwhile now that it
might become common to have extra local variables that are just added
to provide extra type information.

Again, just an observation. I'm happy as long as the first inefficiency
is addressed.


More information about the compiler-dev mailing list