-
Notifications
You must be signed in to change notification settings - Fork 5
Updates #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install dependencies | ||
| run: sudo apt-get update && sudo apt-get install -y nasm libgmp-dev | ||
|
|
||
| - name: Build | ||
| run: make | ||
|
|
||
| - name: Test | ||
| run: make check | ||
|
|
||
| - name: CPython compatibility tests | ||
| run: make check-cpython | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,26 +1,30 @@ | ||||||||||||||||||
| # apython | ||||||||||||||||||
|
|
||||||||||||||||||
| A Python 3.12 bytecode interpreter in x86-64 NASM assembly, exploring the fastest single-core Python execution on x86-64. | ||||||||||||||||||
| A Python 3.12 bytecode interpreter in x86-64 NASM assembly (v0.6.0), exploring the fastest single-core Python execution on x86-64. | ||||||||||||||||||
|
|
||||||||||||||||||
| ## What is this? | ||||||||||||||||||
|
|
||||||||||||||||||
| apython reads `.pyc` files and executes Python 3.12 bytecode directly — no CPython, no JIT, no interpreter overhead layers. The entire interpreter is hand-written x86-64 assembly, from the eval loop to the type system to I/O. | ||||||||||||||||||
| apython reads `.pyc` files and executes Python 3.12 bytecode directly — no CPython, no JIT, no interpreter overhead layers. The entire interpreter is **~74,000 lines of hand-written x86-64 assembly**, from the eval loop to the type system to the garbage collector to async I/O. It implements 27+ types, 106 opcodes, generators, async/await, pattern matching, a regex engine, cycle-collecting GC, and a pure-assembly asyncio event loop. | ||||||||||||||||||
|
|
||||||||||||||||||
| ## Key design choices | ||||||||||||||||||
|
|
||||||||||||||||||
| - **~10K lines of hand-written x86-64 NASM assembly** — no C runtime, no generated code | ||||||||||||||||||
| - **~74K lines of hand-written x86-64 NASM assembly** — no C runtime, no generated code | ||||||||||||||||||
| - **128-bit fat values** — inline integers, floats, bools in 16-byte (payload, tag) pairs, skipping heap allocation and refcounting entirely | ||||||||||||||||||
| - **SmallStr optimization** — strings up to 15 bytes stored inline in the 128-bit value slot, zero allocation | ||||||||||||||||||
| - **Raw Linux syscalls** — no libc dependency for I/O; buffered writes via direct `syscall` | ||||||||||||||||||
|
Comment on lines
+11
to
14
|
||||||||||||||||||
| - **~74K lines of hand-written x86-64 NASM assembly** — no C runtime, no generated code | |
| - **128-bit fat values** — inline integers, floats, bools in 16-byte (payload, tag) pairs, skipping heap allocation and refcounting entirely | |
| - **SmallStr optimization** — strings up to 15 bytes stored inline in the 128-bit value slot, zero allocation | |
| - **Raw Linux syscalls** — no libc dependency for I/O; buffered writes via direct `syscall` | |
| - **~74K lines of hand-written x86-64 NASM assembly** — no C source / mostly assembly; minimal libc usage (link for libgmp and platform glue) | |
| - **128-bit fat values** — inline integers, floats, bools in 16-byte (payload, tag) pairs, skipping heap allocation and refcounting entirely | |
| - **SmallStr optimization** — strings up to 15 bytes stored inline in the 128-bit value slot, zero allocation | |
| - **Raw Linux syscalls** — I/O hot paths use direct `syscall`; limited libc usage in the poll/epoll fallback layer |
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These bullets say there is “no libc dependency for I/O” and that the async I/O backend falls back to “epoll”, but the codebase includes a libc poll()-based backend (see src/pyo/eventloop_poll.asm) and the link flags include -lc. Please align the README wording with the actual fallback/backend and libc usage (e.g., “poll() fallback” / “uses libc poll() for fallback”).
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick start uses python3 -m py_compile ..., but apython validates .pyc files as Python 3.12 specifically (and the test tooling expects .cpython-312.pyc). Using a non-3.12 python3 will generate incompatible .pyc files. Recommend documenting python3.12 -m py_compile explicitly (or note the requirement that python3 must be 3.12).
| python3 -m py_compile script.py | |
| python3.12 -m py_compile script.py |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI runs
make check/make check-cpython, but the test harness and Makefile hardcodecpython-312.pycfilenames while invokingpython3. Onubuntu-latest,python3may not be 3.12, which will cause missing.cpython-312.pycartifacts and skipped tests or failures. Pin/install Python 3.12 (e.g.,actions/setup-pythonwith 3.12 and/or ensurepython3points to 3.12) or update the test commands to explicitly usepython3.12/ version-detected.pycnaming.