On 10/10/2010 02:20 PM, Rémi Forax wrote: > Le 10/10/2010 20:08, Per Bothner a écrit : >> So we've determined that to make use of 292 Kawa should keep its >> abstract gnu.mapping.Procedure class, but add a new method: >> MethodHandle asMethodHandle() >> >> I mis-concluded that the compiler should therefore generate code >> to call asMethodHandle() and then the MethdHandle#invoke method. >> However, that doesn't seem like the right way to do it. >> > > Why ?
An example I was considering was: (define (twice f x) (f (f x))) My initial thought was to compile this as: public static Object (Procedure f, Object x) { MethodHandle f$mh = f.asMethodHandle(); return f$mh.invoke(f$mh.invoke(x)); } But this is (presumbly) just using regular method calls, without any invokedynamoc or special VM magic or callsite specification, so it wouldn't get the real performance benefit. To do that I should generate actual invokedynamic instructions, along with a suitable CallSite handler, correct? [More on the rest of your response after I've studied it.] -- --Per Bothner p...@bothner.com http://per.bothner.com/ _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev