dynamid/jooflux — pull request #3 by jponge (2012-11-13 09:28:33+00:00)
Title: Properly dispatch interface-based method calls

Dispatching of `invokevirtual` calls are correct under the assumption that they are resulting of a
compilation of Java code. As a result, the method handles obtained using `Lookup::findVirtual`
always dispatch to classes that share a common superclass.

The previous implementation disabled `invokeinterface` calls as the target method handle resolution
using `Lookup::findVirtual` could turn out to be incorrect. Indeed, classes that implement an
interface may not share a common superclass with the said method.

This change introduces a polymorphic inline cache to deal with `invokeinterface` based calls.

It can run the full Clojure REPL with call site replacement of `invokestatic`, `invokevirtual` and
`invokeinterface` instructions. Running the Clojure REPL required a classpath trick though, as there
is apparently a known issue with possible raises of `ClassNotFoundException` with `invokedynamic`
where the bootstrap code could not see some runtime classes and vice-versa. The trick is to add both
the Clojure and the JooFlux jars in the boot classpath.