summaryrefslogtreecommitdiffstats
path: root/Include/cpython/code.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-04-07 18:15:02 (GMT)
committerGitHub <noreply@github.com>2025-04-07 18:15:02 (GMT)
commit3f3863281bb3cd40efc2f1c4bed901457b8cd170 (patch)
treeb866be1366c73792f5a8901e096a637a738dc093 /Include/cpython/code.h
parent1fcf409acef8a7a039353cf11a0bbb24ca6722f8 (diff)
downloadcpython-3f3863281bb3cd40efc2f1c4bed901457b8cd170.zip
cpython-3f3863281bb3cd40efc2f1c4bed901457b8cd170.tar.gz
cpython-3f3863281bb3cd40efc2f1c4bed901457b8cd170.tar.bz2
[3.13] GH-127953: Make line number lookup O(1) regardless of the size of the code object (#129127)
GH-127953: Make line number lookup O(1) regardless of the size of the code object (GH-128350)
Diffstat (limited to 'Include/cpython/code.h')
-rw-r--r--Include/cpython/code.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/Include/cpython/code.h b/Include/cpython/code.h
index 58d93fc..bd8afab 100644
--- a/Include/cpython/code.h
+++ b/Include/cpython/code.h
@@ -33,11 +33,12 @@ typedef struct {
} _PyCoCached;
/* Ancillary data structure used for instrumentation.
- Line instrumentation creates an array of
- these. One entry per code unit.*/
+ Line instrumentation creates this with sufficient
+ space for one entry per code unit. The total size
+ of the data will be `bytes_per_entry * Py_SIZE(code)` */
typedef struct {
- uint8_t original_opcode;
- int8_t line_delta;
+ uint8_t bytes_per_entry;
+ uint8_t data[1];
} _PyCoLineInstrumentationData;