Skip to content

Add JIT compiler development skill to cpython-skills plugin#7

Merged
gpshead merged 2 commits intomainfrom
claude/add-cpython-jit-skill-1xUWc
Mar 7, 2026
Merged

Add JIT compiler development skill to cpython-skills plugin#7
gpshead merged 2 commits intomainfrom
claude/add-cpython-jit-skill-1xUWc

Conversation

@gpshead
Copy link
Copy Markdown
Owner

@gpshead gpshead commented Feb 24, 2026

Summary

This PR adds a new jit skill to the cpython-skills plugin, providing comprehensive documentation and guidance for working on CPython's experimental JIT compiler.

Key Changes

  • New skill file: plugins/cpython-skills/skills/jit/SKILL.md - A detailed guide covering:

    • JIT architecture overview (copy-and-patch compilation model)
    • LLVM 21 toolchain prerequisites and installation instructions for multiple platforms
    • Build configuration options for --enable-experimental-jit (full JIT, interpreter-only, disabled variants)
    • Complete file reference for build-time tools (Tools/jit/) and runtime components (Python/jit.c, etc.)
    • Build pipeline documentation (bytecodes.c → executor_cases.c.h → stencils → jit_stencils.h)
    • Stencil regeneration workflow and digest caching mechanism
    • Testing procedures with environment variable controls
    • Debugging guidance for common JIT issues and inspection techniques
    • Platform support matrix (x86_64/aarch64 on Linux/macOS/Windows)
    • Key concepts glossary (stencils, holes, preserve_none, musttail, GOT, executors)
  • Updated plugin configuration: plugins/cpython-skills/plugin.json - Registered the new jit skill

  • Updated README: plugins/cpython-skills/README.md - Added documentation for the new skill and updated skill count from four to five

  • Updated dev skill description: plugins/cpython-skills/skills/dev/SKILL.md - Updated to reference the new jit skill in the meta-skill coordination list

Implementation Details

The JIT skill documentation is comprehensive and practical, covering the full development workflow from environment setup through debugging. It includes:

  • Specific LLVM version requirement (21) with platform-specific installation commands
  • Detailed explanation of the copy-and-patch compilation pipeline with ASCII diagram
  • Reference tables for configuration options, key files, and environment variables
  • Troubleshooting section addressing common failure modes
  • Commands for regenerating stencils with digest-based caching explanation

https://claude.ai/code/session_01G1etZcjcrhEVk6rnLhJKZP

Add a new 'jit' skill covering CPython's experimental JIT compiler
development workflow. The skill provides guidance on:

- LLVM 21 toolchain setup for stencil generation
- JIT configure flags (--enable-experimental-jit options)
- The copy-and-patch compilation pipeline (template.c → jit_stencils.h)
- Key files in Tools/jit/ and Python/jit.c
- Stencil regeneration after bytecode changes
- Debugging JIT issues (PYTHON_JIT=0 vs PYTHON_JIT=1)
- Supported target platforms and object formats
- Key concepts: stencils, holes, preserve_none, musttail, GOT

Also updates the dev skill to reference the jit skill as a loadable
specialized skill, and updates plugin.json and README.md.

https://claude.ai/code/session_01G1etZcjcrhEVk6rnLhJKZP
…g env vars to JIT skill

Expand the JIT skill with additional details discovered during research:
- Python/optimizer_analysis.c and Python/perf_jit_trampoline.c in key files
- Lib/test/test_optimizer.py as the relevant test file
- PYTHON_OPT_DEBUG environment variable table for debug tracing

https://claude.ai/code/session_01G1etZcjcrhEVk6rnLhJKZP
@gpshead gpshead marked this pull request as ready for review March 7, 2026 17:34
@gpshead gpshead merged commit 66de839 into main Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants