1 / 19

The heavyweight parts of lightweight languages

Explore modern approaches to lightweight languages, focusing on dynamic behavior changes, rich type systems, safe execution techniques, and Parrot's design for Perl 6 and other languages. Discuss the balance between native and complex data types, the role of interpreters in simplifying programming concepts, and the future of extendability and embeddability in language design. Join us to delve into the nuances of language-specific features, portable development environments, and high-level I/O models in the fast-paced LL1 Workshop.

lynwood
Download Presentation

The heavyweight parts of lightweight languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The heavyweight parts of lightweight languages LL1 Workshop November 17, 2001

  2. The generic bits What the heavy lifting is

  3. Resource Management • Proper destruction of dead objects • Memory collection and management • OS ‘object’ management (threads, files, signals, and suchlike things) LL1 Workshop

  4. OS independence • The whole world isn’t uniform • Provides an abstract interface to OS • Allows transparent emulation of features not easily available • Frees the programmer from having to worry about the grotty details LL1 Workshop

  5. Rich type systems • Interpreter’s job to make complex data types behave like simple ones • Easy extendibility requires a lot of work under the hood • Makes non-traditional types easier for the programmer LL1 Workshop

  6. Dynamic behaviour changes • Dynamic recompilation • Dynamic type behaviour changes • Makes classic optimizations somewhat difficult LL1 Workshop

  7. High-level programming concept support • Closures • Continuations • Curried functions • Runtime class and method autogeneration • Matrix operations LL1 Workshop

  8. Safe execution • Resource quotas • External access restrictions • Paranoid runtime control-flow checking • Static checking possible, but very restrictive LL1 Workshop

  9. The Parrot bits How we’re doing the heavy lifting for Perl 6. (And Python, Ruby, and Scheme, though they don’t know it yet…)

  10. Parrot’s design goals • Run perl code fast • Portable • Clean up the grotty bits • A good base for perl’s language features • Longevity of core design • Multi-language capable LL1 Workshop

  11. We assume modern hardware • Good-sized L1 & L2 caches • Main memory access expensive • Unpredictable branches expensive • A reasonable number of CPU registers • Lots of RAM handy LL1 Workshop

  12. Parrot’s a register machine • Reduces memory load/stores • Reduces by-name lookups of variables • Translates well to modern hardware • Avoids a lot of the common stack twiddling time wasters • Can be treated as a large named temp cache for the register-phobic LL1 Workshop

  13. Simple and complex types native • Native int, native float, strings, and PMCs • PMCs are ‘everything else’ • Support for arbitrary-precision numbers • Interface abstract to make adding new types easy • Simple types basically builtin shortcuts for the optimizer LL1 Workshop

  14. Split DOD & GC • We check for dead objects and collect memory in separate phases • Memory tends to get chewed up faster than objects die • Most objects don’t need to do anything when they die LL1 Workshop

  15. Easy extendability and embeddability • Stable binary API • Clean interface for extenders • Simple and small interface for embedders • Internal details hidden • Embedders have control over the interpreter’s environment (I/O & %ENV) LL1 Workshop

  16. Portable • Perl 5 runs (or has run) on 70+ platforms • Support for many Unices, Win32, VMS, and Mac • Everyone’s got something broken about them • Not shooting for lowest common denominator LL1 Workshop

  17. High-level I/O model • Async I/O everywhere • Bulk read support • Byte, line, and record access supported where appropriate • All I/O can be run through filters • Finally dump C’s stdio LL1 Workshop

  18. Language-specific features are generally abstract • We don’t mandate variable types or behaviours • We don’t mandate method dispatch • Generic fallbacks provided • Lets us punt on the design and put it off for later LL1 Workshop

  19. Sort of OO under the hood • OO (of sorts--it’s still in C) where appropriate • The whole world’s not OO • Neither are any CPUs to speak of • OO support semi-abstract • We use it as an abstraction layer LL1 Workshop

More Related