Dong-hee Na
d6ac5c7b10
gh-107265: Ensure _PyCode_Quicken does not handle ENTER_EXECUTOR (gh-108460)
2023-08-24 23:03:26 +00:00
Irit Katriel
72119d16a5
gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. ( #108367 )
2023-08-23 18:39:00 +01:00
Brandt Bucher
326f0ba1c5
GH-106485: Dematerialize instance dictionaries when possible (GH-106539)
2023-08-09 19:14:50 +00:00
Brandt Bucher
a9caf9cf90
GH-105848: Simplify the arrangement of CALL's stack (GH-107788)
2023-08-09 18:19:39 +00:00
Brandt Bucher
ea72c6fe3b
GH-107596: Specialize str[int] (GH-107597)
2023-08-08 13:42:43 -07:00
Mark Shannon
2ba7c7f7b1
Add some GC stats to Py_STATS (GH-107581)
2023-08-04 10:34:23 +01:00
Victor Stinner
1a3faba9f1
gh-106869: Use new PyMemberDef constant names ( #106871 )
...
* Remove '#include "structmember.h"'.
* If needed, add <stddef.h> to get offsetof() function.
* Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
* Replace:
* T_SHORT => Py_T_SHORT
* T_INT => Py_T_INT
* T_LONG => Py_T_LONG
* T_FLOAT => Py_T_FLOAT
* T_DOUBLE => Py_T_DOUBLE
* T_STRING => Py_T_STRING
* T_OBJECT => _Py_T_OBJECT
* T_CHAR => Py_T_CHAR
* T_BYTE => Py_T_BYTE
* T_UBYTE => Py_T_UBYTE
* T_USHORT => Py_T_USHORT
* T_UINT => Py_T_UINT
* T_ULONG => Py_T_ULONG
* T_STRING_INPLACE => Py_T_STRING_INPLACE
* T_BOOL => Py_T_BOOL
* T_OBJECT_EX => Py_T_OBJECT_EX
* T_LONGLONG => Py_T_LONGLONG
* T_ULONGLONG => Py_T_ULONGLONG
* T_PYSSIZET => Py_T_PYSSIZET
* T_NONE => _Py_T_NONE
* READONLY => Py_READONLY
* PY_AUDIT_READ => Py_AUDIT_READ
* READ_RESTRICTED => Py_AUDIT_READ
* PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED
* RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
2023-07-25 15:28:30 +02:00
Victor Stinner
ee15844db8
gh-106320: Move _PyMethodWrapper_Type to internal C API ( #107064 )
2023-07-22 20:57:59 +00:00
Mark Shannon
0c90e75610
GH-100288: Specialize LOAD_ATTR for simple class attributes. ( #105990 )
...
* Add two more specializations of LOAD_ATTR.
2023-07-10 11:40:35 +01:00
Guido van Rossum
17af98227f
gh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h ( #106434 )
...
Compilation of Python/specialize.c was broken on macOS for me by gh-106400.
2023-07-04 21:42:12 +00:00
Brandt Bucher
7b2d94d875
GH-106008: Make implicit boolean conversions explicit (GH-106003)
2023-06-29 13:49:54 -07:00
Guido van Rossum
51fc725117
gh-104584: Baby steps towards generating and executing traces ( #105924 )
...
Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose).
All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.
2023-06-26 19:02:57 -07:00
Mark Shannon
04492cbc9a
GH-91095: Specialize calls to normal Python classes. (GH-99331)
2023-06-22 09:48:19 +01:00
Brandt Bucher
2beab5bdef
GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847)
2023-06-16 11:01:15 -07:00
Mark Shannon
e830289c52
GH-105229: Remove remaining two-codeunit superinstructions (GH-105326)
...
* Remove LOAD_CONST__LOAD_FAST and LOAD_FAST__LOAD_CONST superinstructions.
2023-06-08 12:35:34 +01:00
Mark Shannon
0689340366
GH-105229: Replace some superinstructions with single instruction equivalent. (GH-105230)
2023-06-05 11:07:04 +01:00
Brandt Bucher
1eb950ca55
GH-104405: Add missing PEP 523 checks (GH-104406)
2023-05-12 22:23:13 +00:00
Carl Meyer
77262458fe
gh-87729: improve hit rate of LOAD_SUPER_ATTR specialization ( #104270 )
2023-05-11 08:08:13 -06:00
penguin_wwy
373bca0cc5
GH-102181: Improve specialization stats for SEND (GH-102182)
2023-05-10 22:40:59 +00:00
Carl Meyer
afe7703744
gh-104184: fix building --with-pydebug --enable-pystats ( #104217 )
2023-05-09 08:53:19 -06:00
Mark Shannon
738c226786
GH-103082: Code cleanup in instrumentation code ( #103474 )
2023-04-29 04:51:55 +00:00
Carl Meyer
ebf97c50f2
gh-103978: avoid using 'class' as an identifier ( #103979 )
2023-04-28 19:20:50 +00:00
Jelle Zijlstra
6c4124d11a
gh-103879: Fix refleak in super specialization ( #103882 )
2023-04-26 08:50:19 -07:00
Carl Meyer
ef25febcf2
gh-87729: specialize LOAD_SUPER_ATTR_METHOD ( #103809 )
2023-04-25 17:45:51 +00:00
Mark Shannon
411b169281
GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython (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
2023-04-12 12:04:55 +01:00
Brandt Bucher
b4978ff872
GH-88691: Shrink the CALL caches (GH-103230)
2023-04-05 14:15:49 -07:00
Brandt Bucher
121057aa36
GH-89987: Shrink the BINARY_SUBSCR caches (GH-103022)
2023-03-29 15:53:30 -07:00
Brandt Bucher
0444ae2487
GH-100982: Break up COMPARE_AND_BRANCH (GH-102801)
2023-03-23 15:25:09 -07:00
Mark Shannon
7559f5fda9
GH-101291: Rearrange the size bits in PyLongObject (GH-102464)
...
* Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts.
* Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints.
* Add functions to hide some internals of long object, and for setting sign and digit count.
* Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
2023-03-22 14:49:51 +00:00
Brandt Bucher
08b67fb34f
GH-90997: Shrink the LOAD_GLOBAL caches ( #102569 )
2023-03-10 17:01:16 -08:00
Eric Snow
5e5acd291f
gh-100227: Move next_keys_version to PyInterpreterState (gh-102335)
...
https://github.com/python/cpython/issues/100227
2023-03-08 18:04:16 -07:00
Mark Shannon
7c106a443f
GH-100982: Restrict `FOR_ITER_RANGE` to a single instruction to allow instrumentation. (GH-101985)
2023-02-22 11:11:57 +00:00
Steve Dower
a99eb5cd99
gh-101907: Stop using `_Py_OPCODE` and `_Py_OPARG` macros (GH-101912)
...
* gh-101907: Removes use of non-standard C++ extension from Include/cpython/code.h
* Make cases_generator correct on Windows
2023-02-20 14:56:48 +00:00
Mark Shannon
160f2fe2b9
GH-87849: Simplify stack effect of SEND and specialize it for generators and coroutines. (GH-101788)
2023-02-13 11:24:55 +00:00
Brandt Bucher
76efcb4093
GH-100288: Skip extra work when failing to specialize LOAD_ATTR (GH-101354)
2023-01-31 13:28:32 -08:00
Mark Shannon
c1b1f51cd1
GH-101291: Refactor the `PyLongObject` struct into object header and PyLongValue struct. (GH-101292)
2023-01-30 10:03:04 +00:00
Irit Katriel
e9ccfe4a63
gh-100712: make it possible to disable specialization (for debugging) ( #100713 )
2023-01-19 18:14:55 +00:00
Mark Shannon
7b14c2ef19
GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983)
2023-01-16 12:35:21 +00:00
Mark Shannon
6e4e14d98f
GH-100923: Embed jump mask in `COMPARE_OP` oparg (GH-100924)
2023-01-11 20:40:43 +00:00
Mark Shannon
f20c553a45
GH-100288: Remove LOAD_ATTR_METHOD_WITH_DICT instruction. (GH-100753)
2023-01-05 12:20:09 +00:00
Ken Jin
36d358348d
Revert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)" ( #100468 )
...
This reverts commit c3c7848a48
.
2022-12-24 01:48:43 +08:00
Ken Jin
c3c7848a48
gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)
2022-12-24 00:26:42 +08:00
Irit Katriel
2659036c75
GH-100459: fix copy-paste errors in specialization stats (GH-100460)
2022-12-23 14:42:24 +00:00
penguin_wwy
a02161286a
GH-99770: Make the correct call specialization fail kind show up in the stats (GH-99771)
2022-12-22 12:44:59 +00:00
Dennis Sweeney
c18d831188
gh-100188: Reduce misses in BINARY_SUBSCR_(LIST/TUPLE)_INT ( #100189 )
...
Don't specialize if the index is negative.
2022-12-20 15:46:16 -05:00
Brandt Bucher
9076455d1b
GH-90043: Handle NaNs in COMPARE_OP_FLOAT_JUMP (GH-100278)
2022-12-16 10:18:31 -08:00
Mark Shannon
d4052d835b
Improve stats presentation for calls. (GH-100274)
2022-12-16 15:43:04 +00:00
Mark Shannon
289c1126dd
Better stats for `LOAD_ATTR` and `STORE_ATTR` (GH-100295)
...
* Don't attempt to specialize for LOAD_ATTR on instance if class has attribute
* Improvement to LOAD_ATTR and STORE_ATTR specialization stats.
2022-12-16 15:41:23 +00:00
Mark Shannon
48e352a241
Move stats for the method cache into the `Py_STAT` machinery (GH-100255)
2022-12-15 09:45:03 +00:00
Carl Meyer
bdd86741be
GH-100222: fix typo _py_set_opocde -> _py_set_opcode (GH-100259)
...
Typo introduced in #100223 .
Automerge-Triggered-By: GH:brandtbucher
2022-12-14 16:39:00 -08:00
Mark Shannon
5693f45b19
Assorted minor fixes for specialization stats. (GH-100219)
2022-12-14 15:50:02 +00:00
Mark Shannon
6997e77bdf
GH-100222: Redefine _Py_CODEUNIT as a union to clarify structure of code unit. (GH-100223)
2022-12-14 11:12:53 +00:00
Michael Droettboom
1583c6e326
GH-100143: Improve collecting pystats for parts of runs (GH-100144)
...
* pystats off by default
* Add -Xpystats flag
* Always dump pystats, even if turned off
2022-12-12 14:50:43 +00:00
Ken Jin
748c6c0921
GH-100110: Specialize FOR_ITER for tuples (GH-100109)
...
* Specialize FOR_ITER for tuples
2022-12-09 10:27:01 +00:00
Brandt Bucher
b629fdd88a
GH-99298: Clean up attribute specializations (GH-99398)
2022-11-17 15:09:18 -08:00
Brandt Bucher
8555dee5ae
GH-98686: Get rid of BINARY_OP_GENERIC and COMPARE_OP_GENERIC (GH-99399)
2022-11-17 11:36:57 -08:00
Brandt Bucher
9d69284169
GH-99257: Check the owner's type when specializing slots (GH-99258)
2022-11-10 11:50:34 +00:00
Brandt Bucher
c7f5708714
GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182)
2022-11-09 10:50:09 -08:00
Mark Shannon
4a1c58d504
GH-96793: Specialize FOR_ITER for generators. (GH-98772)
2022-11-07 14:49:51 +00:00
Brandt Bucher
276d77724f
GH-98686: Quicken everything (GH-98687)
2022-11-02 10:42:57 -07:00
Mark Shannon
22863df7ca
GH-96793: Change `FOR_ITER` to not pop the iterator on exhaustion. (GH-96801)
...
Change FOR_ITER to have the same stack effect regardless of whether it branches or not.
Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).
2022-10-27 11:55:03 +01:00
adphrost
a41ed975e8
GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257)
...
Co-authored-by: Andrew Frost <adfrost@fb.com>
Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
2022-09-15 16:42:37 +01:00
Brandt Bucher
b4954b1a9e
GH-90230: Fix warnings and failures with --enable-pystats (GH-96622)
2022-09-09 14:42:29 -07:00
Brandt Bucher
cd0ff9bd14
GH-93911: Fix `LOAD_ATTR_PROPERTY` caches (GH-96519)
2022-09-06 12:11:38 +01:00
Irit Katriel
4c72517cad
gh-93554: Conditional jump opcodes only jump forward (GH-96318)
2022-09-01 21:36:47 +01:00
Matthias Görgens
4a6fa89465
Remove dead code in _PyDict_GetItemHint and rename to _PyDict_LookupIndex (GH-95948)
2022-08-18 10:19:21 +01:00
Ken Jin
7276ca25f5
GH-93911: Specialize `LOAD_ATTR` for custom `__getattribute__` (GH-93988)
2022-08-17 12:37:07 +01:00
Mark Shannon
de388c0a7b
GH-95245: Store object values and dict pointers in single tagged pointer. (GH-95278)
2022-08-01 14:34:54 +01:00
Brandt Bucher
e402b26b7f
GH-95113: Don't use EXTENDED_ARG_QUICK in unquickened code (GH-95121)
2022-07-22 11:04:20 -07:00
Brandt Bucher
daf68ba92f
GH-94822: Don't specialize when metaclasses are involved (GH-94892)
2022-07-18 10:10:22 -07:00
Mark Shannon
c0453a40fa
GH-94163: Add BINARY_SLICE and STORE_SLICE instructions. (GH-94168)
2022-06-27 12:24:23 +01:00
Mark Shannon
6f8875eba3
GH-93841: Allow stats to be turned on and off, cleared and dumped at runtime. (GH-93843)
2022-06-21 15:40:54 +01:00
Dennis Sweeney
5fcfdd87c9
GH-91432: Specialize FOR_ITER (GH-91713)
...
* Adds FOR_ITER_LIST and FOR_ITER_RANGE specializations.
* Adds _PyLong_AssignValue() internal function to avoid temporary boxing of ints.
2022-06-21 11:19:26 +01:00
Christian Heimes
77c839c98f
gh-94021: Address unreachable code warning in specialize code (GH-94022)
2022-06-20 23:34:11 -07:00
Ken Jin
a51742ab82
gh-93911: Specialize `LOAD_ATTR_PROPERTY` (GH-93912)
2022-06-17 23:13:17 +08:00
Ken Jin
ab45c1dde0
Fix BINARY_SUBSCR_GETITEM stats (GH-93903)
2022-06-16 15:02:07 +01:00
Mark Shannon
6b330002b1
Rename 'LOAD_METHOD' specialization stat consts to 'ATTR'. (GH-93812)
2022-06-14 16:44:01 +01:00
Mark Shannon
ef6e44d392
Remove LOAD_METHOD stats. (GH-93807)
2022-06-14 15:03:15 +01:00
Ken Jin
b083450f88
GH-93429: Merge `LOAD_METHOD` back into `LOAD_ATTR` (GH-93430)
2022-06-14 11:36:22 +01:00
Dennis Sweeney
c5d0517ea4
Add more FOR_ITER specialization stats (GH-32151)
2022-06-13 01:40:54 -04:00
Mark Shannon
f012df706c
Shrink the LOAD_METHOD cache by one codeunit. ( #93537 )
2022-06-07 10:28:53 +01:00
Mark Shannon
eb618d5ff0
GH-93354: Use exponential backoff to avoid excessive specialization attempts. (GH-93355)
2022-05-31 11:58:26 +01:00
Mark Shannon
bbcf42449e
GH-90230: Add stats to breakdown the origin of calls to `PyEval_EvalFrame` (GH-93284)
2022-05-27 16:31:41 +01:00
Ken Jin
5e6e5b98a8
gh-92777: Add LOAD_METHOD_LAZY_DICT (GH-92778)
2022-05-25 14:06:15 +01:00
Mark Shannon
e48ac9c100
GH-90690: Remove `PRECALL` instruction (GH-92925)
2022-05-19 11:05:26 +01:00
Mark Shannon
a4460f2eb8
Split refcount stats into 'interpreter' and 'non-interpreter' (GH-92919)
2022-05-18 14:38:43 +01:00
Mark Shannon
fa2b8b75eb
Improve object stats ( #92845 )
...
* Add incref/decref stats
* Show ratios for allocation in summary
2022-05-16 14:35:11 +01:00
Mark Shannon
f8a2fab212
GH-92239: Make sure that PEP 523 is supported, even when specializing first. (GH-92245)
2022-05-04 09:31:21 -06:00
Mark Shannon
836b17c9c3
Add more stats for freelist use and allocations. (GH-92211)
2022-05-03 16:40:24 -06:00
Victor Stinner
64a54e511d
gh-91719: Add pycore_opcode.h internal header file ( #91906 )
...
Move the following API from Include/opcode.h (public C API) to a new
Include/internal/pycore_opcode.h header file (internal C API):
* EXTRA_CASES
* _PyOpcode_Caches
* _PyOpcode_Deopt
* _PyOpcode_Jump
* _PyOpcode_OpName
* _PyOpcode_RelativeJump
2022-04-26 00:14:30 +02:00
Irit Katriel
dd207a6ac5
bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative (GH-32400)
2022-04-11 10:40:24 +01:00
Dennis Sweeney
6c6e0408a6
bpo-47009: Let PRECALL_NO_KW_LIST_APPEND do its own POP_TOP (GH-32239)
2022-04-05 11:18:30 +01:00
Irit Katriel
a00518d9ad
bpo-47120: Replace the JUMP_ABSOLUTE opcode by the relative JUMP_BACKWARD (GH-32115)
2022-03-31 14:14:15 +01:00
Mark Shannon
04acfa94bb
Merge deoptimization blocks in interpreter (GH-32155)
2022-03-30 13:11:33 +01:00
Kumar Aditya
58448cbd96
bpo-47127: Specialize calls for fastcall c methods with keywords (GH-32125)
...
* add PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS
2022-03-28 03:53:25 +08:00
Dennis Sweeney
cca43b7d64
bpo-47053: Reduce deoptimization in BINARY_OP_INPLACE_ADD_UNICODE (GH-31318)
...
* Don't deopt if refcounts are too big
* Detect more at specialization time
2022-03-25 16:13:19 +00:00
Brandt Bucher
2bde6827ea
bpo-46841: Quicken code in-place (GH-31888)
...
* Moves the bytecode to the end of the corresponding PyCodeObject, and quickens it in-place.
* Removes the almost-always-unused co_varnames, co_freevars, and co_cellvars member caches
* _PyOpcode_Deopt is a new mapping from all opcodes to their un-quickened forms.
* _PyOpcode_InlineCacheEntries is renamed to _PyOpcode_Caches
* _Py_IncrementCountAndMaybeQuicken is renamed to _PyCode_Warmup
* _Py_Quicken is renamed to _PyCode_Quicken
* _co_quickened is renamed to _co_code_adaptive (and is now a read-only memoryview).
* Do not emit unused nonzero opargs anymore in the compiler.
2022-03-21 11:11:17 +00:00
Brandt Bucher
a89c29fbcc
bpo-46841: Add a _Py_SET_OPCODE macro (GH-31780)
2022-03-11 16:31:50 -08:00
Brandt Bucher
5498a61c7c
bpo-46841: Don't use an oparg counter for `STORE_SUBSCR` (GH-31742)
2022-03-08 15:53:22 +00:00
Brandt Bucher
f193631387
bpo-46841: Use inline caching for calls (GH-31709)
2022-03-07 11:45:00 -08:00
Serhiy Storchaka
6927632492
Remove trailing spaces (GH-31695)
2022-03-05 17:47:00 +02:00
Brandt Bucher
c4d2d57eef
bpo-46841: Fix BINARY_OP's handling of inline caches (GH-31671)
2022-03-04 10:51:27 -08:00
Mark Shannon
03c2a36b2b
bpo-46903: Handle str-subclasses in virtual instance dictionaries. (GH-31658)
2022-03-04 11:31:29 +00:00
Brandt Bucher
05a8bc1c94
bpo-46841: Use inline caching for attribute accesses (GH-31640)
2022-03-03 15:31:00 -08:00
Brandt Bucher
127797f572
bpo-46841: Improve the failure stats for COMPARE_OP (GH-31663)
2022-03-03 11:28:47 -08:00
Mark Shannon
b35603532b
Move check for str-only keys in LOAD_GLOBAL specializations to specialization time. (GH-31659)
2022-03-03 15:17:18 +00:00
Mark Shannon
3b0f1c5a71
bpo-46841: Use inline cache for `BINARY_SUBSCR`. (GH-31618)
2022-03-01 16:00:34 +00:00
Brandt Bucher
7820a5897e
bpo-46841: Use inline caching for `COMPARE_OP` (GH-31622)
2022-03-01 13:53:13 +00:00
Mark Shannon
4558af5a8f
bpo-46841: Move the cache for `LOAD_GLOBAL` inline. (GH-31575)
2022-02-28 12:56:29 +00:00
Brandt Bucher
424ecab494
bpo-46841: Use inline caching for `UNPACK_SEQUENCE` (GH-31591)
2022-02-28 11:54:14 +00:00
Victor Stinner
8f2a337a80
bpo-45316: Move private functions to internal C API (GH-31579)
...
Move the unexported private functions to the internal C API:
* pycore_frame.h: _PyFrame_New_NoTrack()
* pycore_function.h: _PyFunction_GetVersionForCurrentState()
* pycore_genobject.h: _PyAsyncGenValueWrapperNew()
* pycore_genobject.h: _PyCoro_GetAwaitableIter()
* pycore_genobject.h: _PyGen_yf()
2022-02-25 16:07:14 +01:00
Brandt Bucher
0f41aac109
bpo-46841: Use *inline* caching for `BINARY_OP` (GH-31543)
2022-02-25 12:11:34 +00:00
Mark Shannon
2a6ece572c
bpo-45107: Specialize `LOAD_METHOD` for instances with dict. (GH-31531)
2022-02-24 19:34:57 +00:00
Dennis Sweeney
a52d2528a4
bpo-46823: Implement LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE superinstruction (GH-31484)
2022-02-24 14:55:59 +00:00
Brandt Bucher
281ea9c391
bpo-44337: Shrink the LOAD_ATTR/STORE_ATTR caches (GH-31517)
2022-02-23 10:53:24 -08:00
Brandt Bucher
375a56bd40
bpo-45885: Don't un-adapt `COMPARE_OP` when collecting stats (GH-31516)
2022-02-23 11:06:25 +00:00
Brandt Bucher
424023efee
bpo-46329: Fix test failure when `Py_STATS` is enabled (GH-31511)
2022-02-23 11:00:28 +00:00
Mark Shannon
9058a35558
Move call specializations from CALL to PRECALL. (GH-31496)
2022-02-22 14:57:01 +00:00
Mark Shannon
cf345e945f
bpo-46329: Change calling sequence (again) (GH-31373)
...
* Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
2022-02-18 17:19:08 +00:00
Brandt Bucher
580cd9ab29
bpo-46072: Add detailed failure stats for BINARY_OP (GH-31289)
2022-02-16 08:49:58 -08:00
Brandt Bucher
a9da085015
bpo-46702: Specialize UNPACK_SEQUENCE (GH-31240)
2022-02-16 08:48:16 -08:00
Mark Shannon
0ade875ebe
Add pair counts to stats output and summary. (GH-31324)
2022-02-14 15:53:38 +00:00
Mark Shannon
15ee55528e
Include length in stats for UNPACK_SEQUENCE. (GH-31254)
2022-02-14 10:01:31 +00:00
Victor Stinner
e0bcfd0e4d
bpo-45490: Rename static inline functions (GH-31217)
...
When a static inline function is wrapped by a macro which casts its
arguments to the expected type, there is no need that the function
has a different name than the macro. Use the same name for the macro
and the function to avoid confusion.
Rename _PyUnicode_get_wstr_length() to PyUnicode_WSTR_LENGTH().
Don't rename static inline _Py_NewRef() and _Py_XNewRef() functions,
since the C API exports Py_NewRef() and Py_XNewRef() functions as
regular functions. The name cannot be reused in this case.
2022-02-11 17:01:10 +01:00
Brandt Bucher
d7a5aca982
bpo-45923: Add `RESUME_QUICK` (GH-31244)
2022-02-10 17:50:02 +00:00
Mark Shannon
1a6411f573
Gather stats for PRECALL_METHOD. (GH-31259)
2022-02-10 15:55:52 +00:00
Mark Shannon
b0662ae5c8
Add stats for PRECALL_FUNCTION. (GH-31250)
2022-02-10 11:47:52 +00:00
Mark Shannon
f71a69aa92
bpo-46072: Output stats as markdown with collapsible sections. (GH-31228)
2022-02-09 12:30:26 +00:00
Eric Snow
81c72044a1
bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized global objects. (gh-30928)
...
We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules.
The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings).
https://bugs.python.org/issue46541#msg411799 explains the rationale for this change.
The core of the change is in:
* (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros
* Include/internal/pycore_runtime_init.h - added the static initializers for the global strings
* Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState
* Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers
I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config.
The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *.
The following are not changed (yet):
* stop using _Py_IDENTIFIER() in the stdlib modules
* (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API
* (maybe) intern the strings during runtime init
https://bugs.python.org/issue46541
2022-02-08 13:39:07 -07:00
Mark Shannon
062460e8fd
bpo-46072: Improve LOAD_METHOD stats (GH-31104)
2022-02-07 14:30:34 +00:00
Mark Shannon
832876b992
Add miss stats for specialized instructions. (GH-31108)
2022-02-04 09:56:46 +00:00
Mark Shannon
a0401d8372
Collect stats for UNPACK_SEQUENCE. (GH-31105)
2022-02-03 18:40:56 +00:00
Dennis Sweeney
674ab66ebd
bpo-45885: Add more stats for COMPARE_OP in specialize.c (GH-31040)
2022-02-03 13:32:52 +00:00
Mark Shannon
0d05da1fbf
Add specialization stats for FOR_ITER. (GH-31079)
2022-02-02 15:56:47 +00:00
Mark Shannon
187930f74c
bpo-46072: Add some frame stats. (GH-31060)
2022-02-02 11:01:33 +00:00
Mark Shannon
48be46ec1f
bpo-46072: Add some object layout and allocation stats (GH-31051)
2022-02-01 15:05:18 +00:00
Mark Shannon
90ab138bbd
bpo-46072: Add simple stats for Python calls. (GH-30989)
2022-01-28 15:20:33 +00:00
Mark Shannon
89fd7c3452
bpo-46329: Split calls into precall and call instructions. (GH-30855)
...
* Add PRECALL_FUNCTION opcode.
* Move 'call shape' varaibles into struct.
* Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions.
* Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol.
* Allow kwnames for specialized calls to builtin types.
* Specialize calls to tuple(arg) and str(arg).
2022-01-28 12:42:30 +00:00
Kumar Aditya
d1beb241d9
bpo-46486: Fixed misspelled name DesciptorClassification
2022-01-23 16:03:50 -06:00
Victor Stinner
7835cbf949
bpo-46417: Use _PyType_CAST() in Python directory (GH-30769)
2022-01-21 23:30:17 +01:00
Mark Shannon
b04dfbbe4b
bpo-46409: Make generators in bytecode (GH-30633)
...
* Add RETURN_GENERATOR and JUMP_NO_INTERRUPT opcodes.
* Trim frame and generator by word each.
* Minor refactor of frame.c
* Update test.test_sys to account for smaller frames.
* Treat generator functions as normal functions when evaluating and specializing.
2022-01-20 11:46:39 +00:00
Kumar Aditya
a4bc2218d2
bpo-46405: fix msvc compiler warnings (GH-30627)
2022-01-17 16:30:10 +00:00
Dennis Sweeney
7537f60087
bpo-45609: More specialization stats for STORE_SUBSCR (GH-30193)
2022-01-04 18:05:09 +00:00
Mark Shannon
efd6236d36
bpo-46072: Add top level stats struct (GH-30169)
2021-12-17 14:48:01 +00:00
Mark Shannon
86f42851c0
Better randomization of stats filenames. (GH-30145)
2021-12-16 15:56:01 +00:00
Brandt Bucher
62a8a0c522
bpo-45829: Check `__getitem__`'s version for overflow before specializing (GH-30129)
...
* Check __getitem__'s version for overflow.
* Use SPEC_FAIL_OUT_OF_VERSIONS instead
2021-12-16 11:08:20 +00:00
Mark Shannon
342b93f9f2
bpo-46072: Add --with-pystats configure option to simplify gathering of VM stats (GH-30116)
...
* Simplify specialization stats collection macros.
* Add --enable-pystats option to configure.
* Update specialization summary script to handle larger number of kinds
2021-12-15 15:32:32 +00:00
Mark Shannon
3a60bfef49
bpo-44525: Specialize for calls to type and other builtin classes with 1 argument. (GH-29942)
2021-12-15 15:03:42 +00:00
Mark Shannon
9f8f45144b
bpo-44525: Split calls into PRECALL and CALL (GH-30011)
...
* Add 3 new opcodes for calls: PRECALL_METHOD, CALL_NO_KW, CALL_KW.
* Update specialization to handle new CALL opcodes.
* Specialize call to method descriptors.
* Remove old CALL opcodes: CALL_FUNCTION, CALL_METHOD, CALL_METHOD_KW, CALL_FUNCTION_KW.
2021-12-14 18:22:44 +00:00
Brandt Bucher
5de39f4b41
bpo-45510: Check both types when specializing subtraction (GH-29995)
2021-12-09 10:17:16 +09:00