Lambda Integration Plan

Development of Project Lambda takes place in a separate repository, namely the lambda repository; working on a sandbox repository guarantees that experimental features that are being pushed back in order to enable support for lambda expression, method references and extension methods do not cause disruptions to the main JDK 8 repository. As the bits in the sandbox repository gets more mature, it makes sense to integrate them to the main JDK 8 repository. This allows us to make the review process smoother, by reviewing lots of small changesets as opposed to one big, flat changeset - this, in turns, help us keeping the quality bar high for the bits in the JDK 8 repository. As far as the compiler implementation is concerned, this integration process will be structured into three main phases - each phase refers to a specific part of the compiler pipeline that needs to be updated:

  • parser (changes to AST, parser, scanner, etc.)
  • analysis (changes to attribution, inference, flow analysis, etc.)
  • code generation (changes to desugaring, code generation, etc.)

Each phase has a set of pre-requisites - that is, a list of changeset that should be pushed into the JDK 8 master before the integration process for that phase can take place. This is crucial in order to minimize differences between bits in the JDK 8 main repository and the bits in the lambda repo, as well as to ensure that the quality of the code remains high throughout the whole integration process. Also, in order to minimize differences between the lambda repository and the JDK 8 master repository, a merge (from JDK 8 master to lambda) is planned at the beginning of each integration phase (i.e. after prerequisities for that phase have been satisfied).

The first phase of the integration effort will cover the following features:

  • support for lambda expression
  • support for method references

Features that will be left out from this initial integration effort are:

  • exception transparency (TBD as to whether it is useful)
  • extension methods (will be integrated at a later stage)
Below are reported detailed tables illustrating each of the steps mentioned above.

Parser

Description This phase of the integration process includes changes to the front-end of the javac compiler, such as changes to the AST nodes (i.e. add new nodes to support lambda expressions), changes to the javac parser/scanner in order to parse new constructs and so forth.
Prerequisities JDK 8 parser/scanner should be refactored so that lookahead can be added in a more straightforward way

Changes

Add AST node for lambda expressions (include changes to Tree API)

Add AST node for method references (include changes to Tree API)

Add lookahead support

Add parser support for lambda expression

Add parser support for method references


Analysis 

Description

This phase of the integration process includes changes to the type-system area of the javac compiler, such as changes to the attribution phase, member enter phase, flow analysis and so forth.

Prerequisities

Add type-arguments to MethodType and cleanup usages of Type.ForAll

Add support for recursive overload resolution (needed for on-demand attribution of lambda bodies)

Infer and Resolve should share the same method applicability check routine

Add support for target-typing

Retrofit diamond to use target-typing

Changes

Add functional descriptor lookup support to com.sun.tools.javac.code.Types

Add attribution support for lambda expression

Add attribution support for method references

Add inference routine for wildcards in functional descriptors

Add support for effectively final inference

Add support for target typing in conditional expressions 


Code Generation

Description This phase of the integration process includes changes to the code-generation area of the javac compiler, such as adding proper desugaring support for both lambda expression and method references.
Prerequisities Add support for static arguments to bootstrap method in indy method calls (new subclass of MethodSymbol)

Changes

Add abstract desugaring support for lambda expression/method reference

Add basic translation support for lambda/method references based on inner classes

Add advanced translation support for lambda/method references based on 292

So - where are we? We have successfully moved the parser code into the JDK 8 repository - however, the parser extensions are disabled by default in the JDK 8 repository (they are only enabled for internal testing purposes). In other words, it's still business as usual - i.e. the most recent version of the lambda compiler is still the one in the lambda repository, with the lambda binary snapshot to follow closely. Anyone interested in experimenting with Project Lambda should still use lambda binary snapshot/lambda repository, as there is no way to get lambda code compiled with the JDK 8 compiler. The integration process will continue in background as bits in the lambda repository will become relatively stable and mature. Enjoy!


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Maurizio Cimadamore is a member of the langtools team based in Santa Clara, CA. His efforts are mainly focused on the type-system area of the Java compiler.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today