SlideShare a Scribd company logo
1 of 41
Download to read offline
PyPy: Dynamic Language
     Compilation Framework



Jim Huang ( 黃敬群 ) <jserv@0xlab.org>
Developer, 0xlab
                                      June 18, 2012
Rights to copy
                                                                    © Copyright 2012 0xlab
                                                                           http://0xlab.org/
                                                                            contact@0xlab.org
Attribution – ShareAlike 3.0
                                                Corrections, suggestions, contributions and translations
You are free                                                                              are welcome!
   to copy, distribute, display, and perform the work
   to make derivative works                                               Latest update: June 18, 2012
   to make commercial use of the work
Under the following conditions
      Attribution. You must give the original author credit.
      Share Alike. If you alter, transform, or build upon this work, you may distribute the
      resulting work only under a license identical to this one.
   For any reuse or distribution, you must make clear to others the license terms of this work.
   Any of these conditions can be waived if you get permission from the copyright holder.
Your fair use and other rights are in no way affected by the above.
License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode
Agenda   (1) Interpreters and Compilers
         (2) PyPy components
         (3) Translation Toolchain
A compiler was originally a program that
“compiled” subroutines [a link-loader]. When in
1954 the combination “algebraic compiler”
came into use, or rather into misuse, the
meaning of the term had already shifted into
the present one.
                    — Bauer and Eickel [1975]
Compiler / Interpreter




Source: Compiler Construction, Prof. O. Nierstrasz
Source: Compiler Construction, Prof. O. Nierstrasz
Traditional 2 pass compiler
•   intermediate representation (IR)
•   front end maps legal code into IR
•   back end maps IR onto target machine
•   simplify retargeting
•   allows multiple front ends
•   multiple passes → better code
Traditional 3 pass compiler
• analyzes and changes IR
• goal is to reduce runtime
• must preserve values
Optimizer: middle end
•   constant propagation and folding
•   code motion
•   reduction of operator strength
•   common sub-expression elimination
•   redundant store elimination
•   dead code elimination
Modern optimizers are usually built as a set of passes
Optimization Challenges
• Preserve language semantics
   • Reflection, Introspection, Eval
   • External APIs
• Interpreter consists of short sequences of code
   • Prevent global optimizations
   • Typically implemented as a stack machine
• Dynamic, imprecise type information
   • Variables can change type
   • Duck Typing: method works with any object that provides
     accessed interfaces
   • Monkey Patching: add members to “class” after initialization
• Memory management and concurrency
• Function calls through packing of operands in fat object
Python Compilers
• Jython: “Python over the JVM”; written in Java
   • Similar approaches: JRuby, Rhino, …
• IronPython: “Python over CLR/DLR”; written in C#
   • Open source effort led by Microsoft, Apache License
• Unladen Swallow compiler: “Extend the standard
  CPython interpreter with the LLVM JIT”
  • Open source effort led by Google,
  • Similar approaches: Rubinius, …
• PyPy: “Python on Python”
   • Open source effort (evolution of Psycho)
   • Tracing JIT; PYPY VM/JIT can target other languages
Python benchmark
                                                                                                                                              (IBM Research, 2010)
                                         5.00
Execution Time Relative to CPython 2.6




                                         4.00




                                         3.00
                                                                                                                                                                                   2.57



                                         2.00                                                                                                                                   1.87
                                                                                                                                                                                  1.66


                                                                                                                                                                                         1.04
                                                                                                                                                                                           0.95
                                         1.00
                                                                                                                                                                                     0.69




                                         0.00
                                                binarytrees-2   fasta-2   knucleotide    mandelbrot        nbody-4        pidigits    regexdna     revcomp-3     spectralnorm     geomean

                                                                   Jython/OpenJDK 6     Jython/HotSpot 7    Jython/TR 6     US (SVN 07/10)   PyPy (Jit)   IronPython (64)
Memory Consumption:                                                                          important for Parallelism
                                                                                                                  (IBM Research, 2010)
              800

              700

              600

              500
Memory (MB)




              400                                                                                                                                  370.08
                                                                                                                                                  309.97
              300

              200                                                                                                                                      156.97

              100                                                                                                                                       52.49
                                                                                                                                                15.03 32.86
                 0
                                                                    t




                                                                                                                          3
                                                                                                          na




                                                                                                                                                    n
                        -2




                                     2




                                                                                                                                        rm
                                                   e




                                                                                          its
                                                                 ro




                                                                                                                        p-




                                                                                                                                                  ea
                                  a-




                                                 id




                                                                               4
                      es




                                                                                                        xd
                                                              lb




                                                                                            g




                                                                                                                                      no
                                                                             y-




                                                                                                                        om
                                              ot
                               st




                                                                                                                                                  om
                                                                                         di
                                                            de
                      tre




                                                                                                      ge
                                                                           od
                             fa




                                                                                                                                        l
                                              le




                                                                                      pi




                                                                                                                                    tra
                                                                                                                     vc




                                                                                                                                               ge
                                                          an
                                           uc
                    ry




                                                                                                   re
                                                                        nb




                                                                                                                                 ec
                                                                                                                  re
                 na




                                         kn




                                                         m




                                                                                                                               sp
              bi




                                         Cpython       Jython/OpenJDK      Jython/HotSpot 7     Jython/TR      US (SVN 7/10)      PyPy (jit)
