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
Generate the interpreter #98831
Labels
3.12
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-feature
A feature request or enhancement
Comments
gvanrossum
added a commit
that referenced
this issue
Nov 3, 2022
The switch cases (really TARGET(opcode) macros) have been moved from ceval.c to generated_cases.c.h. That file is generated from instruction definitions in bytecodes.c (which impersonates a C file so the C code it contains can be edited without custom support in e.g. VS Code). The code generator lives in Tools/cases_generator (it has a README.md explaining how it works). The DSL used to describe the instructions is a work in progress, described in https://github.com/faster-cpython/ideas/blob/main/3.12/interpreter_definition.md. This is surely a work-in-progress. An easy next step could be auto-generating super-instructions. **IMPORTANT: Merge Conflicts** If you get a merge conflict for instruction implementations in ceval.c, your best bet is to port your changes to bytecodes.c. That file looks almost the same as the original cases, except instead of `TARGET(NAME)` it uses `inst(NAME)`, and the trailing `DISPATCH()` call is omitted (the code generator adds it automatically).
gvanrossum
added a commit
that referenced
this issue
Nov 3, 2022
This was referenced Nov 4, 2022
gvanrossum
pushed a commit
that referenced
this issue
Nov 4, 2022
gvanrossum
added a commit
that referenced
this issue
Nov 4, 2022
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
gvanrossum
pushed a commit
that referenced
this issue
Nov 4, 2022
gvanrossum
added a commit
that referenced
this issue
Nov 6, 2022
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
gvanrossum
added a commit
that referenced
this issue
Nov 8, 2022
This was referenced Nov 9, 2022
gvanrossum
added a commit
to gvanrossum/cpython
that referenced
this issue
Nov 10, 2022
python#99271) Also mark those opcodes that have no stack effect as such. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
ethanfurman
pushed a commit
to ethanfurman/cpython
that referenced
this issue
Nov 12, 2022
python#99271) Also mark those opcodes that have no stack effect as such. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
gvanrossum
added a commit
that referenced
this issue
Nov 16, 2022
iritkatriel
added a commit
to iritkatriel/cpython
that referenced
this issue
Jan 31, 2023
…le opcodes in the instruction definition DSL
gvanrossum
added a commit
that referenced
this issue
Jan 31, 2023
iritkatriel
added a commit
that referenced
this issue
Jan 31, 2023
…odes in the instruction definition DSL (#101443)
iritkatriel
added a commit
to iritkatriel/cpython
that referenced
this issue
Jan 31, 2023
…struction definition DSL
mdboom
pushed a commit
to mdboom/cpython
that referenced
this issue
Jan 31, 2023
mdboom
pushed a commit
to mdboom/cpython
that referenced
this issue
Jan 31, 2023
mdboom
pushed a commit
to mdboom/cpython
that referenced
this issue
Jan 31, 2023
Fix two bugs in case generator - UndefinedLocalError when generating metadata for an 'op' - Accidental newline inserted in test_generator.py
mdboom
pushed a commit
to mdboom/cpython
that referenced
this issue
Jan 31, 2023
mdboom
pushed a commit
to mdboom/cpython
that referenced
this issue
Jan 31, 2023
mdboom
pushed a commit
to mdboom/cpython
that referenced
this issue
Jan 31, 2023
…le opcodes in the instruction definition DSL (python#101443)
carljm
added a commit
to carljm/cpython
that referenced
this issue
Jan 31, 2023
* main: pythongh-101440: fix json snippet error in logging-cookbook.rst (python#101439) pythongh-99276 - Updated Doc/faq/general.rst (python#101396) Add JOBS parameter to docs Makefile (python#101395) pythongh-98831: rewrite GET_LEN, GET_ITER, BEFORE_WITH and a few simple opcodes in the instruction definition DSL (python#101443) pythongh-77607: Improve accuracy of os.path.join docs (python#101406) Fixes typo in asyncio.TaskGroup context manager code example (python#101449) pythongh-98831: Clean up and add cache size static_assert to macro (python#101442) pythongh-99955: use SUCCESS/ERROR return values in optimizer and assembler. Use RETURN_IF_ERROR where appropriate. Fix a couple of bugs. (python#101412)
carljm
added a commit
to carljm/cpython
that referenced
this issue
Jan 31, 2023
* main: pythonGH-100288: Skip extra work when failing to specialize LOAD_ATTR (pythonGH-101354) pythongh-101409: Improve generated clinic code for self type checks (python#101411) pythongh-98831: rewrite BEFORE_ASYNC_WITH and END_ASYNC_FOR in the instruction definition DSL (python#101458) pythongh-101469: Optimise get_io_state() by using _PyModule_GetState() (pythonGH-101470)
This was referenced Feb 1, 2023
Merged
gvanrossum
added a commit
that referenced
this issue
Feb 1, 2023
gvanrossum
added a commit
that referenced
this issue
Feb 1, 2023
carljm
added a commit
to carljm/cpython
that referenced
this issue
Feb 1, 2023
* main: pythongh-98831: rewrite PUSH_EXC_INFO and conditional jumps in the instruction definition DSL (python#101481) pythongh-98831: Modernize the LOAD_ATTR family (python#101488) pythongh-101498 : Fix asyncio.Timeout example in docs (python#101499) pythongh-101454: fix documentation for END_ASYNC_FOR (python#101455) pythongh-101277: Isolate itertools, add group and _grouper types to module state (python#101302) pythongh-101317: Add `ssl_shutdown_timeout` parameter for `asyncio.StreamWriter.start_tls` (python#101335) datetime.rst: fix combine() signature (python#101490)
iritkatriel
added a commit
that referenced
this issue
Feb 2, 2023
iritkatriel
added a commit
that referenced
this issue
Feb 3, 2023
…instruction definition DSL (#101516)
iritkatriel
added a commit
to iritkatriel/cpython
that referenced
this issue
Feb 3, 2023
…n the instruction definition DSL (python#101516)
iritkatriel
added a commit
that referenced
this issue
Feb 3, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.12
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-feature
A feature request or enhancement
Overview
Over in faster-cpython/ideas we've been exploring the idea of generating the interpreter from a set of instruction definitions. This will eventually enable having multiple versions of the interpreter (e.g. with and without tracing enabled), and it will allow us to automatically combine instructions using a powerful notation (e.g.
super(LOAD_FAST__LOAD_FAST) = LOAD_FAST + LOAD_FAST;
). It will also let us auto-generate things likestack_effect()
.We are planning to land at least an early version of this work in 3.12. We have a tentative grammar for instruction definition DSL -- which will undoubtedly undergo several iterations before we've settled. We have a first draft of the tooling
ready for review (which currently reproduces the status quo)done.Once the first version of the tooling has landed we expect to iterate quickly, using this issue an umbrella issue for our PRs to link to.
References
regen-cases
toregen-all
#99107macro
andop
and their implementation to DSL #99495The text was updated successfully, but these errors were encountered: