The Parrot VM (40’) Its goals and challenges for dynamic languages François Perrad [email_address]
About Me Parrot-porter since Oct 2005 In the TOP 10 of committers Releaser Manager of Parrot 1.1.0 Packager for Windows (with mingw) http://sourceforge.net/projects/parrotwin32/ ~1 daily build on  Smolder   Mostly a HLL implementor Lua WMLScript  (bytecode translator) Markdown …
About Parrot VM a Virtual Machine started in 2001 … targets dynamic languages multi paradigm : functional, OO, … Register based (not stack based) Continuation Passing Style (CPS) allows interoperability between HLL  (High Level Language)   reuse components a great environment for HLL implementor Visible side effects CLR/DLR JSR  292
About commodity commodity   (*)   is some good for which there is demand, but which is supplied without qualitative differentiation across a market  An example generic pharmaceuticals  the interest for customers is lower prices (*) : Source Wikipedia
About  commoditization commoditization   (*)  is the process by which goods that have economic value and are distinguishable in terms of attributes (uniqueness or brand) end up becoming simple commodities in the eyes of the market or consumers. An example : Eclipse IDE IBM  gives/opens  its codebase the IDE market disappears competitors  die or survive in niche segment a new market : plugins for Eclipse Who is best placed in this market ?  Who controls the Eclipse roadmap ? (*) : Source Wikipedia
A stack of commodities My Web App
A stack of commodities Hardware My Web App
A stack of commodities Hardware : x86 Operating System My Web App
A stack of commodities Hardware : i386 Operating System : Linux Web Framework My Web App
A stack of commodities Hardware : i386 –  multi core Operating System : Linux Virtual Machine (Interpreter) Web Framework My Web App
Dynamic languages grow
C/C+ implementation Lua 5.1, LuaJIT 5.1 Lua Ruby 1.8, Ruby 1.9 (YARV), Rubinius Ruby SpiderMonkey, V8, … JavaScript CPython 2.6, CPython 3.1, Stackless, Psyco V2 (JIT), Unladen Swallow 2.6 (llvm) Python Perl 5.8, Perl 5.10 Perl - VisualBasic PHP 4.x, PHP 5.x PHP
JVM implementation Groovy 1.6 Groovy Scala 2.7 Scala Kahlua (J2ME) Lua JRuby 1.8 Ruby Rhino JavaScript JPython 2.5 Python - Perl - PHP
.NET/mono implementation ? Scala - Lua IronRuby Ruby JScript.NET JavaScript IronPython Python - Perl VB.NET VisualBasic Phalanger PHP
Challenges Languages must move on VM Initial C implementation is just a prototyp or a prove of concept Open Source resources are limited Efforts are duplicated   in language in libraries binding in module & framework core language or full modules ?
 Conditions for success Official Specifications  (vs reference implementation) rubyspec.org/  (Rubinius) perlcabal.org/ syn /  (Perl6) Official & huge Test Suite svn.pugscode.org/ pugs /t/ spec /  (Perl6) Mostly implements the language with the language itself codespeak.net/pypy /  (Python) User friendly policies for support, version, maintenance, …
Features for HLL implementor Multiple runcore  (opcode interpreter) switch, C goto, profiler, … GC - Garbage Collection Exception mechanism Unicode support ( ICU ) PBC - a bytecode file format Dynamic PMC  (PolyMorphic Container) build the HLL types as object as shared library Dynamic Opcode as shared library NCI - Native Call Interface a FFI mechanism
Features for HLL implementor PIR –  Parrot Intermediate Representation   the interface of Parrot an OO assembler, with rich calling convention 4 types : int, num, string, pmc PCT - Parrot Compiler Toolkit PGE – Parrot Grammar Engine parse the source produce an AST  (Abtract Syntax Tree)   NQP – Not Quite Perl describes action on AST HLLCompiler : base class for a compiler PIR generation from AST
Roadmap : some milestones 2005 : PGE Jan 2008 : NQP availability Start of Rakudo dev. Mar 2009 : Parrot 1.0 API stable (with deprecation rules) Installable Languages leave the nest Jul 2009 : Parrot 1.4 refactoring
Roadmap : next milestones ??? : Plumage – Module ecosystem trac.parrot.org/ parrot /wiki/ ModuleEcosystem   gitorious.org/ parrot -plumage/ parrot -plumage   Jan 2010 : Parrot 2.0 2010 Q1 : Rakudo Star a large subset of Perl6 usable in  real  world Updated roadmap  trac.parrot.org/parrot/report/14
Bibliography / Webography www.parrot.org trac.parrot.org   F. Elie,  Économie  du  logiciel   libre , Eyrolles Virtual Machine  Showdown :  Stack  Versus  Registers The Structure and Performance of  Efficient   Interpreters How to  not  write Virtual Machines for Dynamic Languages
"one bytecode to rule them all "   Credit : http://img-fan.theonering.net/rolozo/images/verger/PICT1619.JPG

