Generic sort

John Rose john.r.rose at
Sun Sep 14 03:07:43 UTC 2014

On Sep 13, 2014, at 3:29 PM, Paul Govereau <paul.govereau at> wrote:

> This seems to imply we need byte code instructions: vinstanceof and vcheckcast.
> This seems strange, what am I missing?

There are two ways to think about this.
The simplest is to box first and then ask questions.
If the template instance is of a non-reference, box it and then apply the reference operation.

This leads to a refinement, or optimization:
Usually or always, the parameter type is known exactly during instantiation.
In that case, the reference query can be constant folded.

BTW, "x == null" is a reference query.
It can be constant folded by observing that a boxed prim or val is never null.

— John

More information about the valhalla-dev mailing list