Commit Graph

7434 Commits

Author SHA1 Message Date
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
Victor Stinner f0bc694856
bpo-47164: Add _PyCFunction_CAST() macro (GH-32192)
Use the macro in C files of the Python/ directory.
2022-03-31 10:02:34 +02:00
Victor Stinner c14d7e4b81
bpo-47164: Add _PyASCIIObject_CAST() macro (GH-32191)
Add macros to cast objects to PyASCIIObject*, PyCompactUnicodeObject*
and PyUnicodeObject*: _PyASCIIObject_CAST(),
_PyCompactUnicodeObject_CAST() and _PyUnicodeObject_CAST(). Using
these new macros make the code more readable and check their argument
with: assert(PyUnicode_Check(op)).

Remove redundant assert(PyUnicode_Check(op)) in macros using directly
or indirectly these new CAST macros.

Replacing existing casts with these macros.
2022-03-31 09:59:27 +02:00
Christian Heimes 581c4434de
bpo-47162: Add call trampoline to mitigate bad fpcasts on Emscripten (GH-32189) 2022-03-30 12:28:33 -07:00
Mark Shannon 04acfa94bb
Merge deoptimization blocks in interpreter (GH-32155) 2022-03-30 13:11:33 +01:00
Christian Heimes d8f530fe32
bpo-46864: Suppress even more ob_shash deprecation warnings (GH-32176) 2022-03-30 08:35:15 +02:00
Dennis Sweeney 788154919c
bpo-47053: Refactor BINARY_OP_INPLACE_ADD_UNICODE (GH-32122) 2022-03-28 22:07:05 -04: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
Matthew Rahtz e8e737bcf6
bpo-43224: Implement PEP 646 grammar changes (GH-31018)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-26 09:55:35 -07: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
Mark Shannon d7163bb35d
bpo-42197: Don't create `f_locals` dictionary unless we actually need it. (GH-32055)
* `PyFrame_FastToLocalsWithError` and `PyFrame_LocalsToFast` are no longer called during profile and tracing.
 (Contributed by Fabio Zadrozny)

* Make accesses to a frame's `f_locals` safe from C code, not relying on calls to `PyFrame_FastToLocals` or `PyFrame_LocalsToFast`.

* Document new `PyFrame_GetLocals` C-API function.
2022-03-25 12:57:50 +00:00
Irit Katriel 2f49b97cc5
bpo-46841: remove no-longer-used macro UPDATE_PREV_INSTR_OPARG (GH-32100) 2022-03-24 18:54:35 +00:00
Inada Naoki 894d0ea5af
bpo-46864: Suppress deprecation warnings for ob_shash. (GH-32042) 2022-03-23 17:11:22 +09:00
neonene cd05d0a423
bpo-43166: Disable ceval.c optimizations for Windows debug builds (GH-32023)
Also increases the stack allocation when run with `python_d.exe` to account for the extra stack checks that are added.
2022-03-23 00:35:25 +00:00
Mark Shannon 49daf6dba8
bpo-47045: Remove `f_state` field (GH-31963)
* Remove the f_state field from _PyInterpreterFrame

*  Make ownership of the frame explicit, replacing the is_generator field with an owner field.
2022-03-22 12:57: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
Victor Stinner e63894b3ee
bpo-46850: Remove _PyEval_CallTracing() function (GH-32019)
Remove the private undocumented function _PyEval_CallTracing() from
the C API. Call the public sys.call_tracing() function instead.
2022-03-21 03:03:22 +01:00
Victor Stinner 9087243e2c
bpo-46850: Remove _PyEval_GetCoroutineOriginTrackingDepth() (GH-32018)
Remove the private undocumented function
_PyEval_GetCoroutineOriginTrackingDepth() from the C API. Call the
public sys.get_coroutine_origin_tracking_depth() function instead.

Change the internal function
_PyEval_SetCoroutineOriginTrackingDepth():

* Remove the 'tstate' parameter;
* Add return value and raises an exception if depth is negative;
* No longer export the function: call the public
  sys.set_coroutine_origin_tracking_depth() function instead.

Uniformize also function declarations in pycore_ceval.h.
2022-03-21 02:24:00 +01:00
Victor Stinner 332b04bac3
bpo-46850: Remove _PyEval_SetAsyncGenFinalizer() (GH-32017)
Remove the following private undocumented functions from the C API:

* _PyEval_GetAsyncGenFirstiter()
* _PyEval_GetAsyncGenFinalizer()
* _PyEval_SetAsyncGenFirstiter()
* _PyEval_SetAsyncGenFinalizer()

