Brandon, Not really, but I don't want to deter anyone from exploration as its own goal. There are a lot of interesting ways that Clojure can leverage indy, this was an experiment. I'm going to try to put it in more high value places, and let the ideas marinate. This modification does nothing but actually use the instruction and pass all the tests. Obviously a lot of the really useful call sites for indy require much rework (and will break ABI and JVM compatibility, ick). The microarchitecture of how a language runtime can interact with its host platform is fascinating to explore. Btw, Attila Szegedi wrote the dynalink [1] library that has some abstractions over a lot of the machinery inside java.lang.invoke, definitely worth a look through.
I think that performance is something exciting for developers, and I think indy will help with that...eventually. This needs hammock time, Clojure is definitely not slow today. [1] https://github.com/szegedi/dynalink/wiki/User-Guide-0.5 Ghadi @smashthepast On Tuesday, April 16, 2013 10:58:50 PM UTC-4, Brandon Bloom wrote: > > Do you have any measurements, results, or conclusions to report? > > On Tuesday, April 16, 2013 12:12:15 PM UTC-4, Ghadi Shayban wrote: >> >> 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.