Parrot in a Nutshell. Dan Sugalski dan@sidhe.org. Parrot in a nutshell 1



Similar documents
Jonathan Worthington Scarborough Linux User Group

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

1/20/2016 INTRODUCTION

CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014

picojava TM : A Hardware Implementation of the Java Virtual Machine

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming

CSCI E 98: Managed Environments for the Execution of Programs

Rakudo Perl 6 on the JVM. Jonathan Worthington

The Design of the Inferno Virtual Machine. Introduction

The Hotspot Java Virtual Machine: Memory and Architecture

Chapter 1. Dr. Chris Irwin Davis Phone: (972) Office: ECSS CS-4337 Organization of Programming Languages

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Lecture 9. Semantic Analysis Scoping and Symbol Table

JRuby Now and Future Charles Oliver Nutter JRuby Guy Sun Microsystems

Levels of Programming Languages. Gerald Penn CSC 324

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

The Smalltalk Programming Language. Beatrice Åkerblom

General Introduction

Lecture 1 Introduction to Android

Multi-core Programming System Overview

Encoding Text with a Small Alphabet

CPU Organization and Assembly Language

Restraining Execution Environments

Cloud Computing. Up until now

1. Overview of the Java Language

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz

Virtualization. Explain how today s virtualization movement is actually a reinvention

How To Write Portable Programs In C

CSC230 Getting Starting in C. Tyler Bletsch

CSE 130 Programming Language Principles & Paradigms

White Paper. Java versus Ruby Frameworks in Practice STATE OF THE ART SOFTWARE DEVELOPMENT 1

10 Things Every Linux Programmer Should Know Linux Misconceptions in 30 Minutes

C# and Other Languages

