Commit Graph

15 Commits

Author SHA1 Message Date
Joel Dice
2465459079 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.
2015-08-06 13:30:18 -06:00
Joshua Warner
37d104871c test line number table generation in subroutines 2014-05-30 23:40:24 -06:00
Joel Dice
663d8da975 fix stack mapping bug for try blocks containing jsr/ret instructions
In order to calculate the initial stack map of GC roots for an
exception handler, we do a logical "and" of maps across all the
instructions contained in the try block for that handler.  This is
complicated by the presence of jsr/ret instructions, though, because
instructions in a subroutine may have multiple maps associated with
them corresponding to all the paths from which execution might flow to
them.

The bug in this case was that we were using an uninitialized map in
our calculation, resulting in a map with no GC roots at all.  By the
time the map was initialized, the damage had already been done.  The
solution is to treat an uninitialized map as if it has roots at all
positions so that it has no effect on the calculation until it has
been initialized with real data.
2012-12-12 15:54:15 -07:00
Joel Dice
59183c7821 fix subroutine stack mapping bug leading to crashes during GC
The stack mapping code was broken for cases of stack slots being
reused to hold primitives or addresses within subroutines after
previously being used to hold object references.  We now bitwise "and"
the stack map upon return from the subroutine with the map as it
existed prior to calling the subroutine, which has the effect of
clearing map locations previously marked as GC roots where
appropriate.
2011-02-16 14:29:57 -07:00
Joel Dice
c743140e08 add new subroutine test
This test covers the case where a local stack slot is first used to
store an object reference and later to store a subroutine return
address.  Unfortunately, this confuses the VM's stack mapping code;
I'll be working on a fix for that next.

The new test requires generating bytecode from scratch, since there's
no reliable way to get javac to generate the code we want.  Since we
already had primitive bytecode construction code in Proxy.java, I
factored it out so we can reuse it in Subroutine.java.
2011-02-16 11:41:33 -07:00
Joel Dice
4f23601b56 fix corner cases which led to crashes in JIT compiler
Compiling the entire OpenJDK class library into a bootimage revealed
some corner cases which broke the compiler, including synchronization
in a finally block and gotos targeting the first instruction of an
unsynchronized method.
2010-11-26 12:36:43 -07:00
Joel Dice
23197da679 fix handling of subroutines in methods of return type long on 32-bit systems 2009-10-06 03:17:12 +00:00
Joel Dice
4f78783ef1 various bugfixes for SSE-based floating-point support 2009-10-05 14:25:12 +00:00
Joel Dice
d12b441aa1 restore state from subroutine after jsr to avoid later confusion determining basic block boundaries 2009-07-20 08:26:01 -06:00
Joel Dice
5f6f8039e6 various bugfixes in subroutine stack mapping code 2009-07-13 17:49:15 -06:00
Joel Dice
b308354a3a handle subroutines properly when generating frame maps (initial sketch) 2009-06-26 15:36:04 -06:00
Joel Dice
b35a5a6db6 add new test to Subroutine to trigger latent bug compiling multiple jsr instructions to the same address 2009-06-10 18:11:27 -06:00
Joel Dice
14e509dfd2 add additional jsr test to Subroutine 2008-11-17 08:21:20 -07:00
Joel Dice
fb770d10fb implement jsr/ret support
The Subroutine test won't pass due to a bug in the stack mapping code
such that objects may be missed during GC.
2008-11-13 17:59:21 -07:00
Joel Dice
4dd1d1eec8 add Subroutine test to cover jsr and ret instructions 2008-11-12 10:07:30 -07:00