invokedynamic and Method Handles.
Java 7 comes with
invokedynamic and Method Handles which can help with the implementation of dynamic languages on the JVM. The JRuby team has worked to integrate
invokedynamic and some experiments with improving Rhino's speed on Java 7 were started too.
InfoQ talked to Douglas Campos about dyn.js, the reasons for its creation and more.
InfoQ: What's dyn.js?
dyn.js is a new implementation of the ECMAScript 5 specification. My main motivation on creating dyn.js was to have a friendlier codebase, taking advantage of the latest cool JVM stuff, like invokedynamic, MethodHandles & friends.
InfoQ: Are you working on an ahead-of-time compiler or a dynamic runtime?
We started building an ahead-of-time compiler to bytecode, but this can definitely change over time, as we continue to implement the spec.
InfoQ: How is dyn.js different from Rhino or Oracle's Nashorn?
Rhino is an truly piece of art - back when Rhino was born, the JVM was not cool as today, so they really made miracles getting performance by hand-crafting almost all aspects of their runtime. So dyn.js is kinda like we were starting Rhino again in 2011 - with a much powerful JVM and not worrying about backward compatibility.
I announced dyn.js during BrazilJS 2011 (braziljs.com.br), and Oracle announced Nashorn at JVM Language Summit 2011 (http://openjdk.java.net/projects/mlvm/jvmlangsummit/). The main difference is that Oracle's implementation is commercial and AFAIK, they haven't decided if it will ever be opensource (To Be Defined status). dyn.js is opensource software (Apache 2 like license).
InfoQ: How are you using invokedynamic and Attila Szegedi's Dynalink?
The main reason to be using invokedynamic is to be able to have a smaller runtime, as you can have polymorphic method signatures (that will be linked only at runtime), and JIT-friendly dynamic code.
Szegedi's dynalink is core to the dyn.js runtime, as we route all dynamic invocations through dynalink's machinery, which has many features, like type conversion (I'm using it for autoboxing/unboxing of JS primitives right now), inline cache (it has a monomorphic inline cache), and the most interesting feature, the Meta Object Protocol, that can revolutionize how dynamic JVM-based languages interact, allowing even JIT inlining between language runtimes.
InfoQ: Any plans on integrating Node.js-style frameworks, maybe RingoJS?
That's definitely a good target, I'm looking already towards node.x framework , but I believe that once we get closer to spec compliance that kind of stuff will be a natural path.
InfoQ: Who's behind dyn.js?
I started working on the project with Alexandre Porcelli (@porcelli) (the parser guy), and after that I began inviting more friends to help. The geek appeal is definitely strong, but I'm really into language runtime development (I'm a JRuby contributor), and found a place to get my feet wet with Java 7 features - that unfortunately, don't have that much documentation available (we're exploring the cool new stuff the hotspot/mlvm guys did).
The dyn.js repository is available at GitHub and requires Java 7 as well as Jitescript, a Java API for bytecode creation inspired by BiteScript. For more technical details, see Douglas' slides for the dyn.js talk at JSConf.eu.
Helen Walton Dec 17, 2014
Heather Hassebroek and Kent McDonald on Positive Politics, Organisational Change, Leadership Engagement and Sharing Experiences through Stories
Heather Hassebroek and Kent McDonald Dec 17, 2014
Monica Beckwith Dec 16, 2014