Skip to content

Commit bf33ab6

Browse files
iritkatrielJacobCoffeeAlexWaygood
authored
Apply suggestions from code review
Co-authored-by: Jacob Coffee <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
1 parent 7cb1441 commit bf33ab6

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

InternalDocs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ Program Execution
3737

3838
- [Adaptive Instruction Families](adaptive.md)
3939

40-
- [Garbage collector design](garbage_collector.md)
40+
- [Garbage Collector Design](garbage_collector.md)
4141

4242
- [Exception Handling](exception_handling.md)

InternalDocs/interpreter.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ we ignore `oparg`.
6969

7070
A simplified version of the interpreter's main loop looks like this:
7171

72-
```
72+
```c
7373
_Py_CODEUNIT *first_instr = code->co_code_adaptive;
7474
_Py_CODEUNIT *next_instr = first_instr;
7575
while (1) {
@@ -89,7 +89,7 @@ The instruction format supports 256 different opcodes, which is sufficient.
8989
However, it also limits `oparg` to 8-bit values, which is too restrictive.
9090
To overcome this, the `EXTENDED_ARG` opcode allows us to prefix any instruction
9191
with one or more additional data bytes, which combine into a larger oparg.
92-
For example, this sequence of code units::
92+
For example, this sequence of code units:
9393
9494
EXTENDED_ARG 1
9595
EXTENDED_ARG 0
@@ -106,7 +106,7 @@ a primary opcode.
106106
The following loop, to be inserted just above the `switch` statement, will make the above
107107
snippet decode a complete instruction:
108108
109-
```
109+
```c
110110
while (opcode == EXTENDED_ARG) {
111111
word = *next_instr++;
112112
opcode = _Py_OPCODE(word);
@@ -132,7 +132,7 @@ Inline cache entries
132132

133133
Some (specialized or specializable) instructions have an associated "inline cache".
134134
The inline cache consists of one or more two-byte entries included in the bytecode
135-
array as additional words following the `opcode` /`oparg` pair.
135+
array as additional words following the `opcode`/`oparg` pair.
136136
The size of the inline cache for a particular instruction is fixed by its `opcode`.
137137
Moreover, the inline cache size for all instructions in a
138138
[family of specialized/specializable instructions](adaptive.md)
@@ -190,9 +190,9 @@ that may be `NULL` are known.
190190
A few other instructions (`GET_ITER`, `FOR_ITER`) push or pop an object that is known to
191191
be an iterator.
192192

193-
Instruction sequences that do not allow statically knowing the stack depth are deemed illegal
194-
and the bytecode compiler never generates such sequences.
195-
For example, the following sequence is illegal, because it keeps pushing items on the stack::
193+
Instruction sequences that do not allow statically knowing the stack depth are deemed illegal;
194+
the bytecode compiler never generates such sequences.
195+
For example, the following sequence is illegal, because it keeps pushing items on the stack:
196196

197197
LOAD_FAST 0
198198
JUMP_BACKWARD 2
@@ -318,12 +318,12 @@ First, you must choose a name for the bytecode, implement it in
318318
and add a documentation entry in
319319
[`Doc/library/dis.rst`](https://github.com/python/cpython/blob/main/Doc/library/dis.rst).
320320
Then run `make regen-cases` to assign a number for it (see
321-
[`Include/opcode_ids.h`](https://github.com/python/cpython/blob/main/Include/opcode_ids.h)
321+
[`Include/opcode_ids.h`](https://github.com/python/cpython/blob/main/Include/opcode_ids.h))
322322
and regenerate a number of files with the actual implementation of the bytecode in
323323
[`Python/generated_cases.c.h`](https://github.com/python/cpython/blob/main/Python/generated_cases.c.h)
324324
and metadata about it in additional files.
325325

326-
With a new bytecode you must also change what is called the magic number for
326+
With a new bytecode you must also change what is called the "magic number" for
327327
.pyc files: bump the value of the variable `MAGIC_NUMBER` in
328328
[`Lib/importlib/_bootstrap_external.py`](https://github.com/python/cpython/blob/main/Lib/importlib/_bootstrap_external.py).
329329
Changing this number will lead to all .pyc files with the old `MAGIC_NUMBER`

0 commit comments

Comments
 (0)