Skip to content
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

The code generated for the interpreter(s) is too fragile #111485

Closed
markshannon opened this issue Oct 30, 2023 · 5 comments
Closed

The code generated for the interpreter(s) is too fragile #111485

markshannon opened this issue Oct 30, 2023 · 5 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@markshannon
Copy link
Member

markshannon commented Oct 30, 2023

Changing the name of an instruction, or slight changes in cache size can cause the generated code to be incorrect in odd ways.
This is a result of there being too many special cases and undocumented assumptions built in to the code generator.

This was a natural result of getting the thing working and was, until now, acceptable technical debt.
However, as we want to generate abstract interpreters, a new combiner tier-1/tier-2 interpreter and possible tail-calling interprtet/JIT compiler pair, things are too fragile.

We need to:

  • Reduce the number of ad-hoc special cases in the tools to zero.
  • Minimize and very clearly specify any special markers and variables we use in bytecodes.c
  • Clarify the in-memory state and transitions of execution.
  • Document the representation of that state in the various tiers and components.

Linked PRs

FullteaR pushed a commit to FullteaR/cpython that referenced this issue Nov 3, 2023
FullteaR pushed a commit to FullteaR/cpython that referenced this issue Nov 3, 2023
FullteaR pushed a commit to FullteaR/cpython that referenced this issue Nov 3, 2023
hugovk pushed a commit to hugovk/cpython that referenced this issue Nov 8, 2023
hugovk pushed a commit to hugovk/cpython that referenced this issue Nov 8, 2023
@neonene
Copy link
Contributor

neonene commented Nov 21, 2023

Maybe INSTRUMENTED_RESUME has an unintentional edit (mixed replacement) since d27acd4?

cpython/Python/bytecodes.c

Lines 187 to 189 in d27acd4

if (frame->instr_ptr != this_instr) {
/* Instrumentation has jumped */
next_instr = this_instr;

Previously, line 189 was next_instr = frame->instr_ptr;

@gvanrossum
Copy link
Member

@markshannon ^^

@markshannon
Copy link
Member Author

Indeed. That doesn't look right.

aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

4 participants