GH-127953: Make line number lookup O(1) regardless of the size of the code object (GH-128350)

This commit is contained in:
Mark Shannon 2025-01-21 09:33:23 +00:00 committed by GitHub
parent f7cc7d296c
commit 7239da7559
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 214 additions and 163 deletions

View file

@ -35,11 +35,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;