summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_code.h
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-123747: Avoid static_assert() in internal header files (#123779) ↵Victor Stinner2024-09-061-2/+3
| | | | | | | (#123785) gh-123747: Avoid static_assert() in internal header files (#123779) (cherry picked from commit ef4b69d2becf49daaea21eb04effee81328a0393)
* [3.13] gh-120642: Move _PyCode_CODE() to the internal C API (GH-121644) ↵Miss Islington (bot)2024-07-131-0/+3
| | | | | | | | | | | (#121729) gh-120642: Move _PyCode_CODE() to the internal C API (GH-121644) Move _PyCode_CODE() and _PyCode_NBYTES() macros to the internal C API since they use _Py_CODEUNIT which is only part of the internal C API. (cherry picked from commit a2bec77d25b11f50362a7117223f6d1d5029a909) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) ↵Victor Stinner2024-06-261-0/+44
| | | | | | | | | | | | | | | | | | | | | (#121043) gh-120642: Move private PyCode APIs to the internal C API (#120643) * Move _Py_CODEUNIT and related functions to pycore_code.h. * Move _Py_BackoffCounter to pycore_backoff.h. * Move Include/cpython/optimizer.h content to pycore_optimizer.h. * Remove Include/cpython/optimizer.h. * Remove PyUnstable_Replace_Executor(). Rename functions: * PyUnstable_GetExecutor() => _Py_GetExecutor() * PyUnstable_GetOptimizer() => _Py_GetOptimizer() * PyUnstable_SetOptimizer() => _Py_SetTier2Optimizer() * PyUnstable_Optimizer_NewCounter() => _PyOptimizer_NewCounter() * PyUnstable_Optimizer_NewUOpOptimizer() => _PyOptimizer_NewUOpOptimizer() (cherry picked from commit 9e4a81f00fef689c6e18a64245aa064eaadc7ac7)
* gh-118527: Intern code consts in free-threaded build (#118667)Sam Gross2024-05-071-0/+10
| | | | | | We already intern and immortalize most string constants. In the free-threaded build, other constants can be a source of reference count contention because they are shared by all threads running the same code objects.
* Remove more remnants of deepfreeze (#118159)Guido van Rossum2024-04-221-5/+0
|
* gh-115178: Add Counts of UOp Pairs to pystats (GH-115181)Jeff Glass2024-04-161-0/+8
|
* gh-116968: Reimplement Tier 2 counters (#117144)Guido van Rossum2024-04-041-37/+27
| | | | | | | | | | | | Introduce a unified 16-bit backoff counter type (``_Py_BackoffCounter``), shared between the Tier 1 adaptive specializer and the Tier 2 optimizer. The API used for adaptive specialization counters is changed but the behavior is (supposed to be) identical. The behavior of the Tier 2 counters is changed: - There are no longer dynamic thresholds (we never varied these). - All counters now use the same exponential backoff. - The counter for ``JUMP_BACKWARD`` starts counting down from 16. - The ``temperature`` in side exits starts counting down from 64.
* GH-115776: Embed the values array into the object, for "normal" Python ↵Mark Shannon2024-04-021-1/+4
| | | | objects. (GH-116115)
* gh-116996: Add pystats about _Py_uop_analyse_and_optimize (GH-116997)Michael Droettboom2024-03-211-0/+2
|
* gh-116381: Specialize CONTAINS_OP (GH-116385)Ken Jin2024-03-061-0/+7
| | | | | | | | | | | * Specialize CONTAINS_OP * 📜🤖 Added by blurb_it. * Add PyAPI_FUNC for JIT --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-115999: Disable the specializing adaptive interpreter in free-threaded ↵Brett Simmers2024-03-011-0/+5
| | | | | builds (#116013) For now, disable all specialization when the GIL might be disabled.
* gh-76785: Improved Subinterpreters Compatibility with 3.12 (gh-115424)Eric Snow2024-02-131-0/+9
| | | | | For the most part, these changes make is substantially easier to backport subinterpreter-related code to 3.12, especially the related modules (e.g. _xxsubinterpreters). The main motivation is to support releasing a PyPI package with the 3.13 capabilities compiled for 3.12. A lot of the changes here involve either hiding details behind macros/functions or splitting up some files.
* gh-114312: Collect stats for unlikely events (GH-114493)Michael Droettboom2024-01-251-0/+2
|
* gh-106550: Fix sign conversion in pycore_code.h (#112613)Victor Stinner2023-12-041-10/+12
| | | | Fix sign conversion in pycore_code.h: use unsigned integers and cast explicitly when needed.
* gh-111652: Fix --enable-pystats build (GH-111653)Michael Droettboom2023-11-031-0/+2
|
* gh-109329: Count tier2 opcode misses (#110561)Michael Droettboom2023-10-311-2/+2
| | | This keeps a separate 'miss' counter for each micro-opcode, incremented whenever a guard uop takes a deoptimization side exit.
* GH-109329: Add tier 2 stats (GH-109913)Michael Droettboom2023-10-041-0/+15
|
* GH-105848: Replace KW_NAMES + CALL with LOAD_CONST + CALL_KW (GH-109300)Brandt Bucher2023-09-131-1/+1
|
* GH-108716: Turn off deep-freezing of code objects. (GH-108722)Mark Shannon2023-09-081-2/+0
|
* gh-107265: Remove all ENTER_EXECUTOR when execute _Py_Instrument (gh-108539)Dong-hee Na2023-09-071-0/+3
|
* gh-108753: Enhance pystats (#108754)Victor Stinner2023-09-061-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Statistics gathering is now off by default. Use the "-X pystats" command line option or set the new PYTHONSTATS environment variable to 1 to turn statistics gathering on at Python startup. Statistics are no longer dumped at exit if statistics gathering was off or statistics have been cleared. Changes: * Add PYTHONSTATS environment variable. * sys._stats_dump() now returns False if statistics are not dumped because they are all equal to zero. * Add PyConfig._pystats member. * Add tests on sys functions and on setting PyConfig._pystats to 1. * Add Include/cpython/pystats.h and Include/internal/pycore_pystats.h header files. * Rename '_py_stats' variable to '_Py_stats'. * Exclude Include/cpython/pystats.h from the Py_LIMITED_API. * Move pystats.h include from object.h to Python.h. * Add _Py_StatsOn() and _Py_StatsOff() functions. Remove '_py_stats_struct' variable from the API: make it static in specialize.c. * Document API in Include/pystats.h and Include/cpython/pystats.h. * Complete pystats documentation in Doc/using/configure.rst. * Don't write "all zeros" stats: if _stats_off() and _stats_clear() or _stats_dump() were called. * _PyEval_Fini() now always call _Py_PrintSpecializationStats() which does nothing if stats are all zeros. Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* gh-108220: Internal header files require Py_BUILD_CORE to be defined (#108221)Victor Stinner2023-08-211-0/+4
| | | | | | | | | * pycore_intrinsics.h does nothing if included twice (add #ifndef and #define). * Update Tools/cases_generator/generate_cases.py to generate the Py_BUILD_CORE test. * _bz2, _lzma, _opcode and zlib extensions now define the Py_BUILD_CORE_MODULE macro to use internal headers (pycore_code.h, pycore_intrinsics.h and pycore_blocks_output_buffer.h).
* Add some GC stats to Py_STATS (GH-107581)Mark Shannon2023-08-041-0/+2
|
* gh-105481: the ENABLE_SPECIALIZATION flag does not need to be generated by ↵Irit Katriel2023-08-011-0/+2
| | | | the build script, or exposed in opcode.py (#107534)
* gh-107211: No longer export internal functions (4) (#107217)Victor Stinner2023-07-251-2/+1
| | | | | | | | | No longer export these 2 internal C API functions: * _PyEval_SignalAsyncExc() * _PyEval_SignalReceived() Add also comments explaining why some internal functions have to be exported, and update existing comments.
* gh-107211: No longer export internal functions (1) (#107213)Victor Stinner2023-07-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No longer export these 49 internal C API functions: * _PyArgv_AsWstrList() * _PyCode_New() * _PyCode_Validate() * _PyFloat_DebugMallocStats() * _PyFloat_FormatAdvancedWriter() * _PyImport_CheckSubinterpIncompatibleExtensionAllowed() * _PyImport_ClearExtension() * _PyImport_GetModuleId() * _PyImport_SetModuleString() * _PyInterpreterState_IDDecref() * _PyInterpreterState_IDIncref() * _PyInterpreterState_IDInitref() * _PyInterpreterState_LookUpID() * _PyWideStringList_AsList() * _PyWideStringList_CheckConsistency() * _PyWideStringList_Clear() * _PyWideStringList_Copy() * _PyWideStringList_Extend() * _Py_ClearArgcArgv() * _Py_DecodeUTF8Ex() * _Py_DecodeUTF8_surrogateescape() * _Py_EncodeLocaleRaw() * _Py_EncodeUTF8Ex() * _Py_GetEnv() * _Py_GetForceASCII() * _Py_GetLocaleEncoding() * _Py_GetLocaleEncodingObject() * _Py_GetLocaleconvNumeric() * _Py_ResetForceASCII() * _Py_device_encoding() * _Py_dg_dtoa() * _Py_dg_freedtoa() * _Py_dg_strtod() * _Py_get_blocking() * _Py_get_env_flag() * _Py_get_inheritable() * _Py_get_osfhandle_noraise() * _Py_get_xoption() * _Py_open() * _Py_open_osfhandle() * _Py_open_osfhandle_noraise() * _Py_read() * _Py_set_blocking() * _Py_str_to_int() * _Py_wfopen() * _Py_wgetcwd() * _Py_wreadlink() * _Py_wrealpath() * _Py_write()
* GH-104909: Break LOAD_GLOBAL specializations in micro-ops. (GH-106677)Mark Shannon2023-07-121-1/+1
|
* GH-106008: Make implicit boolean conversions explicit (GH-106003)Brandt Bucher2023-06-291-0/+8
|
* GH-100987: Allow objects other than code objects as the "executable" of an ↵Mark Shannon2023-06-141-13/+0
| | | | | | | | | | internal frame. (GH-105727) * Add table describing possible executable classes for out-of-process debuggers. * Remove shim code object creation code as it is no longer needed. * Make lltrace a bit more robust w.r.t. non-standard frames.
* GH-104584: Plugin optimizer API (GH-105100)Mark Shannon2023-06-021-0/+1
|
* gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization (#104270)Carl Meyer2023-05-111-5/+2
|
* gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)Carl Meyer2023-05-091-0/+1
| | | | Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-103978: avoid using 'class' as an identifier (#103979)Carl Meyer2023-04-281-1/+1
|
* gh-87729: specialize LOAD_SUPER_ATTR_METHOD (#103809)Carl Meyer2023-04-251-0/+11
|
* GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython ↵Mark Shannon2023-04-121-26/+4
| | | | | | | | | | (GH-103083) * The majority of the monitoring code is in instrumentation.c * The new instrumentation bytecodes are in bytecodes.c * legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
* GH-88691: Shrink the CALL caches (GH-103230)Brandt Bucher2023-04-051-1/+0
|
* GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)Brandt Bucher2023-03-291-2/+0
|
* GH-100982: Break up COMPARE_AND_BRANCH (GH-102801)Brandt Bucher2023-03-231-1/+1
|
* GH-90997: Shrink the LOAD_GLOBAL caches (#102569)Brandt Bucher2023-03-111-1/+1
|
* GH-87849: Simplify stack effect of SEND and specialize it for generators and ↵Mark Shannon2023-02-131-0/+7
| | | | coroutines. (GH-101788)
* GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983)Mark Shannon2023-01-161-1/+1
|
* GH-100923: Embed jump mask in `COMPARE_OP` oparg (GH-100924)Mark Shannon2023-01-111-1/+21
|
* GH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code ↵Mark Shannon2022-12-141-24/+24
| | | | unit. (GH-100223)
* GH-98522: Add version number to code objects. (GH-98525)Mark Shannon2022-12-091-0/+2
| | | | | | * Add version number to code object for better versioning of functions. * Improves specialization for closures and list comprehensions.
* GH-91054: Add code object watchers API (GH-99859)Itamar Ostricher2022-12-021-0/+2
| | | | | | * Add API to allow extensions to set callback function on creation and destruction of PyCodeObject Co-authored-by: Ye11ow-Flash <janshah@cs.stonybrook.edu>
* GH-98831: Add `macro` and `op` and their implementation to DSL (#99495)Guido van Rossum2022-11-231-0/+6
| | | | | | | | | | | | | | Newly supported interpreter definition syntax: - `op(NAME, (input_stack_effects -- output_stack_effects)) { ... }` - `macro(NAME) = OP1 + OP2;` Also some other random improvements: - Convert `WITH_EXCEPT_START` to use stack effects - Fix lexer to balk at unrecognized characters, e.g. `@` - Fix moved output names; support object pointers in cache - Introduce `error()` method to print errors - Introduce read_uint16(p) as equivalent to `*p` Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* GH-99298: Clean up attribute specializations (GH-99398)Brandt Bucher2022-11-171-3/+3
|
* GH-96421: Insert shim frame on entry to interpreter (GH-96319)Mark Shannon2022-11-101-0/+10
| | | | | | * Adds EXIT_INTERPRETER instruction to exit PyEval_EvalDefault() * Simplifies RETURN_VALUE, YIELD_VALUE and RETURN_GENERATOR instructions as they no longer need to check for entry frames.
* GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182)Brandt Bucher2022-11-091-12/+33
|
* GH-96793: Specialize FOR_ITER for generators. (GH-98772)Mark Shannon2022-11-071-1/+1
|