Jvm Language Summit Rose 20081016

1,544 views

Published on

A report on the JVM Language Summit - Many Languages, One Machine

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,544
On SlideShare
0
From Embeds
0
Number of Embeds
35
Actions
Shares
0
Downloads
57
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Jvm Language Summit Rose 20081016

  1. 1. The JVM Language Summit: Many Languages, One Machine John R. Rose, Sr. Staff Engineer john.rose@sun.com http://blogs.sun.com/jrose
  2. 2. 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
  3. 3. Handout for JavaOne, May 5-9 Guerrilla marketing at its finest: Copyright Sun Microsystems, Inc 2008: 3
  4. 4. JVM Language Summit 2008 http://jvmlangsummit.com From the website: Copyright Sun Microsystems, Inc 2008: 4
  5. 5. 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
  6. 6. JVM languages presented •  Java (Gosling keynote) •  Lisps: Common Lisp (Jatha), Scheme, Clojure •  Scripting: Groovy, JRuby, Jython, PHP, Rexx •  Assembler: ASM, Kawa •  JavaFX •  Scala •  Fortress Copyright Sun Microsystems, Inc 2008: 6
  7. 7. Day One Highlights Copyright Sun Microsystems, Inc 2008: 7
  8. 8. Maxine: The JVM that hosts itself Bernd Mathiske, Sun http://wiki.jvmlangsummit.com/MaxineVM Copyright Sun Microsystems, Inc 2008: 8
  9. 9. Run Your Fortress: Run your whiteboard White Board 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 evaluated in parallel. y = 3x sin x cos 2x log log x http://wiki.jvmlangsummit.com/Fortress Copyright Sun Microsystems, Inc 2008: 9 Page 5
  10. 10. Laptop – 1, Rose & Goetz – 0 Copyright Sun Microsystems, Inc 2008: 10
  11. 11. Day Two Highlights Copyright Sun Microsystems, Inc 2008: 11
  12. 12. Ask the man with the MOP… MOP summary: we have... Attila Szegedi, Adeptra • Protocol for language independent property access on objects and for invocation of methods, • designed for composability, • Factory that builds an optimized composite MOP from all MOPs available to a class loader, • MOP for POJOs, usable as a fallback when no other MOP matches. Handles overloaded methods, varargs, type conversions, http://wiki…/DynamicLanguageMOP Copyright Sun Microsystems, Inc 2008: 12
  13. 13. Clojure: Not your granddad’s Lisp Atomic Update Rich Hickey, Clojure.org foo :a quot;fredquot; :b quot;ethelquot; :c 42 :d 17 :e 6 @foo Structural sharing :a quot;lucyquot; :b quot;ethelquot; • Always coordinated :c 42 :d 17 • Multiple semantics :e 6 • Next dereference sees new value • Consumers of values unaffected http://wiki.jvmlangsummit.com/Clojure Copyright Sun Microsystems, Inc 2008: 13
  14. 14. Day Three Highlights Copyright Sun Microsystems, Inc 2008: 14
  15. 15. The view from Redmond !quot;#$%!&$'()$#quot;)*+ Mads Torgersen, Microsoft ! !quot;##$%&'(%$)quot;)*($quot;$+(#(,quot;'($-*&)*$+.(%$'*($ +&%/quot;')* ! 0#.-$/quot;'*$&%$1)quot;##(23$#quot;4,5quot;,($%/()&6&)7$89/&)quot;##9 :3 ;%<$'*($2()(&=(2$.>?()'$&6$&'$-quot;4'%$'.$#..<5/ @3 A6$4.'B$5%($#quot;4,5quot;,($>&4+&4,$25#(%$.4$254'&C($'9/( D3 E&'*(2$-quot;9B$2('524$!quot;#$ quot;4+$%$&'(') E8% F3 Gquot;')*$5/$+&%/quot;')*$E8$$-&'*$4(-$)quot;%( H3 !.C/&#($E8$quot;4+$&4%'quot;##$&4$)quot;##$%&'( http://wiki…/BehindLINQ Copyright Sun Microsystems, Inc 2008: 15
  16. 16. Java: Still the common language? !quot;#$%&$'($)&*&+,$ Neal Gafter, Microsoft •! -''$.(//(#$0quot;#12quot;1&$3&quot;42+&5$4($6quot;7quot;$ –! 89#quot;/:.$/&4;('$':5<quot;4.;$ –! =+(<&+$4quot;:0$.quot;005$ –! >:.;$:'&#?@&+5$A&B1B$CDEF$ –! G&9%(+'$<quot;+quot;/&4&+5$ –! Hquot;11&'I&J4&#'&'$#2/&+:.5$ –! !quot;#$%quot;&'()*'++,-.+$ –! !(#?#2quot;?(#5$ http://wiki…/JVMClosures Copyright Sun Microsystems, Inc 2008: 16
  17. 17. Beyond the prepared talks… Key conversations: •  design and usage of invokedynamic •  metaobject protocols •  language interoperability •  platform (bytecode, library) design •  immutable data structures Copyright Sun Microsystems, Inc 2008: 17
  18. 18. The tale of invokedynamic Rob Nicholson Fredrik Öhrström Rémi Forax John Rose Jochen Theodorou Tom Enebo Charlie Nutter Attila Szegedi Copyright Sun Microsystems, Inc 2008: 18
  19. 19. 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 •  continuations •  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
  20. 20. 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. http://blogs.sun.com/jrose/entry/view_from_the_summit Copyright Sun Microsystems, Inc 2008: 20
  21. 21. Pizza with extra MOP Copyright Sun Microsystems, Inc 2008: 21
  22. 22. Results Copyright Sun Microsystems, Inc 2008: 22
  23. 23. Results •  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 See also: http://blogs.sun.com/jrose/entry/view_from_the_summit Copyright Sun Microsystems, Inc 2008: 23
  24. 24. Results •  …Also, cool T-shirts: Copyright Sun Microsystems, Inc 2008: 24
  25. 25. 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
  26. 26. 1997–2007 was a great decade... Copyright Sun Microsystems, Inc 2008: 26
  27. 27. 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
  28. 28. 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
  29. 29. The widget that came to stay… Copyright Sun Microsystems, Inc 2008: 29
  30. 30. 2008–2018: What shall we build now? Copyright Sun Microsystems, Inc 2008: 30
  31. 31. 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
  32. 32. 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
  33. 33. 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 http://wikipedia.org/wiki/List_of_JVM_languages •  One account lists 200 of them! http://robert-tolksdorf.de/vmlanguages.html Copyright Sun Microsystems, Inc 2008: 33
  34. 34. 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
  35. 35. 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
  36. 36. Pain Points •  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
  37. 37. So what's missing? •  Dynamic invocation •  And always, higher performance Copyright Sun Microsystems, Inc 2008: 37
  38. 38. 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
  39. 39. the Da Vinci Machine a multi-language renaissance for the Java™ Virtual Machine architecture http://openjdk.java.net/ /projects/mlvm/ 39
  40. 40. 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
  41. 41. Da Vinci Machine Project Mission •  Prototype JVM extensions to run non-Java languages efficiently •  First-class architectural support (not hacks or side-cars) •  Complete the existing architecture with general purpose extensions •  New languages to co-exist gracefully with Java in the JVM Copyright Sun Microsystems, Inc 2008: 41
  42. 42. 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
  43. 43. JSR 292 – Method handles •  java.dyn.MethodHandle >  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
  44. 44. JSR 292 – Method handles (2) •  method handles give pluggable access to >  invokestatic/invokespecial >  invokevirtual/invokeinterface >  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, varargs, etc…) Copyright Sun Microsystems, Inc 2008: 44
  45. 45. 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
  46. 46. HotSpot – Anonymous classes •  Faster and more reliable loading and unloading •  Little interaction with system dict. or class loaders >  (“class names considered harmful”) >  a better way to load ad hoc bytecodes >  not a proposed standard, just an implementation trick •  Library-directed code customization >  via constant pool patching Copyright Sun Microsystems, Inc 2008: 46
  47. 47. 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
  48. 48. 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
  49. 49. 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- centric. •  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
  50. 50. 2008–2018: a great decade for JVMs and languages http://wiki.jvmlangsummit.com http://openjdk.java.net/projects/mlvm http://blogs.sun.com/jrose

×