The Parrot VM

  • 1.
    The Parrot VM(40’) Its goals and challenges for dynamic languages François Perrad [email_address]
  • 2.
    About Me Parrot-portersince Oct 2005 In the TOP 10 of committers Releaser Manager of Parrot 1.1.0 Packager for Windows (with mingw) http://sourceforge.net/projects/parrotwin32/ ~1 daily build on Smolder Mostly a HLL implementor Lua WMLScript (bytecode translator) Markdown …
  • 3.
    About Parrot VMa Virtual Machine started in 2001 … targets dynamic languages multi paradigm : functional, OO, … Register based (not stack based) Continuation Passing Style (CPS) allows interoperability between HLL (High Level Language) reuse components a great environment for HLL implementor Visible side effects CLR/DLR JSR 292
  • 4.
    About commodity commodity (*) is some good for which there is demand, but which is supplied without qualitative differentiation across a market An example generic pharmaceuticals the interest for customers is lower prices (*) : Source Wikipedia
  • 5.
    About commoditizationcommoditization (*) is the process by which goods that have economic value and are distinguishable in terms of attributes (uniqueness or brand) end up becoming simple commodities in the eyes of the market or consumers. An example : Eclipse IDE IBM gives/opens its codebase the IDE market disappears competitors die or survive in niche segment a new market : plugins for Eclipse Who is best placed in this market ? Who controls the Eclipse roadmap ? (*) : Source Wikipedia
  • 6.
    A stack ofcommodities My Web App
  • 7.
    A stack ofcommodities Hardware My Web App
  • 8.
    A stack ofcommodities Hardware : x86 Operating System My Web App
  • 9.
    A stack ofcommodities Hardware : i386 Operating System : Linux Web Framework My Web App
  • 10.
    A stack ofcommodities Hardware : i386 – multi core Operating System : Linux Virtual Machine (Interpreter) Web Framework My Web App
  • 11.
  • 12.
    C/C+ implementation Lua5.1, LuaJIT 5.1 Lua Ruby 1.8, Ruby 1.9 (YARV), Rubinius Ruby SpiderMonkey, V8, … JavaScript CPython 2.6, CPython 3.1, Stackless, Psyco V2 (JIT), Unladen Swallow 2.6 (llvm) Python Perl 5.8, Perl 5.10 Perl - VisualBasic PHP 4.x, PHP 5.x PHP
  • 13.
    JVM implementation Groovy1.6 Groovy Scala 2.7 Scala Kahlua (J2ME) Lua JRuby 1.8 Ruby Rhino JavaScript JPython 2.5 Python - Perl - PHP
  • 14.
    .NET/mono implementation ?Scala - Lua IronRuby Ruby JScript.NET JavaScript IronPython Python - Perl VB.NET VisualBasic Phalanger PHP
  • 15.
    Challenges Languages mustmove on VM Initial C implementation is just a prototyp or a prove of concept Open Source resources are limited Efforts are duplicated in language in libraries binding in module & framework core language or full modules ?
  • 16.
     Conditions for successOfficial Specifications (vs reference implementation) rubyspec.org/ (Rubinius) perlcabal.org/ syn / (Perl6) Official & huge Test Suite svn.pugscode.org/ pugs /t/ spec / (Perl6) Mostly implements the language with the language itself codespeak.net/pypy / (Python) User friendly policies for support, version, maintenance, …
  • 17.
    Features for HLLimplementor Multiple runcore (opcode interpreter) switch, C goto, profiler, … GC - Garbage Collection Exception mechanism Unicode support ( ICU ) PBC - a bytecode file format Dynamic PMC (PolyMorphic Container) build the HLL types as object as shared library Dynamic Opcode as shared library NCI - Native Call Interface a FFI mechanism
  • 18.
    Features for HLLimplementor PIR – Parrot Intermediate Representation the interface of Parrot an OO assembler, with rich calling convention 4 types : int, num, string, pmc PCT - Parrot Compiler Toolkit PGE – Parrot Grammar Engine parse the source produce an AST (Abtract Syntax Tree) NQP – Not Quite Perl describes action on AST HLLCompiler : base class for a compiler PIR generation from AST
  • 19.
    Roadmap : somemilestones 2005 : PGE Jan 2008 : NQP availability Start of Rakudo dev. Mar 2009 : Parrot 1.0 API stable (with deprecation rules) Installable Languages leave the nest Jul 2009 : Parrot 1.4 refactoring
  • 20.
    Roadmap : nextmilestones ??? : Plumage – Module ecosystem trac.parrot.org/ parrot /wiki/ ModuleEcosystem gitorious.org/ parrot -plumage/ parrot -plumage Jan 2010 : Parrot 2.0 2010 Q1 : Rakudo Star a large subset of Perl6 usable in real world Updated roadmap trac.parrot.org/parrot/report/14
  • 21.
    Bibliography / Webographywww.parrot.org trac.parrot.org F. Elie, Économie du logiciel libre , Eyrolles Virtual Machine Showdown : Stack Versus Registers The Structure and Performance of Efficient Interpreters How to not write Virtual Machines for Dynamic Languages
  • 22.
    "one bytecode torule them all " Credit : http://img-fan.theonering.net/rolozo/images/verger/PICT1619.JPG