Call the public sys.get_asyncgen_hooks() and sys.set_asyncgen_hooks()
functions instead.
2022-03-21 01:15:32 +01:00
Victor Stinner 2217462bda
bpo-45786: Remove _PyFrame_Fini() and _PyFrame_DebugMallocStats() (GH-31874)
Remove private empty _PyFrame_Fini() and _PyFrame_DebugMallocStats()
functions.
2022-03-18 11:16:55 +01:00
Mark Shannon 3011a097bd
Use low bit of LOAD_GLOBAL's oparg to indicate whether it should push an additional NULL. (GH-31933) 2022-03-17 16:14:57 +00:00
Mark Shannon 49e1e1e1bd
bpo-46841: Don't scan backwards in bytecode (GH-31901) 2022-03-15 17:08:37 -07:00
Mark Shannon 099f756141
bpo-45923: Decouple suspension of tracing from tracing flag. (GH-31908) 2022-03-15 17:06:21 +00:00
Oleg Iarygin 13b0412223
bpo-46920: Remove code that has explainers why it was disabled (GH-31813) 2022-03-14 17:04:22 +01:00
Oleg Iarygin a52f82baf2
bpo-46920: Remove disabled debug code added decades ago and likely unnecessary (GH-31812) 2022-03-14 17:03:21 +01:00
Dong-hee Na bb1c543f4a
bpo-46987: Remove _PySys_GetObjectId / _PySys_GetObjectId (GH-31835) 2022-03-14 21:48:00 +09:00
Brandt Bucher a89c29fbcc
bpo-46841: Add a _Py_SET_OPCODE macro (GH-31780) 2022-03-11 16:31:50 -08:00
Victor Stinner 882d8096c2
bpo-46906: Add PyFloat_Pack8() to the C API (GH-31657)
Add new functions to pack and unpack C double (serialize and
deserialize):

* PyFloat_Pack2(), PyFloat_Pack4(), PyFloat_Pack8()
* PyFloat_Unpack2(), PyFloat_Unpack4(), PyFloat_Unpack8()

Document these functions and add unit tests.

Rename private functions and move them from the internal C API
to the public C API:

* _PyFloat_Pack2() => PyFloat_Pack2()
* _PyFloat_Pack4() => PyFloat_Pack4()
* _PyFloat_Pack8() => PyFloat_Pack8()
* _PyFloat_Unpack2() => PyFloat_Unpack2()
* _PyFloat_Unpack4() => PyFloat_Unpack4()
* _PyFloat_Unpack8() => PyFloat_Unpack8()

Replace the "unsigned char*" type with "char*" which is more common
and easy to use.
2022-03-12 00:10:02 +01:00
Kumar Aditya 6f3b9e2243
Use FASTCALL for __import__ (GH-31752) 2022-03-11 18:46:55 +02:00
Mark Shannon 4f74ffc5e3
Update adaptive.md for inline caching (GH-31817) 2022-03-11 14:29:10 +00: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
Taneli Hukkinen 591f6754b5
bpo-40059: Add tomllib (PEP-680) (GH-31498)
This adds a new standard library module, `tomllib`, for parsing TOML.

