Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ae9140f

Browse filesBrowse files
authored
gh-119676: remove several pseudo instructions which are use only in codegen (#119677)
1 parent 6b240c2 commit ae9140f
Copy full SHA for ae9140f

File tree

Expand file treeCollapse file tree

5 files changed

+23
-71
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+23
-71
lines changed

‎Include/internal/pycore_opcode_metadata.h

Copy file name to clipboardExpand all lines: Include/internal/pycore_opcode_metadata.h
+8-24Lines changed: 8 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Include/opcode_ids.h

Copy file name to clipboardExpand all lines: Include/opcode_ids.h
+5-9Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Lib/_opcode_metadata.py

Copy file name to clipboardExpand all lines: Lib/_opcode_metadata.py
+5-9Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Python/bytecodes.c

Copy file name to clipboardExpand all lines: Python/bytecodes.c
-16Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,18 +1812,6 @@ dummy_func(
18121812

18131813
macro(LOAD_SUPER_ATTR) = _SPECIALIZE_LOAD_SUPER_ATTR + _LOAD_SUPER_ATTR;
18141814

1815-
pseudo(LOAD_SUPER_METHOD) = {
1816-
LOAD_SUPER_ATTR,
1817-
};
1818-
1819-
pseudo(LOAD_ZERO_SUPER_METHOD) = {
1820-
LOAD_SUPER_ATTR,
1821-
};
1822-
1823-
pseudo(LOAD_ZERO_SUPER_ATTR) = {
1824-
LOAD_SUPER_ATTR,
1825-
};
1826-
18271815
inst(LOAD_SUPER_ATTR_ATTR, (unused/1, global_super, class, self -- attr, unused if (0))) {
18281816
assert(!(oparg & 1));
18291817
DEOPT_IF(global_super != (PyObject *)&PySuper_Type);
@@ -1925,10 +1913,6 @@ dummy_func(
19251913
unused/8 +
19261914
_LOAD_ATTR;
19271915

1928-
pseudo(LOAD_METHOD) = {
1929-
LOAD_ATTR,
1930-
};
1931-
19321916
op(_GUARD_TYPE_VERSION, (type_version/2, owner -- owner)) {
19331917
PyTypeObject *tp = Py_TYPE(owner);
19341918
assert(type_version != 0);

‎Python/compile.c

Copy file name to clipboardExpand all lines: Python/compile.c
+5-13Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,6 @@ stack_effect(int opcode, int oparg, int jump)
723723
case JUMP_NO_INTERRUPT:
724724
return 0;
725725

726-
case EXIT_INIT_CHECK:
727-
return -1;
728-
729726
/* Exception handling pseudo-instructions */
730727
case SETUP_FINALLY:
731728
/* 0 in the normal flow.
@@ -746,12 +743,6 @@ stack_effect(int opcode, int oparg, int jump)
746743
return -1;
747744
case LOAD_CLOSURE:
748745
return 1;
749-
case LOAD_METHOD:
750-
return 1;
751-
case LOAD_SUPER_METHOD:
752-
case LOAD_ZERO_SUPER_METHOD:
753-
case LOAD_ZERO_SUPER_ATTR:
754-
return -1;
755746
default:
756747
return PY_INVALID_STACK_EFFECT;
757748
}
@@ -997,6 +988,11 @@ compiler_addop_o(struct compiler_unit *u, location loc,
997988
return codegen_addop_i(u->u_instr_sequence, opcode, arg, loc);
998989
}
999990

991+
#define LOAD_METHOD -1
992+
#define LOAD_SUPER_METHOD -2
993+
#define LOAD_ZERO_SUPER_ATTR -3
994+
#define LOAD_ZERO_SUPER_METHOD -4
995+
1000996
static int
1001997
compiler_addop_name(struct compiler_unit *u, location loc,
1002998
int opcode, PyObject *dict, PyObject *o)
@@ -1014,7 +1010,6 @@ compiler_addop_name(struct compiler_unit *u, location loc,
10141010
arg <<= 1;
10151011
}
10161012
if (opcode == LOAD_METHOD) {
1017-
assert(is_pseudo_target(LOAD_METHOD, LOAD_ATTR));
10181013
opcode = LOAD_ATTR;
10191014
arg <<= 1;
10201015
arg |= 1;
@@ -1024,18 +1019,15 @@ compiler_addop_name(struct compiler_unit *u, location loc,
10241019
arg |= 2;
10251020
}
10261021
if (opcode == LOAD_SUPER_METHOD) {
1027-
assert(is_pseudo_target(LOAD_SUPER_METHOD, LOAD_SUPER_ATTR));
10281022
opcode = LOAD_SUPER_ATTR;
10291023
arg <<= 2;
10301024
arg |= 3;
10311025
}
10321026
if (opcode == LOAD_ZERO_SUPER_ATTR) {
1033-
assert(is_pseudo_target(LOAD_ZERO_SUPER_ATTR, LOAD_SUPER_ATTR));
10341027
opcode = LOAD_SUPER_ATTR;
10351028
arg <<= 2;
10361029
}
10371030
if (opcode == LOAD_ZERO_SUPER_METHOD) {
1038-
assert(is_pseudo_target(LOAD_ZERO_SUPER_METHOD, LOAD_SUPER_ATTR));
10391031
opcode = LOAD_SUPER_ATTR;
10401032
arg <<= 2;
10411033
arg |= 1;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.