“It's possible to take an interpreter and
transform it into a compiler”

      — Yoshihiko Futamura (1971). "Partial Evaluation of
       Computation Process – An Approach to a Compiler-
                                              Compiler"
What is PyPy?
• Reimplementation of Python in Python
• Framework for building interpreters and
  virtual machines with Restricted Python
• L * O * P configurations
   • L : dynamic languages
   • O : optimizations
   • P : platforms
                      $> python py.py


                      $> ./pypy-c
                      $> ./pypy-jvm
                      $> ./pypy-cli
PyPy
• founded in 2003 by Holger Krekel and
  Armin Rigo
• 2004 - 2007 EU Project - Sixth Framework
• Open Source Project since 2007
• occasional Funding by Google
• Sprint-Driven Development
PyPy
• common use scenario is to translate the PyPy
  RPython code to a backend
  • C (and then standalone binary), CLI (.Net), JVM
• PyPy component
  • A Python interpreter with the ability to collects traces
  • A tracing JIT, derived from RPython
      • Tracing of loops in the user level programs, but
        recording exact operations executed inside the
        interpreter
  • Well defined points to enter and exit traces, and state
    that can be safely modified inside the trace
PyPy Architecture
PyPy Functional Architecture
PyPy Abilities
• Use techniques similar to prototype
  languages (V8) to infer offsets of instance
  attributes
• Garbage collected
• Can interface with (most) standard CPython
  modules
   • Creates PyObject proxies to internal
     PyPy objects
• Limited concurrency because of GIL
PyPy Traces
[2bcbab384d062] {jit-log-noopt-loop
[p0, p1, p2, p3, p4, p5, p6, p7, p8]
debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #24 JUMP_IF_FALSE')
debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #27 POP_TOP')
debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #28 LOAD_FAST')
guard_nonnull(p8, descr=<ResumeGuardDescr object at 0xf6c4cd7c>)
debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #31 LOAD_FAST')
guard_nonnull(p7, descr=<ResumeGuardDescr object at 0xf6c4ce0c>)
debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #34 BINARY_ADD')
guard_class(p8, ConstClass(W_IntObject), descr=<ResumeGuardDescr object at 0xf6c4ce9c>)

guard_class(p7, ConstClass(W_IntObject), descr=<ResumeGuardDescr object at 0xf6c4cf08>)

guard_class(p8, ConstClass(W_IntObject), descr=<ResumeGuardDescr object at 0xf6c4cf74>)

guard_class(p7, ConstClass(W_IntObject), descr=<ResumeGuardDescr object at 0xf6c4cfe0>)

i13 = getfield_gc_pure(p8, descr=<SignedFieldDescr 8>)
i14 = getfield_gc_pure(p7, descr=<SignedFieldDescr 8>)
i15 = int_add_ovf(i13, i14)
guard_no_overflow(, descr=<ResumeGuardDescr object at 0xf6c4d0c8>)
p17 = new_with_vtable(ConstClass(W_IntObject))
setfield_gc(p17, i15, descr=<SignedFieldDescr 8>)
debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #35 STORE_FAST')
…
[2bcbab3877419] jit-log-noopt-loop}
RPython
• RPython = Restricted/Reduced Python
   • Restricted = most possible static subset
     of Python  
• required to perform Type Inference 
• input to the Translation Framework
• no real specification - just some hints
• used for writing interpreters
• can be used for writing extensions as well
PyPy Interpreter
    • written in Rpython
    • Stack-based bytecode interpreter      (like JVM)
       • bytecode compiler → generates bytecode
       • bytecode evaluator → interprets bytecode 
       • object space → handles operations on objects


def f(x):           >>> dis.dis(f)
   return x + 1     2      0 LOAD_FAST         0 (x)
                           3 LOAD_CONST        1 (1)
                           6 BINARY_ADD
                                                         22
                           7 RETURN_VALUE
PyPy Bytecode Interpreter




                        23
PyPy Interpreter Internals
Program
        Py



Compiler




Bytecode
              API




 Bytecode             Object
interpreter           space


                                      24
PyPy Interpreter Internals
Program
        Py



Compiler




Bytecode
              API            API




                    Proxy
 Bytecode                          Object
                    Object
interpreter                        space
                    space
PyPy Translation Toolchain
• Model-driven interpreter (VM) development
  • Focus on language model rather than
    implementation details
  • Executable models (meta-circular Python)
• Translate models to low-level (LL) back-
  ends
  • Considerably lower than Python
  • Weave in implementation details (GC, JIT)
  • Allow compilation to different back-ends (OO,
    procedural)


                                                    26
PyPy Translation Toolchain




                         27
                              27
Compiler

                                  Low
                Flow
                                 level
 Bytecode
interpreter    object             flow
               space             graph


     Flow analysis
                                    RTyper




                                   Type
        Flow            Anno-    annotated
        graph
                        tation      flow
                                   graph
