summaryrefslogtreecommitdiffstats
path: root/Include/cpython/code.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-06-20 12:00:42 (GMT)
committerGitHub <noreply@github.com>2022-06-20 12:00:42 (GMT)
commitab0e60101637b7cf47f3cc95813996791e7118c4 (patch)
treec0590854ab9e9137c872f0789763d7bb07151fb0 /Include/cpython/code.h
parent45e62a2bc1c0000e2e9b613fff6bebf2c26fcb93 (diff)
downloadcpython-ab0e60101637b7cf47f3cc95813996791e7118c4.zip
cpython-ab0e60101637b7cf47f3cc95813996791e7118c4.tar.gz
cpython-ab0e60101637b7cf47f3cc95813996791e7118c4.tar.bz2
GH-93516: Speedup line number checks when tracing. (GH-93763)
* Use a lookup table to reduce overhead of getting line numbers during tracing.
Diffstat (limited to 'Include/cpython/code.h')
-rw-r--r--Include/cpython/code.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Include/cpython/code.h b/Include/cpython/code.h
index 3ccd101..238bf94 100644
--- a/Include/cpython/code.h
+++ b/Include/cpython/code.h
@@ -62,7 +62,8 @@ typedef uint16_t _Py_CODEUNIT;
PyObject *co_exceptiontable; /* Byte string encoding exception handling \
table */ \
int co_flags; /* CO_..., see below */ \
- int co_warmup; /* Warmup counter for quickening */ \
+ short co_warmup; /* Warmup counter for quickening */ \
+ short _co_linearray_entry_size; /* Size of each entry in _co_linearray */ \
\
/* The rest are not so impactful on performance. */ \
int co_argcount; /* #arguments, except *args */ \
@@ -90,6 +91,7 @@ typedef uint16_t _Py_CODEUNIT;
PyObject *co_weakreflist; /* to support weakrefs to code objects */ \
void *_co_code; /* cached co_code object/attribute */ \
int _co_firsttraceable; /* index of first traceable instruction */ \
+ char *_co_linearray; /* array of line offsets */ \
/* Scratch space for extra data relating to the code object. \
Type is a void* to keep the format private in codeobject.c to force \
people to go through the proper APIs. */ \