Can we also get some feedback on specialization, please?

Remi Forax forax at univ-mlv.fr
Sat Jan 10 09:54:47 UTC 2015


The other solution is to stop to let the compiler to do the boxing for 
varargs
and let the VM do the boxing by emitting an invokedynamic.
It will simplify the bytecode and optimize simple case like when the 
array is empty.

Rémi

On 01/10/2015 03:29 AM, MacGregor, Duncan (GE Energy Management) wrote:
> Continuing to play around with the specialisation work, and I've hit a snag that I haven't seen reported on this list, implicit boxing and varargs.
>
> If you had a small object in Java today which consisted of a mixture of primitive and object fields then you might reasonably write a little toString() method as
>
> public String toString() {
>      String.format("(%s, %s, %s, %s)", field1, field2, field3, field4);
> }
>
> and the compiler will helpfully autobox any of those fields which were declared as primitives.
>
> If I try something similar with a specialised class then it currently gives an error because the types are any so it can't construct any Object[] from the four fields. In simple cases this could be solved by layering, but it would feel very strange to have to resort to that, and if we consider types tuples down the line then the combinatorial explosion would be ridiculous. This behaviour is entirely consistent with the type system as is, but will probably be the cause of real frustration as we go on.
>
> Can the byte code mapping attribute be used to store some indication that boxing must be performed at a particular index?
>
> Duncan.
> ________________________________________
> From: valhalla-dev [valhalla-dev-bounces at openjdk.java.net] on behalf of Brian Goetz [brian.goetz at oracle.com]
> Sent: 05 January 2015 19:35
> To: valhalla-dev at openjdk.java.net
> Subject: Can we also get some feedback on specialization, please?
>
> There's been a lot of passionate discussion here about the directions we
> should or should not take Java. And this is all understandable, and
> perhaps inevitable, but ... it seems to be crowding out what is actually
> the primary purpose of this (-dev) list.  We had hoped, in taking the
> effort to write up State of the Specialization, to get some comments on
> ... specialization :)
>
> So far, nearly all the comments have been on the speculative parts of
> the writeup (layers/conditional methods), as well as the usual
> (supersized) portion of "I think you should do X/Y/Z instead".  Which is
> all OK, but we were actually hoping to get some feedback on the part
> that is written up in some detail -- and mostly implemented!  I know
> it's fun to discuss the big sexy stuff, but we can't let this crowd out
> the main goal.
>
> So my question is: has anyone tried to write a program with specialized
> generics with the valhalla implementation?   Well, we'd really
> appreciate it.
>
> I know people want to contribute.  At least right now, here's what
> contribution looks like from our perspective:
>
>      1.) Please try it out!  Write some code!
>      2.) Tell us what works and what doesn't!
>      3.) Nice comments are always a bonus!  (And are welcome even if you
> didn't do (1) and (2)).
>      4.) If you can't do (1) and (2), and still have something important
> to say in the big-picture department, please do it a) nicely, b)
> constructively, c) succinctly.
>
> Thanks,
> -Brian
>



More information about the valhalla-dev mailing list