The JVM Language Summit:
Many Languages, One Machine
John R. Rose, Sr. Staff Engineer
How language & VM geeks party
• January 2008: Sun engineers Brian Goetz, Charlie
Nutter, Dan Ingalls, & John Rose visit and
thoroughly enjoy 3 days in Redmond at
Microsoft’s Lang.NET conference.
• March 2008: Brian says to John et al, “Why don’t
we do one of those at Sun for the JVM?”
• September 2008: ~80 key VM and language
designers meet in Santa Clara for 3 exhilarating
days, discussing the future of their projects.
(Microsoft colleagues returned the visit!)
Copyright Sun Microsystems, Inc 2008: 2
Handout for JavaOne, May 5-9
Guerrilla marketing at its finest:
Copyright Sun Microsystems, Inc 2008: 3
JVM Language Summit 2008
From the website:
Copyright Sun Microsystems, Inc 2008: 4
VMs represented by attendees
• Sun HotSpot*, Maxine*, Monty
• Oracle JRockit
• IBM J9
• Azul HotSpot*
• Microsoft CLR*
• Parrot VM*
* marks a presentation
Copyright Sun Microsystems, Inc 2008: 5
Day One Highlights
Copyright Sun Microsystems, Inc 2008: 7
Maxine: The JVM that hosts itself
Bernd Mathiske, Sun
Copyright Sun Microsystems, Inc 2008: 8
Fortress: Run your whiteboard
ProjectFortress: run your whiteboard, in parallel, on the JVM
Many opportunities for parallelism
David Chase, Sun
vnorm = v/ v
k Aggregate objects and
ak x reductions drive parallelism
k←1:n with “generators”.
C =A∪B Operands are
y = 3x sin x cos 2x log log x
Copyright Sun Microsystems, Inc 2008: 9
Laptop – 1, Rose & Goetz – 0
Copyright Sun Microsystems, Inc 2008: 10
Day Two Highlights
Copyright Sun Microsystems, Inc 2008: 11
Ask the man with the MOP…
Attila Szegedi, Adeptra
• Protocol for language independent property
access on objects and for invocation of
• designed for composability,
• Factory that builds an optimized composite
MOP from all MOPs available to a class
• MOP for POJOs, usable as a fallback when
no other MOP matches. Handles overloaded
methods, varargs, type conversions,
Copyright Sun Microsystems, Inc 2008: 12
Clojure: Not your granddad’s Lisp
Rich Hickey, Clojure.org
foo :a quot;fredquot;
• Always coordinated
• Multiple semantics
• Next dereference sees new value
• Consumers of values unaffected
Copyright Sun Microsystems, Inc 2008: 13
Day Three Highlights
Copyright Sun Microsystems, Inc 2008: 14
The view from Redmond
Mads Torgersen, Microsoft
D3 E&'*(2$-quot;9B$2('524$!quot;#$ quot;4+$%$&'(') E8%
Copyright Sun Microsystems, Inc 2008: 15
Java: Still the common language?
Neal Gafter, Microsoft
Copyright Sun Microsystems, Inc 2008: 16
Beyond the prepared talks…
• design and usage of invokedynamic
• metaobject protocols
• language interoperability
• platform (bytecode, library) design
• immutable data structures
Copyright Sun Microsystems, Inc 2008: 17
The tale of invokedynamic
Jochen Theodorou Tom Enebo
Copyright Sun Microsystems, Inc 2008: 18
While we’re at the hardware store…
• too many little classes (need relief in packaging and/or loading)
• new method linkage or dispatch
• tagged primitives
• guaranteed tail-call optimization
• interface injection
• interpreter vs. bytecodes, byte compiler vs. JIT (need graceful mixed mode)
• naked native methods
• strange arrays (arrays of tuples, etc.)
• a fast numeric tower, rational arithmetic
• floating point rounding modes
Copyright Sun Microsystems, Inc 2008: 19
My own take-aways
• invokedynamic – sound design,
exposition needs work
• synergy: JSR 292 with Attila Szegedi’s MOP
• Interface injection is going to be helpful.
• Tailcall and value types will never go away.
• Innovation on the JVM is a requirement.
• We have to do another Summit next year.
Copyright Sun Microsystems, Inc 2008: 20
Pizza with extra MOP
Copyright Sun Microsystems, Inc 2008: 21
Copyright Sun Microsystems, Inc 2008: 22
• Average conference ratings 4.4 – 4.9 out of 5.
• Talk ratings consistently in the 4-5 range.
• Rapid exchange of ideas
• New partnerships among a who’s who of leaders
• A better sense of our shared future
Copyright Sun Microsystems, Inc 2008: 23
When geeks party, we all win.
• This meeting was none too soon.
• The JVM is going to be used for more than Java.
(Alternatively, the JVM risks irrelevance.)
• Let’s take a broader look at the history…
Copyright Sun Microsystems, Inc 2008: 25
was a great decade...
Copyright Sun Microsystems, Inc 2008: 26
1997–2007 was a great decade...
...to invent virtual machines
• CLR-, JVM-based systems have become normal
• CPU cycles are cheap enough for JIT, GC, RTT, ...
• many Java programmers, tools, systems
• much of the Java ecosystem is now open-source
Result: VMs & tools are mature, ubiquitous
Copyright Sun Microsystems, Inc 2008: 27
Great JVM features
• flexible online code loading (nice safe bytecodes)
• GC & object schema
• reflective access to classes & objects
• lots of ancillary tools (JMM, JVMTI, dtrace)
• good libraries & a nice language to write more
• optimizing JITs, object- and library-aware
• clever performance techniques:
> type inference, customization, profiling,
deoptimization, fast/slow paths, etc., etc.
Copyright Sun Microsystems, Inc 2008: 28
The widget that came to stay…
Copyright Sun Microsystems, Inc 2008: 29
What shall we build now?
Copyright Sun Microsystems, Inc 2008: 30
What shall we build now?
• Smaller devices (phones, cards, motes)
• Bigger data crunchers (many-core, DARPA HPCS)
• Richer presentations (complex immersive models)
• Fancier network protocols (cloud computing)
• Nomadic computations (agents, workflow)
• Mutable or scriptable widgets
All these are easier to engineer when a suitably
tuned VM decouples hardware from software.
Copyright Sun Microsystems, Inc 2008: 31
So, here is a great new decade…
…For more VMs!
• Lightweight VMs for small devices
• Massively parallel VMs for huge problems
• Giant throughput VMs for network computing
• Browser-linked VMs for rich clients
• Etc., etc.
“One Machine” “Common ISA/ABI”
Having Java bytecodes and libraries in common
gives access to a more tools and platforms.
Copyright Sun Microsystems, Inc 2008: 32
It is also a great new decade…
…For new languages!
Formal computing languages provide a crucial mediation between
programmers and their machines. These languages get tweaked,
hacked, and replaced, as programmers scratch what itches…
• There are dozens of JVM languages
• One account lists 200 of them!
Copyright Sun Microsystems, Inc 2008: 33
What sorts of languages?
Each language provides specific modes of
abstraction, decoupling a programmer’s chosen
mode of thinking from the details of the machine.
• Little languages focus on small domains.
• Presentation languages specify visual forms.
• Scripting languages provide informality.
• “Classic” languages access traditional insights.
• Parallel languages concentrate on big data flows.
• Java is a great way to directly program the JVM.
• And sometimes there is a Better Mousetrap.
Copyright Sun Microsystems, Inc 2008: 34
Languages can reuse the Java VM
High level languages often require:
• very late binding (that is, runtime x, for x in
loading, linking, typing, code generation, etc.)
• automatic storage management (GC)
• environmental queries (reflection, stack walking)
• exotic primitives (tailcall, bignums, call/cc)
• robust handling of incorrect or malicious inputs
• helpful runtime support libraries (REs, math, ...)
• a compiler (JIT and/or AOT) that understands it all
Copyright Sun Microsystems, Inc 2008: 35
• The JVM is a stronger foundation than C/C++
> but not quite enough for emerging languages
> Reason: the JVM was made for Java only...
> (historically the x86 was for C and Pascal...)
• Language implementers still try to reuse the JVM
• Near-misses are experienced as “pain points”
Copyright Sun Microsystems, Inc 2008: 36
So what's missing?
• Dynamic invocation
• And always, higher performance
Copyright Sun Microsystems, Inc 2008: 37
So what's missing?
• Dynamic invocation
• Lightweight method objects
• Lightweight bytecode loading
• Continuations and stack introspection
• Tail calls and tail recursion
• Tuples and value-oriented types
• Immediate wrapper types
• Symbolic freedom (non-Java names)
• And always, higher performance
Copyright Sun Microsystems, Inc 2008: 38
the Da Vinci Machine
a multi-language renaissance
for the Java™ Virtual Machine
A Solution from Sun
• Evolutionary adaptation of the present JVM
• Open-ended experimentation on Sun's Hotspot
> wild ideas are considered, but must prove useful
> while incubating, features are disabled by default
• Eventual convergence on standards
• Extension of the standard JVM architecture
> deliberate, measured, careful extension
Copyright Sun Microsystems, Inc 2008: 40
Da Vinci Machine Project Mission
• Prototype JVM extensions to run non-Java
• First-class architectural support (not hacks or
• Complete the existing architecture with general
• New languages to co-exist gracefully with Java in
Copyright Sun Microsystems, Inc 2008: 41
JSR 292 – Dynamic Invocation
• non-Java call site in the bytecodes
• language-specific handler
> determines call linkage at runtime
> works in a reflective style
> installs direct (non-reflective) methods
• stateful: updated or revoked over time
• type-sensitive target method selection
> based on first argument, all arguments
> or no arguments
Copyright Sun Microsystems, Inc 2008: 42
JSR 292 – Method handles
> lightweight method reference
> each instance supports just one invoke op
> the signature of the invoke can vary
• caller invokes knowing method handle signature
> …but not its name or containing class
> signature mismatches cause exceptions
• call runs at nearly the speed of normal Java call
Copyright Sun Microsystems, Inc 2008: 43
JSR 292 – Method handles (2)
• method handles give pluggable access to
> common conversions (e.g., checkcast)
> curried or “bound” methods
> complex combinators
• required to glue together dynamic call sites
• requires VM and/or library support for common
adaptation patterns (curry, receiver check,
Copyright Sun Microsystems, Inc 2008: 44
JSR 292 (?) – Interface Injection
• a structured way to add methods to classes
> some interfaces are “injectable”
> for each class, a handler is called ≤1 times
> the handler’s decision is final
> handler provides method handles as needed
• can extend the meaning of classes
• e.g, a “Groovy method” on java.lang.String
• or a “Ruby metaobject” on java.lang.Integer
• fast, cheap, lazy, and general; not yet specified
Copyright Sun Microsystems, Inc 2008: 45
HotSpot – Anonymous classes
• Faster and more reliable loading and unloading
• Little interaction with system dict. or class
> (“class names considered harmful”)
> a better way to load ad hoc bytecodes
> not a proposed standard, just an
• Library-directed code customization
> via constant pool patching
Copyright Sun Microsystems, Inc 2008: 46
HotSpot – Performance work
• No-brainer: Support less-static bytecode shapes
> Ongoing for years; see website for fixed bugs
> Examples: Class.isInstance, Arrays.copyOf
• Faster reflection
• Escape analysis (etc.) to remove auto-boxing
• Maybe: No-heap rep. for java.lang.Integer
• More subtle: Faster closure-like interfaces
• Etc., etc.
Copyright Sun Microsystems, Inc 2008: 47
Other great VM ideas
(which might need community champions)
• Continuations (cf. Scheme call/cc)
active work by Lukas Stadler at JKU, Linz
• Tail calls (functional languages, threaded code)
active work by Arnold Schwaighofer at JKU, Linz
• Value object (cf. Lisp fixnums)
• Tuple types (cf. .NET structs, Fortress tuples)
Copyright Sun Microsystems, Inc 2008: 48
Are we re-inventing the world?
• No, we are adapting classic ideas to the JVM.
> In some cases, exposing mature JVM internals to language
implementers, for the first time.
> In other cases, adjusting JVM architecture to be less Java-
• Language implementers know what they want
> (and know how to simulate it with 100x slowdown)
• VM implementers know what VMs can do
> (and know how to make their favorite language sing)
• Let's bring them together.
Copyright Sun Microsystems, Inc 2008: 49
a great decade