I am happy to report I could run the InvokeDynamicDemo day! I had to pass empty maps instead of nulls to the 'putPatches' method, otherwise it throws an NPE (honestly, I have no idea how it could work otherwise).
Champagne! Iulian On Wed, Dec 17, 2008 at 1:47 AM, Iulian Dragos <[email protected]> wrote: > Good to see your neck is better! > > On Wed, Dec 17, 2008 at 12:21 AM, Paul Phillips <[email protected]> wrote: >> You are quite right, the whole java.dyn package wasn't being built. I will >> guess that when the mlvm >> patches were last tested, the make system built whatever files it found - >> but now it only builds what is >> specifically enumerated. I mimicked another java package to get it built, >> as shown in this patch: >> >> http://www.improving.org/scala/openjdk.diff > > Thanks for the patch. So far, I built those files the old fashioned > way (javac `find jdk/src/... -iname *.java`), and it seems I'm finally > getting somewhere! I had to remove the 'MethodHandles' XX flag (my vm > does not recognize it), but then I got one step further: > > >> [pa...@jon demo (exp)]$ scala >> Welcome to Scala version 2.7.2.final (OpenJDK Server VM, Java >> 1.7.0-internal). >> Type in expressions to have them evaluated. >> Type :help for more information. >> >> scala> import java.dyn._ >> import java.dyn._ >> >> scala> class Foo { def bar(s: String): Unit = { } } >> defined class Foo >> >> scala> val fooType = MethodType.make(classOf[Unit], >> Array[Class[_]](classOf[String]), false) >> fooType: java.dyn.MethodType = (java.lang.String)void >> >> scala> val fooHandle = MethodHandles.findVirtual(classOf[Foo], "bar", >> fooType) >> # >> # A fatal error has been detected by the Java Runtime Environment: >> # >> # SIGBUS (0xa) at pc=0x01366b0f, pid=49241, tid=2953121792 >> # >> # Java VM: OpenJDK Server VM (14.0-b08 mixed mode bsd-x86 ) >> # Problematic frame: >> # V [libjvm.dylib+0x366b0f] >> # > > scala> val fooHandle = MethodHandles.findVirtual(classOf[Foo], "bar", > fooType) > fooHandle: java.dyn.MethodHandle = bar:(Foo,java.lang.String)void > > scala> fooHandle.invoke(new Foo, "abc") > <console>:10: error: value invoke is not a member of java.dyn.MethodHandle > fooHandle.invoke(new Foo, "abc") > ^ > > Hurray! > > The error is due to the Scala type checker not knowing that > MethodHandles are special. I'll have to try John's example in the > morning, I had enough excitement for one evening :) > >> Let us keep soldiering onward, I can see the train at the end of the >> tunnel... > > And its lights are on! > > Cheers, > Iulian > > -- > « Je déteste la montagne, ça cache le paysage » > Alphonse Allais > -- « Je déteste la montagne, ça cache le paysage » Alphonse Allais _______________________________________________ mlvm-dev mailing list [email protected] http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
