JSR 292 support in javac

In order to work with dynamic types, method handles, and invokedynamic I have made some provisional changes to javac as part of the Da Vinci Machine Project. The mlvm wiki has a full description for Project COIN. It is most desirable, of course, to program invokedynamic call sites as Java expressions, not just ASM code, and that's what those langtools patches are for.

The essential features are four:

  1. The type java.dyn.Dynamic will accept any method call and turn it into an invokedynamic instruction, and the full range of such instructions can be spelled from Java code.
  2. The type java.dyn.MethodHandle will accept any argument and return types for a call to the method named invoke, which means that Java code can spell the full range of method handle invocations.
  3. The full range of bytecode names acceptable to the JVM can be spelled from Java code, using an exotic identifier quoting syntax.
  4. The type java.dyn.Dynamic serves as a bare reference type: Anything implicitly converts to it, and it can be cast to anything, but it is not a subtype of java.lang.Object. Its methods, of course, are those from point #1, so it is handy for forming invokedynamic calls.

The rationale is pretty simple: If we put some minimal support into Java for defining and using names in other languages, then Java can be used as a system programming language for implementing them. Otherwise, the system programming language will be assembled bytecode. (I like to visit ASM, but don't want to live there.) If that piques your interest (and if you read my blog, I suppose it might) do check out the wiki page.

Since I use NetBeans, I've also adapted the NetBeans Java frontend (so it won't keep putting red squigglies under code I know is correct). For those adventurous souls who are already willing and able to hack their NetBeans (and take all the pertinent risks!), here is a JAR to replace the corresponding one in the bowels of NetBeans 6.5. Obviously, be sure to place it only in a scratch copy of NetBeans that you can afford to burn. If you don't know what I'm talking about, you are lucky, and please don't hack your NetBeans!

Comments:

Hi John,

This would be a nice addition indeed.

Best,
Ismael

Posted by Ismael Juma on March 30, 2009 at 11:34 PM PDT #

Have you already submitted your proposal to Project COIN? If so what was the reaction and how you estinate chances it will be included into java 7?
From my point of view it adds a lot of power to java. But I am fraid that it can be excluded from java 7.

Thanks

Posted by Serhiy on March 31, 2009 at 12:55 AM PDT #

Serhiy: Yes, I submitted the proposal just before the deadline, after brooding over it for a long time. The reactions will take a while to develop. You can monitor the coin-dev mailing list to see them as they appear. The links are all in the blog post above.

Ismael: Thank you.

Posted by John Rose on March 31, 2009 at 06:20 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

John R. Rose

Java maven, HotSpot developer, Mac user, Scheme refugee.

Once Sun and present Oracle engineer.

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