Skip to content

Commit 5f2c8ff

Browse files
committed
cache layouts
1 parent cf4c042 commit 5f2c8ff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: InternalDocs/interpreter.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,13 @@ the same. Cache entries are reserved by the compiler and initialized with zeros
128128
Although they are represented by code units, cache entries do not conform to the
129129
`opcode` / `oparg` format.
130130

131-
If an instruction has an inline cache, the layout of its cache is described by
132-
a `struct` definition in [`pycore_code.h`](../Include/internal/pycore_code.h).
133-
This allows us to access the cache by casting `next_instr` to a pointer to this `struct`.
134-
The size of such a `struct` must be independent of the machine architecture, word size
135-
and alignment requirements. For a 32-bit field, the `struct` should use `_Py_CODEUNIT field[2]`.
131+
If an instruction has an inline cache, the layout of its cache is described in
132+
the instruction's definition in [`Python/bytecodes.c`](../Python/bytecodes.c).
133+
The structs defined in [`pycore_code.h`](../Include/internal/pycore_code.h)
134+
allow us to access the cache by casting `next_instr` to a pointer to the relevant
135+
`struct`. The size of such a `struct` must be independent of the machine
136+
architecture, word size and alignment requirements. For a 32-bit field, the
137+
`struct` should use `_Py_CODEUNIT field[2]`.
136138

137139
The instruction implementation is responsible for advancing `next_instr` past the inline cache.
138140
For example, if an instruction's inline cache is four bytes (that is, two code units) in size,

0 commit comments

Comments
 (0)