Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜
-
Upload
preferred-infrastructure-preferred-networks -
Category
Technology
-
view
3.047 -
download
0
Transcript of Pythonの理解を試みる 〜バイトコードインタプリタを作成する〜
-
Python
Preferred Networks, Inc.
2016/04/28
-
l (@suma90h) (Preferred Networks)
l Dockerfile
l
1
2
-
3
-
4
-
Python
l Python
Python
CPython
l
2015/07/09 Go 1.5
2014/12/18 systemd
5
-
Python
l 10
l Python
Chainer (PFI/PFN
Ansible 2.0
u
l
Python 3Python 2.7
Ubuntu 16.04Python 3
6
-
Python
l
l QPython
l
A
BOS
C
7
-
Python
l BOS
l AmoebaOS
WikipediaPythonFAQ
l
A
Perlawk
C
Ruby
8
-
CPython
9
-
l
l Syntax
l VMVirtual Machine
Java VMCLR(.NET Framework)
JavaScript
Ruby
Python
u GoPython
10
-
l CPython
Python
11
-
Python
l
Java18(Operation Code)
Python1
1256
l
Python-2.7.10/Include/opcode.h 147
Python-3.5.1/Include/opcode.h 154
12
-
Pythonl
l CPython
13
source (test.py)
lexical analyzer
parser etc execute
Python
result
-
l CPython
CPythonC
u http://docs.python.jp/2.7/library/dis.html
l GoGoPyD
l GoPy
wc -l *.go 1643
10001
14
-
D
l
l better C++C++VM
l DD1000
Go
Go
l The D Programming Language
2010
15
-
Python.pyc
l .pyc Python
l file.pyfile.pycfile.pyc
pyc.py
python - When are .pyc files refreshed? - Stack Overflow
u http://stackoverflow.com/questions/15839555/when-are-pyc-files-refreshed
l pyc
import.py
python m compileall m py_compile
l pyc
16
-
Python.pyc
l
l Python-2.7.10/Include/code.h PyCodeObject
https://hg.python.org/cpython/file/2.7/Include/code.h#l10
l pyc
16/32
l VM
Python
Opode: https://hg.python.org/cpython/file/2.7/Include/opcode.h17
-
VMPython
l
https://ja.wikipedia.org/wiki/
https://en.wikipedia.org/wiki/Stack_machine
Java VMCLR(.NET Framework)VM
l Python
BINARY_ADD: 2PopPush
LOAD_NAME: Push
STORE_NAME: 1Pop
http://docs.python.jp/2.7/library/dis.html
18
-
l
l twitter
19
-
l 2016/04/20
D
20
-
l 2016/04/21
pyc4
printf
PyTupleattribute
Bytecodeopcodeswitch
21
-
l 2016/04/21
DStack
kinaba
22
-
l 2016/04/22
Opcode
23
-
l 2016/04/24
STORE_NAME
24
-
l 2016/04/25
25
-
l GoPy
timetime.time()Unix time
l
print
26
-
Python
l Python
pyc16/ASCIIopcode
l
Python
DVMD
Pythonfunction
Python `type(funcname)`
l Python
27
-
Python
l CPython
iffor
CPython
l
GIL(Global Interpreter Lock)
GC(Garbage Collection)
CPythonC
28
-
l https://github.com/flosch/GoPy
l https://github.com/nedbat/byterun
l http://akaptur.com/blog/2013/11/15/introduction-to-the-python-interpreter/
29
-
Copyright 2016
Preferred Networks All Right Reserved.