I've added a very minimal usage of invokedynamic to the compiler. Basically the smallest delta without having to change internals of ObjExpr or break ABI compatibility. This is minimal and raw. There are many many usages of indy that will really help the Clojure runtime, this ain't one of them. No benchmarks here, it's probably slower.
In current Clojure mainline, a Fn has reference slots to any vars it needs in its constant pool, like a cache. Anytime a non-dynamic Var's value needs to be accessed, the Var goes from the constant pool to the stack, and getRawRoot() is invoked on it. With this change, an invokedynamic instruction instead creates a ConstantCallSite, which closes over a looked-up Var, and then binds the call site to invoke getRawRoot() on it directly. This is only for non-dynamic Vars. Simple todos: cache the CallSite as a member on the Var itself so that all identical indy lookup instructions have fast bootstrapping. emit a similar call for dynamic vars remove the emission of Vars into the constant pool of a class Lots of really interesting use cases for invokedynamic and all the associated combinators in java.lang.invoke: Better protocol callsite caching CallSite "middleware" for things like CLJ specific instrumentation equality could be a special instruction KeywordCallSite could be its own instruction as well (apply) argument "spreading"/varargs array collection (through the combinators) potentially removing IFn.invoke(*) and using MethodHandle invocation instead (fat chance) You can pull down the changes at github.com/ghadishayban/clojure. mvn clean package, tested on OpenJDK 1.7 -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.