Low
  Code                                              JIT
generation                   level               generation
                              flow
                             graph
POSI                                                     POSI
  X                                                         X
JVM          Garbage                                     (JVM)
 CLI                                                      (CLI)
 ...         collector                                     ...




                             PyPy interpreter
                             with Just In Time
                              Optimizations




                         X
Translation Framework




      Garbage collection
      Garbage collection

          Stackless
          Stackless

             JIT
             JIT


                           30
                                30
31
CFG (Call Flow Graph)
• Consists of Blocks and
  Links
• Starting from entry_point
• “Single Static Information”
  form

def f(n):
    return 3 * n + 2



Block(v1): # input argument
  v2 = mul(Constant(3), v1)
  v3 = add(v2, Constant(2))
CFG: Static Single Information

• SSI: “PHIs” for all used variables
• Blocks as “functions without branches”


    def test(a):
       if a > 0:
          if a > 5:
            return 10
          return 4
       if a < - 10:
          return 3
       return 10


                                           33
                                                33
• Python is dynamically typed                Type Inference
• Translate to statically typed code for efficiency reasons
• Which to be inferred?
                                               Type Inference
   • Type for every variable
   • Messages sent to an object must
     be defined in the compile-time
     type or a supertype
• How to infer types
   • Starting from entry_point
       • reach the whole program
       • type of arguments and return-
         value are known
   • Forward propagation
       • Iteratively, until all links in the
         CFG have been followed at
         least once
       • Results in a large dictionary
                                                           35
         mapping variables to types
Type inference restricts
     • RRython is the subset of Python, which is type
       inferable
     • Actually: type inferable stabilized bytecode
        • Allows load-time meta-programming
        • Messages sent to an object must be defined in the
          compile-time type or supertype
                              @objectmodel.specialize.argtype(0)
def plus(a, b):               def plus(a, b):
   return a + b                  return a + b

def entry_point(arv=None):    def entry_point(arv=None):
   print plus(20, 22)            print plus(20, 22)
   print plus(“4”, “2”)          print plus(“4”, “2”)
PyPy Advantages
• High Level Language Implementation
  • to implement new features: lazily computed objects
    and functions, plug-able  garbage-collection, runtime
    replacement of live-objects, stackless concurrency 
• JIT Generation
• Object space
• Stackless
  • infinite Recursion
  • Microthreads: Coroutines, Tasklets and Channels,
    Greenlets
Object Spaces in PyPy
•   Flow ObjSpace
•   Thunk ObjSpace
•   Taint ObjSpace
•   Dump ObjSpace
•   Transparent Proxies
Object Spaces in PyPy
• Thunk ObjSpace                                >>>> a = "hello"
                                                >>>> b = "world"
  lazily computed objects 
                                                >>>> a + b
  lazily computed functions                     'helloworld'
  globally replaceable objects                  >>>> become(a,b)
                                                >>>> a + b
                                                'worldworld'
• Taint ObjSpace
   • provides protection for:
     sensitive data that should not leak
   • provides protection from:        >>>> password   = "secret"
   • Untrusted data that needs to be >>>> password
                                      'secret'
     validated                        >>>> password   = taint("secret")
                                     >>>> password
                                     Traceback (application-level):
                                       File "<inline>", line 1 in
                                     <interactive>
                                         password
                                     TaintError
Reference
• PyPy Internals:
  http://codespeak.net/pypy/dist/pypy/doc/
• “Compiler Construction”, Prof. O. Nierstrasz, Fall
  Semester 2008
• “The PyPy translation tool chain”, Toon Verwaest
• “Compilers are from Mars, Dynamic Scripting
  Languages are from Venus, Jose Castanos”, David
  Edelsohn, Kazuaki Ishizaki, Priya Nagpurkar, Takeshi
  Ogasawara, Akihiko Tozawa, Peng Wu (2010)




                                                     40
http://0xlab.org

More Related Content

What's hot

AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019Kenneth Ceyer
 
