Demur Rumed added the comment:

Perhaps BUILD_CONST_KEY_MAP?

Ideally the opcode could ellide the LOAD_CONST for the tuple. ie have 
LOAD_CONST 2 (1, 2, 3), BUILD_CONST_KEY_MAP 3 be BUILD_CONST_KEY_MAP 2 (1, 2, 
3). However that'd require stack_effect to somehow lookup the const tuple

Thinking to in the context of MAKE_FUNCTION, I'd like to create a function for 
ceval which takes stack_pointer & returns stack_pointer at new offset with dict 
at top of stack. Then use this both for this opcode & have MAKE_FUNCTION call 
it directly (ie, don't have to emit BUILD_MAP_EX). This too makes for a need to 
do some backtracking to figure out stack effect

Relying on the peepholer seems unideal; it does more work than generating the 
tuple the first time & doing it eagerly will produce a more compact stack depth 
& co_consts

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27140>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to