The implementation is based on Tomli (https://github.com/hukkin/tomli).

## Steps taken (converting `tomli` to `tomllib`)

- Move everything in `tomli:src/tomli` to `Lib/tomllib`. Exclude `py.typed`.
- Remove `__version__ = ...` line from `Lib/tomllib/__init__.py`
- Move everything in `tomli:tests` to `Lib/test/test_tomllib`. Exclude the following test data dirs recursively:
  - `tomli:tests/data/invalid/_external/`
  - `tomli:tests/data/valid/_external/`
- Create `Lib/test/test_tomllib/__main__.py`:

  ```python
  import unittest

  from . import load_tests


  unittest.main()
  ```


- Add the following to `Lib/test/test_tomllib/__init__.py`:

  ```python
  import os
  from test.support import load_package_tests

  def load_tests(*args):
      return load_package_tests(os.path.dirname(__file__), *args)
  ```

  Also change `import tomli as tomllib` to `import tomllib`.

- In `cpython/Lib/tomllib/_parser.py` replace `__fp` with `fp` and `__s` with
  `s`. Add the `/` to `load` and `loads` function signatures.

- Run `make regen-stdlib-module-names`

- Create `Doc/library/tomllib.rst` and reference it in `Doc/library/fileformats.rst`
2022-03-08 09:26:13 +01:00
Brandt Bucher f193631387
bpo-46841: Use inline caching for calls (GH-31709) 2022-03-07 11:45:00 -08:00
Pablo Galindo Salgado 3b3be05a16
bpo-46940: Don't override existing AttributeError suggestion information (GH-31710)
When an exception is created in a nested call to PyObject_GetAttr, any
external calls will override the context information of the
AttributeError that we have already placed in the most internal call.
This will cause the suggestions we create to nor work properly as the
attribute name and object that we will be using are the incorrect ones.

To avoid this, we need to check first if these attributes are already
set and bail out if that's the case.
2022-03-07 12:23:11 +00: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
Brandt Bucher 586b24d3be
bpo-46841: Fix error message hacks in `GET_AWAITABLE` (GH-31664) 2022-03-04 12:41:17 +00: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
Shantanu 81d968b7c3
bpo-46831: Update __build_class__ comment (#31522)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-02 21:32:57 -08:00
Inada Naoki 9833bb91e4
bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09: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
Inada Naoki df9f759755
compiler: Merge except_table and cnotab (GH-31614) 2022-03-01 10:27:20 +09:00
Eric Snow 08deed1af5
bpo-46753: Add the empty tuple to the _PyRuntimeState.global_objects. (gh-31345)
https://bugs.python.org/issue46753
2022-02-28 15:15:48 -07:00
Victor Stinner 7496f95873
bpo-45431: Rename CFrame to _PyCFrame in the C API (GH-31584)
Rename also struct _cframe to struct _PyCFrame.

Add a comment suggesting using public functions rather than using
directly the private _PyCFrame structure.
2022-02-28 16:03:57 +01: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
Kumar Aditya 0d9b565e62
Propagate errors (however unlikely) from _Py_Deepfreeze_Init() (GH-31596) 2022-02-26 08:35:03 -08:00
Oleg Iarygin 4060111f9d
bpo-46816: Remove declarations for non-__STDC__ compilers (GH-31466)
After Python switched to C11, there is a guarantee that every compiler
conforms to ISO C so checks of __STDC__ have no sense.
2022-02-26 00:16:59 +01:00
Victor Stinner 87af12bff3
bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame (GH-31583)
Rename also struct _interpreter_frame to struct _PyInterpreterFrame.

Reduce risk of name conflicts if a project includes pycore_frame.h.
2022-02-25 16:22:00 +01:00
Victor Stinner f780d9690f
bpo-45316: Move _PyArg_Fini() to internal C API (GH-31580)
Move the private unexported _PyArg_Fini() function to the internal C
API: to the pycore_pylifecycle.h header file.
2022-02-25 16:19:30 +01: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
Irit Katriel c579243eb6
bpo-46808: remove NEXT_BLOCK() from compile.c (GH-31448) 2022-02-25 12:17:50 +00:00
Brandt Bucher 0f41aac109
bpo-46841: Use *inline* caching for `BINARY_OP` (GH-31543) 2022-02-25 12:11:34 +00:00
Petr Viktorin 2c228a7b8f
bpo-46748: Don't import <stdbool.h> in public headers (GH-31553)
<stdbool.h> is the standard/modern way to define embedd/extends Python free to define bool, true and false, but there are existing applications that use slightly different redefinitions, which fail if the header is included.

It's OK to use stdbool outside the public headers, though.

https://bugs.python.org/issue46748
2022-02-25 09:25:54 +01:00
Victor Stinner 1b2611eb02
bpo-46656: Remove Py_NO_NAN macro (GH-31160)
Building Python now requires support for floating point Not-a-Number
(NaN): remove the Py_NO_NAN macro.
2022-02-25 01:32:57 +01:00
Mark Shannon 2a6ece572c
bpo-45107: Specialize `LOAD_METHOD` for instances with dict. (GH-31531) 2022-02-24 19:34:57 +00:00
Kumar Aditya 4dc746310b
bpo-46430: Fix memory leak in interned strings of deep-frozen modules (GH-31549) 2022-02-24 17:54:06 +01:00
Victor Stinner 042f31da55
bpo-45459: C API uses type names rather than structure names (GH-31528)
Thanks to the new pytypedefs.h, it becomes to use type names like
PyObject rather like structure names like "struct _object".
2022-02-24 17:51:59 +01: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
Victor Stinner 9bbdde2180
bpo-45412: Add _PY_SHORT_FLOAT_REPR macro (GH-31171)
Remove the HAVE_PY_SET_53BIT_PRECISION macro (moved to the internal
C API).

* Move HAVE_PY_SET_53BIT_PRECISION macro to pycore_pymath.h.
* Replace PY_NO_SHORT_FLOAT_REPR macro with _PY_SHORT_FLOAT_REPR
  macro which is always defined. gcc -Wundef emits a warning when
  using _PY_SHORT_FLOAT_REPR but the macro is not defined, if
  pycore_pymath.h include was forgotten.
2022-02-23 18:16:23 +01: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
Eric Snow 1f455361ec
bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects (gh-31366)
https://bugs.python.org/issue46765
2022-02-22 17:23:51 -07:00
Mark Shannon 09487c11a5
Fix reporting of specialization stats. (GH-31503) 2022-02-22 17:18:10 +00:00
Mark Shannon 9058a35558
Move call specializations from CALL to PRECALL. (GH-31496) 2022-02-22 14:57:01 +00:00
Mark Shannon 59585d6b2e
bpo-46329: Streamline calling sequence a bit. (GH-31465)
* Move handling of bound-methods to PRECALL.

* Remove call_shape.postcall_shrink

* Remove call_shape.callable

* Remove call_shape.callable. Change CALL oparg to match PRECALL oparg.

* Move KW_NAMES before PRECALL.

* Update opcode docs in dis.rst
2022-02-21 18:26:47 +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
Nikita Sobolev e2c28616ce
bpo-46709: check eval breaker in specialized `CALL` opcodes (GH-31404) 2022-02-18 12:56:23 +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 3be1a443ca
bpo-46724: Use `JUMP_ABSOLUTE` for all backward jumps. (GH-31326)
* Make sure all backward jumps use JUMP_ABSOLUTE.

* Add news.

* Fix up news item.

* Make test use consistent style.
2022-02-15 09:35:16 +00:00
Eric Snow 12360aa159
bpo-46541: Discover the global strings. (gh-31346)
Instead of manually enumerating the global strings in generate_global_objects.py, we extrapolate the list from usage of _Py_ID() and _Py_STR() in the source files.

This is partly inspired by gh-31261.

https://bugs.python.org/issue46541
2022-02-14 17:36:51 -07:00
Brandt Bucher 3b799d7448
Remove unnecessary basic block from comprehensions (GH-31263) 2022-02-14 17:48:45 +00: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
Petr Viktorin 204946986f
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
* Make PyType_GetModuleByDef public (remove underscore)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-02-11 17:22:11 +01: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 2cea8c29cf
bpo-46532: Reduce number of memory writes to update call_shape.kwnames. (GH-31231) 2022-02-10 12:57:55 +00:00
Mark Shannon 4f21d528f0
Fix sys.getdxp() when configured with --enable-pystats. (GH-31251) 2022-02-10 12:14:57 +00:00
Mark Shannon b0662ae5c8
Add stats for PRECALL_FUNCTION. (GH-31250) 2022-02-10 11:47:52 +00:00
Brandt Bucher 78ae4cc6dc
bpo-46528: Attempt SWAPs at compile-time (GH-30970) 2022-02-09 15:15:36 -08:00
Brandt Bucher 46328d8ae6
bpo-46528: Check PyMem_Malloc for NULL (GH-30998) 2022-02-09 11:31:01 -08: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 25db2b361b
bpo-46675: Allow object value arrays and split key dictionaries larger than 16 (GH-31191) 2022-02-08 11:50:38 +00:00
Mark Shannon 9c979d7afd
bpo-46072: Merge dxpairs into py_stats. (GH-31197) 2022-02-07 16:51:43 +00:00
Victor Stinner 7d8b69e1d1
bpo-46670: Remove unused macros in the Python directory (GH-31192) 2022-02-07 16:21:52 +01:00
Victor Stinner 4b603f6282
bpo-46670: Remove unused macros in ceval.c (GH-31196)
Remove CHECKEXC() and EXT_POP() macros.
2022-02-07 15:06:27 +00:00
Mark Shannon 062460e8fd
bpo-46072: Improve LOAD_METHOD stats (GH-31104) 2022-02-07 14:30:34 +00:00
Victor Stinner b556f53785
bpo-46670: Test if a macro is defined, not its value (GH-31178)
* audioop.c: #ifdef WORDS_BIGENDIAN
* ctypes.h: #ifdef USING_MALLOC_CLOSURE_DOT_C
* _ctypes/malloc_closure.c: #ifdef HAVE_FFI_CLOSURE_ALLOC
  and #ifdef USING_APPLE_OS_LIBFFI
* pytime.c: #ifdef __APPLE__
* unicodeobject.c: #ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
2022-02-07 01:46:51 +01:00
Kumar Aditya bf95ff91f2
bpo-46608: exclude marshalled-frozen data if deep-freezing to save 300 KB space (GH-31074)
This reduces the size of the data segment by **300 KB** of the executable because if the modules are deep-frozen then the marshalled frozen data just wastes space. This was inspired by comment by @gvanrossum in https://github.com/python/cpython/pull/29118#issuecomment-958521863. Note: There is a new option `--deepfreeze-only` in `freeze_modules.py` to change this behavior, it is on be default to save disk space.
```console 
# du -s ./python before
27892   ./python
# du -s ./python after
27524   ./python
```

Automerge-Triggered-By: GH:ericsnowcurrently
2022-02-04 09:57:03 -08: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