First draft of translation document

Reinier Zwitserloot reinier at zwitserloot.com
Mon May 17 16:25:10 PDT 2010


I defer judgement on performance to your capable hands, but I did note some
apparent mistakes in the example code listed in section 6.2:

 - The closure$1 method is static yet seems to be trying to access the
"bottom" and "top" fields of the B2.Closure$1 class.

 - B2.Closure$1 implements Filter but presuming closure$1 was not meant to
be static, unless "closure$1" is the actual name of the one method in the
Filter SAM, "closure$1" is the wrong name. Presumably it should be called
"filter" or some such.

 - Filter's signature is Filter<T>, and its one method takes a T. that
method's erased signature would be (Ljava/lang/Object;)Z, and that's what
list.filter() will be working with, not (LPerson;)Z. Javac's standard
strategy here is to make filter(Person) the 'true' method and generate a
bridge method with signature filter(Object) which simply wraps a call on to
the true filter(Person), along with a cast. Given that the most likely place
that closure object will end up will use only the bridge method, this seems
needlessly inefficient. Is it perhaps possible to generate only the
filter(Object) variant?

--Reinier Zwitserloot



On Mon, May 17, 2010 at 11:28 PM, Brian Goetz <brian.goetz at oracle.com>wrote:

> This is quite common when activities evolve in parallel -- one must make
> assumptions (or wishful thinking) about the future course of other
> coincident
> activities.
>
> As to the specific issue of LDC support for method handle literals, John
> Rose
> mentioned it on his blog some time ago [1,2] and provided an implementation
> to
> the OpenJDK MLVM project in March 2010.  The 292 EG still has yet to hash
> out
> the details; in the event this is not ultimately surfaced in 292 we will
> then
> have to construct an alternate strategy.
>
> [1] http://blogs.sun.com/jrose/entry/view_from_the_summit
> [2] http://blogs.sun.com/jrose/entry/anatomy_of_a_call_site
>
> On 5/17/2010 3:53 PM, Neal Gafter wrote:
> > Brian-
> >
> > The latest "official" jsr292 draft (May 2008) doesn't contain any
> > special treatment for the ldc instruction.  I suspect there are other
> > jsr292 features referenced here not in that draft.  Where should I
> > find a draft of jsr292 that corresponds to the assumptions in this
> > document?
> >
> > Cheers,
> > Neal
> >
> > On Mon, May 17, 2010 at 10:31 AM, Brian Goetz<brian.goetz at oracle.com>
>  wrote:
> >> We've posted a document describing a (somewhat naive) translation
> strategy for
> >> translation of lambda expressions by javac here:
> >>
> >>    http://cr.openjdk.java.net/~mcimadamore/lambda_trans.pdf<http://cr.openjdk.java.net/%7Emcimadamore/lambda_trans.pdf>
> >>
> >>
> >>
>
>


More information about the lambda-dev mailing list