Editor's Notes

  • #3 Hobby : compiler writer Not in core, but in languages ie user side Check the goal of Parrot : not only a VM for Perl6
  • #4 CLR : Common Language Runtime DLR : Dynamic Language Runtime JSR : Java Specification Request JSR 292 : Supporting Dynamically Typed Languages on the Java Platform
  • #5 Now, do some Marketing Not the best product, just enougt until the next technological breakthrough.
  • #6 Industrial & FOSS objectives
  • #8 In 1985, IBM commodotizes the Personal Computer Open Spec => compatible Harware : under control with Intel 8086 Software : forget with Microsoft DOS Apple survives in niche
  • #9 With Moore Law, x86 becomes server Unix guys dislike i386 The winner is Linux, distributed FOSS development. MS Windows (proprietary) is on Desktop.
  • #10 Only FOSS actors, but 2 flavors : OW2 & Apache Fondation : consortium (R&D mutualisation), Java Dynamic languages (geek) : Catalyst (Perl), Rails (Ruby),
  • #11 .NET CLR/DLR & mono JVM Parrot frequency grow is ended, Moore Law deals now with Multi core processor
  • #12 Not yet majority But dynamic/static ratio moves from 30-70% to 40-60% In the following slides, I sort languages by their rank on TIOBE (Sept 2009) 3. PHP 5. VB.NET 6. Perl 8. Python 9. JavaScript 10. Ruby 19. Lua
  • #13 Excludes all bridge
  • #14 No VB.NET & never Groovy new entrant, and a special case : targets only JVM
  • #16 Jython example : - targets last CPython - targets CPython modules - targets JVM, just a script language with access to Java objet/classe/framework Groovy has not this kind of dilemme.
  • #18 FFI : Foreign function interface
  • #19 PGE is a recursive descent parser + operator precedence NQP is a subset of Perl6 As example, the core of Lua on Parrot is only 4 KLOC
  • #20 Development based on monthly release
  • #21 Plumage : - metadata search - handles dependencies - install modules
  • #23 Credit : http://img-fan.theonering.net/rolozo/images/verger/PICT1619.JPG