@@ -6,7 +6,7 @@ The CPython interpreter is defined in C, meaning that the semantics of the
66bytecode instructions, the dispatching mechanism, error handling, and
77tracing and instrumentation are all intermixed.
88
9- This document proposes defining a custom C-like DSL for defining the
9+ This document proposes defining a custom C-like DSL for defining the
1010instruction semantics and tools for generating the code deriving from
1111the instruction definitions.
1212
@@ -46,7 +46,7 @@ passes from the semantic definition, reducing errors.
4646
4747As we improve the performance of CPython, we need to optimize larger regions
4848of code, use more complex optimizations and, ultimately, translate to machine
49- code.
49+ code.
5050
5151All of these steps introduce the possibility of more bugs, and require more code
5252to be written. One way to mitigate this is through the use of code generators.
@@ -62,7 +62,7 @@ blocks as the instructions for the tier 1 (PEP 659) interpreter.
6262Rewriting all the instructions is tedious and error-prone, and changing the
6363instructions is a maintenance headache as both versions need to be kept in sync.
6464
65- By using a code generator and using a common source for the instructions, or
65+ By using a code generator and using a common source for the instructions, or
6666parts of instructions, we can reduce the potential for errors considerably.
6767
6868
@@ -75,7 +75,7 @@ We update it as the need arises.
7575
7676Each op definition has a kind, a name, a stack and instruction stream effect,
7777and a piece of C code describing its semantics::
78-
78+
7979```
8080 file:
8181 (definition | family | pseudo)+
@@ -86,7 +86,7 @@ and a piece of C code describing its semantics::
8686 "op" "(" NAME "," stack_effect ")" "{" C-code "}"
8787 |
8888 "macro" "(" NAME ")" "=" uop ("+" uop)* ";"
89-
89+
9090 stack_effect:
9191 "(" [inputs] "--" [outputs] ")"
9292
@@ -201,6 +201,7 @@ Those functions include:
201201* ` DEOPT_IF(cond, instruction) ` . Deoptimize if ` cond ` is met.
202202* ` ERROR_IF(cond, label) ` . Jump to error handler at ` label ` if ` cond ` is true.
203203* ` DECREF_INPUTS() ` . Generate ` Py_DECREF() ` calls for the input stack effects.
204+ * ` SYNC_SP() ` . Synchronizes the physical stack pointer with the stack effects.
204205
205206Note that the use of ` DECREF_INPUTS() ` is optional -- manual calls
206207to ` Py_DECREF() ` or other approaches are also acceptable
@@ -445,7 +446,7 @@ rather than popping and pushing, such that `LOAD_ATTR_SLOT` would look something
445446 stack_pointer += 1;
446447 }
447448 s1 = res;
448- }
449+ }
449450 next_instr += (1 + 1 + 2 + 1 + 4);
450451 stack_pointer[-1] = s1;
451452 DISPATCH();
0 commit comments