Lexicographic array comparators

John Rose john.r.rose at oracle.com
Tue Feb 10 23:26:17 UTC 2015


On Feb 10, 2015, at 3:15 PM, Martin Buchholz <martinrb at google.com> wrote:
> 
> I was surprised that System.arraycopy hasn't been specialized for every
> array type.
> I guess the JIT is good at specializing all callers.

Yes.  Usually the arguments have specific static types the JIT can see.
The Object formal type doesn't obscure this.

> I don't know whether we will someday regret the explosion of array
> comparison methods.

It's technical debt.  When we go to value types there will be an infinite number of array types.
That's why in Project Valhalla we are thinking hard, before that, about parametric polymorphism.
We need to be able to have true polymorphism over APIs in T[], where T can be ref, prim, or value.
At that point, hopefully, what we have won't be impossible to retrofit.

— John


More information about the core-libs-dev mailing list