This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Simplify compiling to BUILD_MAP_UNPACK
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Joshua.Landau, NeilGirdhar, benjamin.peterson, brett.cannon, georg.brandl, ncoghlan, python-dev, serhiy.storchaka, yselivanov
Priority: normal Keywords: patch

Created on 2016-11-28 16:45 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
BUILD_MAP_UNPACK-unlimited-arg.patch serhiy.storchaka, 2016-11-28 16:45 review
Messages (4)
msg281885 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-28 16:45
Currently the compiler produces BUILD_MAP_UNPACK with an argument at most 255. If needed to merge more than 255 dictionaries, BUILD_MAP_UNPACK is called several times. But this is unneeded complication since BUILD_MAP_UNPACK doesn't have a limitation on its argument. Seems this code is the remnants from the patches when there was not the opcode BUILD_MAP_UNPACK_WITH_CALL, and BUILD_MAP_UNPACK packed the position of function name in higher bits of its argument.

Proposed patch simplifies the compiler, makes the bytecode faster if merge more than 255 dictionaries and more compact if merge more than 509 dictionaries.

BUILD_MAP_UNPACK was introduced in issue2292.
msg281887 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-11-28 16:48
While I don't think that merging more than 256 dicts is a common task, the code does become much simpler.  LGTM.
msg281907 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-28 18:56
New changeset 9ded2433dc2c by Serhiy Storchaka in branch 'default':
Issue #28823: Simplified compiling with opcode BUILD_MAP_UNPACK.
https://hg.python.org/cpython/rev/9ded2433dc2c
msg281908 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-28 18:58
Thanks Yury. Simplifying the code was the main purpose.
History
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 73009
2016-11-28 18:58:12serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg281908

stage: patch review -> resolved
2016-11-28 18:56:54python-devsetnosy: + python-dev
messages: + msg281907
2016-11-28 16:48:25yselivanovsetmessages: + msg281887
2016-11-28 16:45:09serhiy.storchakacreate