GH-98831: "Generate" the interpreter by gvanrossum · Pull Request #98830 · python/cpython · GitHub

github.com

Tin mới

gvanrossum:generate-ceval-switch

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

generated_cases.c.h

Two new files in the Python subdirectory, bytecodes.c and generated_cases.c.h. (UPDATE: cases.h -> generated_cases.c.h.)

instruction definitions

Tools/cases_generator

A new bunch of tooling, in Tools/cases_generator. This includes:

Generating code for the ceval loop/switch faster-cpython/ideas#5

Super-instructions faster-cpython/ideas#16

Define opcodes in terms of smaller "micro-ops" faster-cpython/ideas#454

Change the interpreter definition DSL to be legal C syntax faster-cpython/ideas#477

Mechanics of interpreter generation from DSL faster-cpython/ideas#479

Stack effect of jumping -- how to express in DSL faster-cpython/ideas#481

Generate the interpreter #98831

New script to generate the ceval switch

Add 'End regular instructions' marker

Extract to a format closer to interpreter_definition.md

Switch to generating new DSL syntax

Indent output; Always generate stack effect syntax; use argparse

Check jump flag; tweak begin and end of the script a bit

Fix incorrect output for ??--??

Script to generate cases.h from bytecodes.inst

Write bytecodes.inst into Python directory by default

Initial bytecodes.inst

Changes to ceval.c to use cases.h

Changes to Makefile.pre.in to generate cases.h

Move #endif around

Write families to .inst file

Derive stack effect for super-instructions and specializations

Regenerated bytecodes.inst with fewer errors

Support array stack effects

Array stack effects are now in bytecodes.inst

Add Mark's C lexer

Start writing a real parser