implement basic Java 8 lambda support

The two big pieces here are basic invokedynamic support and a working
version of LambdaMetaFactory.metafactory.  The latter works by
dynamically building a synthetic class with three methods: a static
factory method, a constructor for the factory method to call, and a
method to satisfy the requested interface which defers to the
specified MethodHandle.

This work relies heavily on Avian's specific MethodType and
MethodHandle implementations, which provide extra, non-standard
features to make code generation easier.  That means we'll probably
need to use Avian's versions of java.lang.invoke.* even when building
with the OpenJDK or Android class libraries.
This commit is contained in:
Joel Dice
2015-08-05 15:55:52 -06:00
parent 792684b935
commit 2465459079
16 changed files with 870 additions and 27 deletions

View File

@ -23,6 +23,7 @@ import avian.ConstantPool;
import avian.ConstantPool.PoolEntry;
import avian.Assembler;
import avian.Assembler.FieldData;
import avian.Assembler.MethodData;
import java.util.List;
@ -402,6 +403,7 @@ public class Proxy {
ByteArrayOutputStream out = new ByteArrayOutputStream();
Assembler.writeClass
(out, pool, nameIndex, superIndex, interfaceIndexes,
new FieldData[0],
methodTable.toArray(new MethodData[methodTable.size()]));
byte[] classData = out.toByteArray();