Lesson 06: Basics of Software Development (W02D2

EMSCRIPTEN - COMPILING LLVM BITCODE TO JAVASCRIPT (?!)

Virtualization Technologies

A GENERIC PURPOSE, CROSS-PLATFORM, HIGH EXTENSIBLE VIRTUAL MACHINE. John Vlachoyiannis

Mobile web apps: The best option for business? A whitepaper from mrc

Mission-Critical Java. An Oracle White Paper Updated October 2008

What is a programming language?

Java in Education. Choosing appropriate tool for creating multimedia is the first step in multimedia design

HPC performance applications on Virtual Clusters

1 The Java Virtual Machine

Seven Things You Must Know Before Hiring a Real Estate Agent

GTask Developing asynchronous applications for multi-core efficiency

Parallels Virtuozzo Containers

ODROID Multithreading in Android

9/11/15. What is Programming? CSCI 209: Software Development. Discussion: What Is Good Software? Characteristics of Good Software?

Developing Embedded Software in Java Part 1: Technology and Architecture

VOCOLLECT VOICEARTISAN. Extending Your Vocollect Configuration

System Structures. Services Interface Structure

Clojure on Android. Challenges and Solutions. Aalto University School of Science Master s Programme in Mobile Computing Services and Security

Engineering Process Software Qualities Software Architectural Design

The Dirty Little Secret of Software Pricing

Seven Things You Must Know Before Hiring a Real Estate Agent

Full and Para Virtualization

Chapter 13: Program Development and Programming Languages

Instruction Set Architecture (ISA)

Android Operating System

Chapter 3.2 C++, Java, and Scripting Languages. The major programming languages used in game development.

High level code and machine code

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Lua as a business logic language in high load application. Ilya Martynov ilya@iponweb.net CTO at IPONWEB

Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111

Anyone remember this old banner ad? (it was for Net Nanny Pornography? On *MY* Computer? It s more likely than you think. )

The Fastest Way to Parallel Programming for Multicore, Clusters, Supercomputers and the Cloud.

The Not Quite R (NQR) Project: Explorations Using the Parrot Virtual Machine

Beyond the Polyester Veil : A Personal Injury Negotiations Case Study

The C Programming Language course syllabus associate level

VMware Virtualization and Software Development

Object Oriented Database Management System for Decision Support System.

Time Limit: X Flags: -std=gnu99 -w -O2 -fomitframe-pointer. Time Limit: X. Flags: -std=c++0x -w -O2 -fomit-frame-pointer - lm

Habanero Extreme Scale Software Research Project

Virtual Machines.

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire

The Java Virtual Machine (JVM) Pat Morin COMP 3002

Tuning Tableau and Your Database for Great Performance PRESENT ED BY

x86 ISA Modifications to support Virtual Machines

Scalable Data Analysis in R. Lee E. Edlefsen Chief Scientist UserR! 2011

Java and Real Time Storage Applications

ELEC 377. Operating Systems. Week 1 Class 3

Full Text Search with Sphinx

The Importance of Software License Server Monitoring

Performance Analysis of Android Platform

Full Potential of Dynamic Binary Translation for AV Emulation Engine

Computer Assisted Language Learning. Blogger Tutorial

Chapter 3 Operating-System Structures

Introducing DocumentDB

GDB Tutorial. A Walkthrough with Examples. CMSC Spring Last modified March 22, GDB Tutorial

Grid 101. Grid 101. Josh Hegie.

I Control Your Code Attack Vectors Through the Eyes of Software-based Fault Isolation. Mathias Payer, ETH Zurich

Introduction to Big Data! with Apache Spark" UC#BERKELEY#

Transcription:

Parrot in a Nutshell Dan Sugalski dan@sidhe.org Parrot in a nutshell 1

What is Parrot The interpreter for perl 6 A multi-language virtual machine An April Fools joke gotten out of hand Parrot in a nutshell 2

The official point of Parrot Build something to support perl 6 Build a faster perl Build a cleaner perl Parrot in a nutshell 3

The Unofficial point of Parrot Generic fast interpreter engine Annoy the Mono folks Really annoy the python people Try and take over the world Parrot in a nutshell 4

Parrot s guiding goals Speed Maintainability Longevity Extensibility Flexibility Parrot in a nutshell 5

Speed Faster is good A slow interpreter is of little use Things almost never get any faster Parrot sets the maximum speed Parrot in a nutshell 6

Maintainability Try and keep things black-box Try and enforce a coding standard Open Source projects have limited engineering resources Things rarely get more maintainable Maintenance always consumes the most resources for projects that actually finish Parrot in a nutshell 7

Longevity Software always lives on well past the point you think it should Designing for long-term expandability puts off the inevitable rewrites We re going to be looking at this code for the better part of a decade, so we d best make sure we want to look at it Parrot in a nutshell 8

Extensibility Everyone wants to add on with C Things are never quite fast enough There are lots of external libraries worth using A good extension mechanism is a great thing A bad one really hurts Parrot in a nutshell 9

Flexibility General solutions have more long-term potential than specific ones People always do things you don t expect If you plan for it now, it doesn t cost more later Even if it costs a little more now Parrot in a nutshell 10

Multi-language capabilities Support perl Support Dynamic Languages in general Nice target for language designers Parrot in a nutshell 11

Support perl Perl 6 was the reason this all started Perl has the most complex semantics of all the dynamic languages in common use Perl is a major pain to implement, as languages go Parrot in a nutshell 12

Support Dynamic Languages in general Includes Ruby and Python, for example Languages that have some compile-time uncertainty Actually trivial, just a matter of thinking about it Parrot in a nutshell 13

Nice Target If we express all the semantics, it makes it easier for language designers Many now target C, or GCC Impedance mismatch lower for many languages Parrot in a nutshell 14

Play Zork natively Yep, that s right parrot -b:zmachine zork.dat Doing this right is harder than doing Java, Python, or.net bytecode If we can do this, we can do anyone s bytecode Plus it s really cool Parrot in a nutshell 15

Interpreter basics Chunk of software that executes other software A CPU in software Generally flexible Generally slow Easy to write for Easy to write Portable Parrot in a nutshell 16

CPU in software It s the V in VM The compiler writer can treat the interpreter as a form of CPU chip Allows much easier customization of core behavior Sometimes software does become hardware But often it shouldn t Parrot in a nutshell 17

Generally flexible Since the core functionality is in software, it s changeable Software generally has fewer limits to it than hardware It s easier to think about software than hardware, so more people can Incremental cost of changes much lower Parrot in a nutshell 18

Generally slow It s a layer of indirection between the user s program and the hardware that executes it It s very easy to have impedance mismatch problems It s also very easy to let speed dribble away Parrot in a nutshell 19

Easy to write for It s easy to gloss over the tough parts The interpreter should express itself in ways that are easy to use You built it as the target, so if it isn t, you ve done something wrong Parrot in a nutshell 20

Easy to write Interpreters are pure semantics, and semantics aren t that difficult to express Though defining the semantics can take much longer A simple interpreter can be put together in a week (Though parrot is far from simple) Just a SMOP, even for the fancy ones Parrot in a nutshell 21

Portable Generally the expressed semantics are mostly platform-neutral Means the platform-specific stuff can be isolated Platform specific but unimplemented things can be emulated Normally just a small cluster of really nasty code to deal with Parrot in a nutshell 22

Core Parrot Concepts Register based Language Neutral Very high level Introspective Mutable Threaded With continuations Parrot in a nutshell 23

Register Based 32 each Integer, String, Float, and PMC Registers are a kind of named temporary slot for the interpreter Modeled on hardware CPUs Generally more efficient than a pure stackbased model Parrot in a nutshell 24

Language Neutral In the human sense We don t force ASCII, Unicode, Latin-1, or EBCDIC on the user The engine has facilities to deal with data regardless of its encoding Important when dealing with nativelanguage text, which is most text Parrot in a nutshell 25

Very high level Threads, closures, continuations, aggregate operations, multimethod dispatch all core elements Don t relegate the hard stuff to libraries Easier on compiler writers Bit more of a pain for the interpreter implementers Parrot in a nutshell 26

Introspective Code can inspect the current state of the interpreter Most, if not all, the core data structures are accessible Includes stack entries, symbol tables, lexical variables Also variable arenas, memory pools, and interpreter statistics Parrot in a nutshell 27

Mutable Code can be created on the fly Libraries can be dynamically loaded Opcodes can be redefined on the fly Base variable methods can be overridden at runtime Parrot in a nutshell 28

Threaded Threads are a core element of Parrot Threading interpreters is an interesting task For nasty values of interesting They must be designed in from the start Parrot in a nutshell 29

With Continuations Really odd Lisp thing Sort of like a closure for control flow For reference, exceptions are a simplified kind of continuation They will rot your brain If your brain s already gone, though, they let you do some Terribly Clever Things Parrot in a nutshell 30

Quick benchmark numbers Simple MOPS benchmark Ruby 1.6.6: 207 Sec Perl 5.6.0: 165 Sec Python 2.2: 136 Sec Parrot: 18.75 Sec Parrot (faster): 9 Sec Parrot (fastest): 4.9 Sec Parrot in a nutshell 31

Fetching Parrot http://dev.perl.org Anon CVS :pserver:anonymous@cvs.perl.org:/cvs/public http://www.parrotcode.org Parrot in a nutshell 32