[PHP 也有 Day #64] PHP 升級指南
[PHP 也有 Day #64] PHP 升級指南[PHP 也有 Day #64] PHP 升級指南
[PHP 也有 Day #64] PHP 升級指南Shengyou Fan
 
Introduce to Rust-A Powerful System Language
Introduce to Rust-A Powerful System LanguageIntroduce to Rust-A Powerful System Language
Introduce to Rust-A Powerful System Language安齊 劉
 
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Orange Tsai
 
JIT のコードを読んでみた
JIT のコードを読んでみたJIT のコードを読んでみた
JIT のコードを読んでみたy-uti
 
MySQLデータ暗号化と暗号鍵のローテーション
MySQLデータ暗号化と暗号鍵のローテーションMySQLデータ暗号化と暗号鍵のローテーション
MySQLデータ暗号化と暗号鍵のローテーションShinya Sugiyama
 
系統程式 -- 第 6 章 巨集處理器
系統程式 -- 第 6 章 巨集處理器系統程式 -- 第 6 章 巨集處理器
系統程式 -- 第 6 章 巨集處理器鍾誠 陳鍾誠
 
Node-v0.12の新機能について
Node-v0.12の新機能についてNode-v0.12の新機能について
Node-v0.12の新機能についてshigeki_ohtsu
 
PHP para Adultos: Clean Code e Object Calisthenics
PHP para Adultos: Clean Code e Object CalisthenicsPHP para Adultos: Clean Code e Object Calisthenics
PHP para Adultos: Clean Code e Object CalisthenicsGuilherme Blanco
 
Redmine本家コピー+投票サイト作成(Python-Redmine利用事例)
Redmine本家コピー+投票サイト作成(Python-Redmine利用事例)Redmine本家コピー+投票サイト作成(Python-Redmine利用事例)
Redmine本家コピー+投票サイト作成(Python-Redmine利用事例)Yuuki Nara
 
SystemC Tutorial
SystemC TutorialSystemC Tutorial
SystemC Tutorialkocha2012
 
PHP でも活用できる Makefile
PHP でも活用できる MakefilePHP でも活用できる Makefile
PHP でも活用できる MakefileShohei Okada
 
x86とコンテキストスイッチ
x86とコンテキストスイッチx86とコンテキストスイッチ
x86とコンテキストスイッチMasami Ichikawa
 
Cómo explotar EternalBlue en Windows Server 2012 R2
Cómo explotar EternalBlue en Windows Server 2012 R2Cómo explotar EternalBlue en Windows Server 2012 R2
Cómo explotar EternalBlue en Windows Server 2012 R2Telefónica
 
Lab3 advanced port scanning 30 oct 21
Lab3 advanced port scanning 30 oct 21Lab3 advanced port scanning 30 oct 21
Lab3 advanced port scanning 30 oct 21Hussain111321
 
Composer 從入門到實戰
Composer 從入門到實戰Composer 從入門到實戰
Composer 從入門到實戰Shengyou Fan
 
PHPでマルチスレッド
PHPでマルチスレッドPHPでマルチスレッド
PHPでマルチスレッドkarky7
 
PHPUnit 入門介紹
PHPUnit 入門介紹PHPUnit 入門介紹
PHPUnit 入門介紹Jace Ju
 

What's hot (20)

AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
AI 연구자를 위한 클린코드 - GDG DevFest Seoul 2019
 
[PHP 也有 Day #64] PHP 升級指南
[PHP 也有 Day #64] PHP 升級指南[PHP 也有 Day #64] PHP 升級指南
[PHP 也有 Day #64] PHP 升級指南
 
Introduce to Rust-A Powerful System Language
Introduce to Rust-A Powerful System LanguageIntroduce to Rust-A Powerful System Language
Introduce to Rust-A Powerful System Language
 
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧
 
JIT のコードを読んでみた
JIT のコードを読んでみたJIT のコードを読んでみた
JIT のコードを読んでみた
 
MySQLデータ暗号化と暗号鍵のローテーション
MySQLデータ暗号化と暗号鍵のローテーションMySQLデータ暗号化と暗号鍵のローテーション
MySQLデータ暗号化と暗号鍵のローテーション
 
系統程式 -- 第 6 章 巨集處理器
系統程式 -- 第 6 章 巨集處理器系統程式 -- 第 6 章 巨集處理器
系統程式 -- 第 6 章 巨集處理器
 
Node-v0.12の新機能について
Node-v0.12の新機能についてNode-v0.12の新機能について
Node-v0.12の新機能について
 
PHP para Adultos: Clean Code e Object Calisthenics
PHP para Adultos: Clean Code e Object CalisthenicsPHP para Adultos: Clean Code e Object Calisthenics
PHP para Adultos: Clean Code e Object Calisthenics
 
Redmine本家コピー+投票サイト作成(Python-Redmine利用事例)
Redmine本家コピー+投票サイト作成(Python-Redmine利用事例)Redmine本家コピー+投票サイト作成(Python-Redmine利用事例)
Redmine本家コピー+投票サイト作成(Python-Redmine利用事例)
 
SystemC Tutorial
SystemC TutorialSystemC Tutorial
SystemC Tutorial
 
PHP でも活用できる Makefile
PHP でも活用できる MakefilePHP でも活用できる Makefile
PHP でも活用できる Makefile
 
x86とコンテキストスイッチ
x86とコンテキストスイッチx86とコンテキストスイッチ
x86とコンテキストスイッチ
 
PHPにおけるI/O多重化とyield
PHPにおけるI/O多重化とyieldPHPにおけるI/O多重化とyield
PHPにおけるI/O多重化とyield
 
Cómo explotar EternalBlue en Windows Server 2012 R2
Cómo explotar EternalBlue en Windows Server 2012 R2Cómo explotar EternalBlue en Windows Server 2012 R2
Cómo explotar EternalBlue en Windows Server 2012 R2
 
Lab3 advanced port scanning 30 oct 21
Lab3 advanced port scanning 30 oct 21Lab3 advanced port scanning 30 oct 21
Lab3 advanced port scanning 30 oct 21
 
Composer 從入門到實戰
Composer 從入門到實戰Composer 從入門到實戰
Composer 從入門到實戰
 
PHPでマルチスレッド
PHPでマルチスレッドPHPでマルチスレッド
PHPでマルチスレッド
 
PHP版レガシーコード改善に役立つ新パターン #wewlc_jp
PHP版レガシーコード改善に役立つ新パターン #wewlc_jp PHP版レガシーコード改善に役立つ新パターン #wewlc_jp
PHP版レガシーコード改善に役立つ新パターン #wewlc_jp
 
PHPUnit 入門介紹
PHPUnit 入門介紹PHPUnit 入門介紹
PHPUnit 入門介紹
 

Viewers also liked

PyPy - is it ready for production
PyPy - is it ready for productionPyPy - is it ready for production
PyPy - is it ready for productionMark Rees
 
a quick Introduction to PyPy
a quick Introduction to PyPya quick Introduction to PyPy
a quick Introduction to PyPyKai Aras
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsNational Cheng Kung University
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationNational Cheng Kung University
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsNational Cheng Kung University
 
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsF9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsNational Cheng Kung University
 
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例National Cheng Kung University
 

Viewers also liked (20)

Revise the Historical Development about C/UNIX
Revise the Historical Development about C/UNIXRevise the Historical Development about C/UNIX
Revise the Historical Development about C/UNIX
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
PyPy - is it ready for production
PyPy - is it ready for productionPyPy - is it ready for production
PyPy - is it ready for production
 
a quick Introduction to PyPy
a quick Introduction to PyPya quick Introduction to PyPy
a quick Introduction to PyPy
 
Shorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation SystemsShorten Device Boot Time for Automotive IVI and Navigation Systems
Shorten Device Boot Time for Automotive IVI and Navigation Systems
 
Hints for L4 Microkernel
Hints for L4 MicrokernelHints for L4 Microkernel
Hints for L4 Microkernel
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and Implementation
 
Implement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVMImplement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVM
 
olibc: Another C Library optimized for Embedded Linux
olibc: Another C Library optimized for Embedded Linuxolibc: Another C Library optimized for Embedded Linux
olibc: Another C Library optimized for Embedded Linux
 
L4 Microkernel :: Design Overview
L4 Microkernel :: Design OverviewL4 Microkernel :: Design Overview
L4 Microkernel :: Design Overview
 
Construct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoTConstruct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoT
 
Embedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile DevicesEmbedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile Devices
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM Boards
 
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsF9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
 
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
The Internals of "Hello World" Program
The Internals of "Hello World" ProgramThe Internals of "Hello World" Program
The Internals of "Hello World" Program
 
Priority Inversion on Mars
Priority Inversion on MarsPriority Inversion on Mars
Priority Inversion on Mars
 
Microkernel Evolution
Microkernel EvolutionMicrokernel Evolution
Microkernel Evolution
 
Plan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIXPlan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIX
 

Similar to PyPy: Dynamic Language Compilation Framework

Objective Determination Of Minimum Engine Mapping Requirements For Optimal SI...
Objective Determination Of Minimum Engine Mapping Requirements For Optimal SI...Objective Determination Of Minimum Engine Mapping Requirements For Optimal SI...
Objective Determination Of Minimum Engine Mapping Requirements For Optimal SI...pmaloney1
 
5 APM and Capacity Planning Imperatives for a Virtualized World
5 APM and Capacity Planning Imperatives for a Virtualized World5 APM and Capacity Planning Imperatives for a Virtualized World
5 APM and Capacity Planning Imperatives for a Virtualized WorldCorrelsense
 
MapReduce Debates and Schema-Free
MapReduce Debates and Schema-FreeMapReduce Debates and Schema-Free
MapReduce Debates and Schema-Freehybrid cloud
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1myrajendra
 
Framework and Application Benchmarking
Framework and Application BenchmarkingFramework and Application Benchmarking
Framework and Application BenchmarkingPaul Jones
 
Integrating R with the CDK: Enhanced Chemical Data Mining
Integrating R with the CDK: Enhanced Chemical Data MiningIntegrating R with the CDK: Enhanced Chemical Data Mining
Integrating R with the CDK: Enhanced Chemical Data MiningRajarshi Guha
 
Agile Workshop: Agile Metrics
Agile Workshop: Agile MetricsAgile Workshop: Agile Metrics
Agile Workshop: Agile MetricsSiddhi
 
Why we don’t know how many colors there are
Why we don’t know how many colors there areWhy we don’t know how many colors there are
Why we don’t know how many colors there areJan Morovic
 
Build Community Android Distribution and Ensure the Quality
Build Community Android Distribution and Ensure the QualityBuild Community Android Distribution and Ensure the Quality
Build Community Android Distribution and Ensure the QualityNational Cheng Kung University
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 
End-to-End Deep Learning Deployment with ONNX
End-to-End Deep Learning Deployment with ONNXEnd-to-End Deep Learning Deployment with ONNX
End-to-End Deep Learning Deployment with ONNXNick Pentreath
 
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4jRobotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4jKevin Watters
 
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...Lucidworks
 
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...TelecomValley
 
Hulett david
Hulett davidHulett david
Hulett davidNASAPMC
 
Cocomo ii estimation
Cocomo ii estimationCocomo ii estimation
Cocomo ii estimationjujin1810
 

Similar to PyPy: Dynamic Language Compilation Framework (20)

Objective Determination Of Minimum Engine Mapping Requirements For Optimal SI...
Objective Determination Of Minimum Engine Mapping Requirements For Optimal SI...Objective Determination Of Minimum Engine Mapping Requirements For Optimal SI...
Objective Determination Of Minimum Engine Mapping Requirements For Optimal SI...
 
5 APM and Capacity Planning Imperatives for a Virtualized World
5 APM and Capacity Planning Imperatives for a Virtualized World5 APM and Capacity Planning Imperatives for a Virtualized World
5 APM and Capacity Planning Imperatives for a Virtualized World
 
DCT_TR802
DCT_TR802DCT_TR802
DCT_TR802
 
DCT_TR802
DCT_TR802DCT_TR802
DCT_TR802
 
DCT_TR802
DCT_TR802DCT_TR802
DCT_TR802
 
MapReduce Debates and Schema-Free
MapReduce Debates and Schema-FreeMapReduce Debates and Schema-Free
MapReduce Debates and Schema-Free
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Framework and Application Benchmarking
Framework and Application BenchmarkingFramework and Application Benchmarking
Framework and Application Benchmarking
 
Integrating R with the CDK: Enhanced Chemical Data Mining
Integrating R with the CDK: Enhanced Chemical Data MiningIntegrating R with the CDK: Enhanced Chemical Data Mining
Integrating R with the CDK: Enhanced Chemical Data Mining
 
Agile Workshop: Agile Metrics
Agile Workshop: Agile MetricsAgile Workshop: Agile Metrics
Agile Workshop: Agile Metrics
 
Why we don’t know how many colors there are
Why we don’t know how many colors there areWhy we don’t know how many colors there are
Why we don’t know how many colors there are
 
Build Community Android Distribution and Ensure the Quality
Build Community Android Distribution and Ensure the QualityBuild Community Android Distribution and Ensure the Quality
Build Community Android Distribution and Ensure the Quality
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
End-to-End Deep Learning Deployment with ONNX
End-to-End Deep Learning Deployment with ONNXEnd-to-End Deep Learning Deployment with ONNX
End-to-End Deep Learning Deployment with ONNX
 
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4jRobotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
 
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
 
Raptor 2
Raptor 2Raptor 2
Raptor 2
 
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...
 
Hulett david
Hulett davidHulett david
Hulett david
 
Cocomo ii estimation
Cocomo ii estimationCocomo ii estimation
Cocomo ii estimation
 

More from National Cheng Kung University

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimeNational Cheng Kung University
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明National Cheng Kung University
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明National Cheng Kung University
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明National Cheng Kung University
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學National Cheng Kung University
 
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明National Cheng Kung University
 

More from National Cheng Kung University (17)

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
 
2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
 
How A Compiler Works: GNU Toolchain
How A Compiler Works: GNU ToolchainHow A Compiler Works: GNU Toolchain
How A Compiler Works: GNU Toolchain
 
Virtual Machine Constructions for Dummies
Virtual Machine Constructions for DummiesVirtual Machine Constructions for Dummies
Virtual Machine Constructions for Dummies
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
 
從線上售票看作業系統設計議題
從線上售票看作業系統設計議題從線上售票看作業系統設計議題
從線上售票看作業系統設計議題
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
 
Open Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to EcosystemOpen Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to Ecosystem
 
Summer Project: Microkernel (2013)
Summer Project: Microkernel (2013)Summer Project: Microkernel (2013)
Summer Project: Microkernel (2013)
 
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
進階嵌入式系統開發與實作 (2013 秋季班 ) 課程說明
 
Faults inside System Software
Faults inside System SoftwareFaults inside System Software
Faults inside System Software
 
Develop Your Own Operating System
Develop Your Own Operating SystemDevelop Your Own Operating System
Develop Your Own Operating System
 

Recently uploaded

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Recently uploaded (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 

PyPy: Dynamic Language Compilation Framework

  • 1. PyPy: Dynamic Language Compilation Framework Jim Huang ( 黃敬群 ) <jserv@0xlab.org> Developer, 0xlab June 18, 2012
  • 2. Rights to copy © Copyright 2012 0xlab http://0xlab.org/ contact@0xlab.org Attribution – ShareAlike 3.0 Corrections, suggestions, contributions and translations You are free are welcome! to copy, distribute, display, and perform the work to make derivative works Latest update: June 18, 2012 to make commercial use of the work Under the following conditions Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode
  • 3. Agenda (1) Interpreters and Compilers (2) PyPy components (3) Translation Toolchain
  • 4. A compiler was originally a program that “compiled” subroutines [a link-loader]. When in 1954 the combination “algebraic compiler” came into use, or rather into misuse, the meaning of the term had already shifted into the present one. — Bauer and Eickel [1975]
  • 5. Compiler / Interpreter Source: Compiler Construction, Prof. O. Nierstrasz Source: Compiler Construction, Prof. O. Nierstrasz
  • 6. Traditional 2 pass compiler • intermediate representation (IR) • front end maps legal code into IR • back end maps IR onto target machine • simplify retargeting • allows multiple front ends • multiple passes → better code
  • 7. Traditional 3 pass compiler • analyzes and changes IR • goal is to reduce runtime • must preserve values
  • 8. Optimizer: middle end • constant propagation and folding • code motion • reduction of operator strength • common sub-expression elimination • redundant store elimination • dead code elimination Modern optimizers are usually built as a set of passes
  • 9. Optimization Challenges • Preserve language semantics • Reflection, Introspection, Eval • External APIs • Interpreter consists of short sequences of code • Prevent global optimizations • Typically implemented as a stack machine • Dynamic, imprecise type information • Variables can change type • Duck Typing: method works with any object that provides accessed interfaces • Monkey Patching: add members to “class” after initialization • Memory management and concurrency • Function calls through packing of operands in fat object
  • 10. Python Compilers • Jython: “Python over the JVM”; written in Java • Similar approaches: JRuby, Rhino, … • IronPython: “Python over CLR/DLR”; written in C# • Open source effort led by Microsoft, Apache License • Unladen Swallow compiler: “Extend the standard CPython interpreter with the LLVM JIT” • Open source effort led by Google, • Similar approaches: Rubinius, … • PyPy: “Python on Python” • Open source effort (evolution of Psycho) • Tracing JIT; PYPY VM/JIT can target other languages
  • 11. Python benchmark (IBM Research, 2010) 5.00 Execution Time Relative to CPython 2.6 4.00 3.00 2.57 2.00 1.87 1.66 1.04 0.95 1.00 0.69 0.00 binarytrees-2 fasta-2 knucleotide mandelbrot nbody-4 pidigits regexdna revcomp-3 spectralnorm geomean Jython/OpenJDK 6 Jython/HotSpot 7 Jython/TR 6 US (SVN 07/10) PyPy (Jit) IronPython (64)
  • 12. Memory Consumption: important for Parallelism (IBM Research, 2010) 800 700 600 500 Memory (MB) 400 370.08 309.97 300 200 156.97 100 52.49 15.03 32.86 0 t 3 na n -2 2 rm e its ro p- ea a- id 4 es xd lb g no y- om ot st om di de tre ge od fa l le pi tra vc ge an uc ry re nb ec re na kn m sp bi Cpython Jython/OpenJDK Jython/HotSpot 7 Jython/TR US (SVN 7/10) PyPy (jit)
  • 13. “It's possible to take an interpreter and transform it into a compiler” — Yoshihiko Futamura (1971). "Partial Evaluation of Computation Process – An Approach to a Compiler- Compiler"
  • 14. What is PyPy? • Reimplementation of Python in Python • Framework for building interpreters and virtual machines with Restricted Python • L * O * P configurations • L : dynamic languages • O : optimizations • P : platforms $> python py.py $> ./pypy-c $> ./pypy-jvm $> ./pypy-cli
  • 15. PyPy • founded in 2003 by Holger Krekel and Armin Rigo • 2004 - 2007 EU Project - Sixth Framework • Open Source Project since 2007 • occasional Funding by Google • Sprint-Driven Development
  • 16. PyPy • common use scenario is to translate the PyPy RPython code to a backend • C (and then standalone binary), CLI (.Net), JVM • PyPy component • A Python interpreter with the ability to collects traces • A tracing JIT, derived from RPython • Tracing of loops in the user level programs, but recording exact operations executed inside the interpreter • Well defined points to enter and exit traces, and state that can be safely modified inside the trace
  • 19. PyPy Abilities • Use techniques similar to prototype languages (V8) to infer offsets of instance attributes • Garbage collected • Can interface with (most) standard CPython modules • Creates PyObject proxies to internal PyPy objects • Limited concurrency because of GIL
  • 20. PyPy Traces [2bcbab384d062] {jit-log-noopt-loop [p0, p1, p2, p3, p4, p5, p6, p7, p8] debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #24 JUMP_IF_FALSE') debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #27 POP_TOP') debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #28 LOAD_FAST') guard_nonnull(p8, descr=<ResumeGuardDescr object at 0xf6c4cd7c>) debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #31 LOAD_FAST') guard_nonnull(p7, descr=<ResumeGuardDescr object at 0xf6c4ce0c>) debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #34 BINARY_ADD') guard_class(p8, ConstClass(W_IntObject), descr=<ResumeGuardDescr object at 0xf6c4ce9c>) guard_class(p7, ConstClass(W_IntObject), descr=<ResumeGuardDescr object at 0xf6c4cf08>) guard_class(p8, ConstClass(W_IntObject), descr=<ResumeGuardDescr object at 0xf6c4cf74>) guard_class(p7, ConstClass(W_IntObject), descr=<ResumeGuardDescr object at 0xf6c4cfe0>) i13 = getfield_gc_pure(p8, descr=<SignedFieldDescr 8>) i14 = getfield_gc_pure(p7, descr=<SignedFieldDescr 8>) i15 = int_add_ovf(i13, i14) guard_no_overflow(, descr=<ResumeGuardDescr object at 0xf6c4d0c8>) p17 = new_with_vtable(ConstClass(W_IntObject)) setfield_gc(p17, i15, descr=<SignedFieldDescr 8>) debug_merge_point('<code object fioranoTest, file 'perf.py', line 2> #35 STORE_FAST') … [2bcbab3877419] jit-log-noopt-loop}
  • 21. RPython • RPython = Restricted/Reduced Python • Restricted = most possible static subset of Python   • required to perform Type Inference  • input to the Translation Framework • no real specification - just some hints • used for writing interpreters • can be used for writing extensions as well
  • 22. PyPy Interpreter • written in Rpython • Stack-based bytecode interpreter (like JVM) • bytecode compiler → generates bytecode • bytecode evaluator → interprets bytecode  • object space → handles operations on objects def f(x): >>> dis.dis(f) return x + 1 2 0 LOAD_FAST 0 (x) 3 LOAD_CONST 1 (1) 6 BINARY_ADD 22 7 RETURN_VALUE
  • 24. PyPy Interpreter Internals Program Py Compiler Bytecode API Bytecode Object interpreter space 24
  • 25. PyPy Interpreter Internals Program Py Compiler Bytecode API API Proxy Bytecode Object Object interpreter space space
  • 26. PyPy Translation Toolchain • Model-driven interpreter (VM) development • Focus on language model rather than implementation details • Executable models (meta-circular Python) • Translate models to low-level (LL) back- ends • Considerably lower than Python • Weave in implementation details (GC, JIT) • Allow compilation to different back-ends (OO, procedural) 26
  • 28. Compiler Low Flow level Bytecode interpreter object flow space graph Flow analysis RTyper Type Flow Anno- annotated graph tation flow graph
  • 29. Low Code JIT generation level generation flow graph POSI POSI X X JVM Garbage (JVM) CLI (CLI) ... collector ... PyPy interpreter with Just In Time Optimizations X
  • 30. Translation Framework Garbage collection Garbage collection Stackless Stackless JIT JIT 30 30
  • 31. 31
  • 32. CFG (Call Flow Graph) • Consists of Blocks and Links • Starting from entry_point • “Single Static Information” form def f(n): return 3 * n + 2 Block(v1): # input argument v2 = mul(Constant(3), v1) v3 = add(v2, Constant(2))
  • 33. CFG: Static Single Information • SSI: “PHIs” for all used variables • Blocks as “functions without branches” def test(a): if a > 0: if a > 5: return 10 return 4 if a < - 10: return 3 return 10 33 33
  • 34. • Python is dynamically typed Type Inference • Translate to statically typed code for efficiency reasons
  • 35. • Which to be inferred? Type Inference • Type for every variable • Messages sent to an object must be defined in the compile-time type or a supertype • How to infer types • Starting from entry_point • reach the whole program • type of arguments and return- value are known • Forward propagation • Iteratively, until all links in the CFG have been followed at least once • Results in a large dictionary 35 mapping variables to types
  • 36. Type inference restricts • RRython is the subset of Python, which is type inferable • Actually: type inferable stabilized bytecode • Allows load-time meta-programming • Messages sent to an object must be defined in the compile-time type or supertype @objectmodel.specialize.argtype(0) def plus(a, b): def plus(a, b): return a + b return a + b def entry_point(arv=None): def entry_point(arv=None): print plus(20, 22) print plus(20, 22) print plus(“4”, “2”) print plus(“4”, “2”)
  • 37. PyPy Advantages • High Level Language Implementation • to implement new features: lazily computed objects and functions, plug-able  garbage-collection, runtime replacement of live-objects, stackless concurrency  • JIT Generation • Object space • Stackless • infinite Recursion • Microthreads: Coroutines, Tasklets and Channels, Greenlets
  • 38. Object Spaces in PyPy • Flow ObjSpace • Thunk ObjSpace • Taint ObjSpace • Dump ObjSpace • Transparent Proxies
  • 39. Object Spaces in PyPy • Thunk ObjSpace >>>> a = "hello" >>>> b = "world" lazily computed objects  >>>> a + b lazily computed functions 'helloworld' globally replaceable objects >>>> become(a,b) >>>> a + b 'worldworld' • Taint ObjSpace • provides protection for: sensitive data that should not leak • provides protection from: >>>> password = "secret" • Untrusted data that needs to be >>>> password 'secret' validated >>>> password = taint("secret") >>>> password Traceback (application-level): File "<inline>", line 1 in <interactive> password TaintError
  • 40. Reference • PyPy Internals: http://codespeak.net/pypy/dist/pypy/doc/ • “Compiler Construction”, Prof. O. Nierstrasz, Fall Semester 2008 • “The PyPy translation tool chain”, Toon Verwaest • “Compilers are from Mars, Dynamic Scripting Languages are from Venus, Jose Castanos”, David Edelsohn, Kazuaki Ishizaki, Priya Nagpurkar, Takeshi Ogasawara, Akihiko Tozawa, Peng Wu (2010) 40