mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-98831: Finish the UNPACK_SEQUENCE family (#101666)
New generator feature: Generate useful glue for output arrays, so you can just write values to the output array (no bounds checking). Rewrote UNPACK_SEQUENCE_TWO_TUPLE to use this, and also UNPACK_SEQUENCE_{TUPLE,LIST}.
This commit is contained in:
parent
753fc8a5d6
commit
aacbdb0c65
5 changed files with 72 additions and 63 deletions
|
@ -127,9 +127,9 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
|
|||
case UNPACK_SEQUENCE_TWO_TUPLE:
|
||||
return 1;
|
||||
case UNPACK_SEQUENCE_TUPLE:
|
||||
return -1;
|
||||
return 1;
|
||||
case UNPACK_SEQUENCE_LIST:
|
||||
return -1;
|
||||
return 1;
|
||||
case UNPACK_EX:
|
||||
return 1;
|
||||
case STORE_ATTR:
|
||||
|
@ -473,11 +473,11 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
|
|||
case UNPACK_SEQUENCE:
|
||||
return oparg;
|
||||
case UNPACK_SEQUENCE_TWO_TUPLE:
|
||||
return 2;
|
||||
return oparg;
|
||||
case UNPACK_SEQUENCE_TUPLE:
|
||||
return -1;
|
||||
return oparg;
|
||||
case UNPACK_SEQUENCE_LIST:
|
||||
return -1;
|
||||
return oparg;
|
||||
case UNPACK_EX:
|
||||
return (oparg & 0xFF) + (oparg >> 8) + 1;
|
||||
case STORE_ATTR:
|
||||
|
@ -765,9 +765,9 @@ struct opcode_metadata {
|
|||
[STORE_NAME] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
|
||||
[DELETE_NAME] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
|
||||
[UNPACK_SEQUENCE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
|
||||
[UNPACK_SEQUENCE_TWO_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IXC },
|
||||
[UNPACK_SEQUENCE_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
|
||||
[UNPACK_SEQUENCE_LIST] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
|
||||
[UNPACK_SEQUENCE_TWO_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
|
||||
[UNPACK_SEQUENCE_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
|
||||
[UNPACK_SEQUENCE_LIST] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
|
||||
[UNPACK_EX] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
|
||||
[STORE_ATTR] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC000 },
|
||||
[DELETE_ATTR] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue