On 19/04/17 00:08, Gregory Ewing wrote:
Erik wrote:
When considering special-casing this opcode sequence, remember that
in-place operations can be performed on anonymous objects (i.e., those
referenced by a collection and not bound directly to a namespace):
I think this means you would want multiple versions of the +=1 opcode:
ADD_ONE_TO_NAME, ADD_ONE_TO_ITEM, ADD_ONE_TO_ATTR, etc. Essentially
one for each variant of the STORE operation.
Yes, I get that ;) That's what I meant by a "set of opcodes" - some of
which know that there's an implicit ROT3 to do. Perhaps in some other
circumstances there's a ROT3 and another op before the STORE. Or perhaps
three other ops ...
I'm just pointing out that concentrating on folding a very specific
sequence of opcodes that you happen to see in your test code disassembly
does not necessarily scale well.
Why just INPLACE_ADD? For each variant of each type of STORE operation
(we know there are at least two), you also might want to have MULTIPLY,
SUBTRACT, DIVIDE, BIT_OR, BIT_AND, SHIFT_LEFT, SHIFT_RIGHT, EXP and
MODULO versions ... (have I forgotten any?)
E.
--
https://mail.python.org/mailman/listinfo/python-list