Questions about type annotation on type casts.

John Rose john.r.rose at
Mon Jan 18 08:29:44 UTC 2016

On Jan 17, 2016, at 10:52 PM, Srikanth <srikanth.adayapalam at> wrote:
> By computing the offset just after translation of the expression, the offset would point to the checkcast instruction
> when present and when absent would point to the offset where the checkcast expression would have been had it not been optimized
> away - i.e pointing to the earliest offset where the fully finished expression value is at the top of stack.
> This appears to me to a better arrangement than what we have at present.
> Also note that we have the same eager offset computation issue with instanceof - I don't see the compilers optimizing away
> instanceof instructions as of now though.

That sounds good.  One could think of the optimized checkcast as a zero-length opcode that leaves TOS unchanged.

If instanceof is optimized, it will turn into an iconst_[01].  That would be the instruction to point at, I suppose.

— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the compiler-dev mailing list