summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>2022-05-31 20:32:30 (GMT)
committerGitHub <noreply@github.com>2022-05-31 20:32:30 (GMT)
commitf425f3bb27e826d25aac05139360cc6aa279126e (patch)
tree221a478440fd429943409605bbf8dcaf9bb9c6ee /Python/ceval.c
parent8a5e3c2ec6254b2ce06d17545f58a6719e0c8fdb (diff)
downloadcpython-f425f3bb27e826d25aac05139360cc6aa279126e.zip
cpython-f425f3bb27e826d25aac05139360cc6aa279126e.tar.gz
cpython-f425f3bb27e826d25aac05139360cc6aa279126e.tar.bz2
gh-93143: Avoid NULL check in LOAD_FAST based on analysis in the compiler (GH-93144)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 3654692..ec86c70 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1813,7 +1813,7 @@ handle_eval_breaker:
DISPATCH();
}
- TARGET(LOAD_FAST) {
+ TARGET(LOAD_FAST_CHECK) {
PyObject *value = GETLOCAL(oparg);
if (value == NULL) {
goto unbound_local_error;
@@ -1823,6 +1823,14 @@ handle_eval_breaker:
DISPATCH();
}
+ TARGET(LOAD_FAST) {
+ PyObject *value = GETLOCAL(oparg);
+ assert(value != NULL);
+ Py_INCREF(value);
+ PUSH(value);
+ DISPATCH();
+ }
+
TARGET(LOAD_CONST) {
PREDICTED(LOAD_CONST);
PyObject *value = GETITEM(consts, oparg);
@@ -1840,17 +1848,13 @@ handle_eval_breaker:
TARGET(LOAD_FAST__LOAD_FAST) {
PyObject *value = GETLOCAL(oparg);
- if (value == NULL) {
- goto unbound_local_error;
- }
+ assert(value != NULL);
NEXTOPARG();
next_instr++;
Py_INCREF(value);
PUSH(value);
value = GETLOCAL(oparg);
- if (value == NULL) {
- goto unbound_local_error;
- }
+ assert(value != NULL);
Py_INCREF(value);
PUSH(value);
NOTRACE_DISPATCH();
@@ -1858,9 +1862,7 @@ handle_eval_breaker:
TARGET(LOAD_FAST__LOAD_CONST) {
PyObject *value = GETLOCAL(oparg);
- if (value == NULL) {
- goto unbound_local_error;
- }
+ assert(value != NULL);
NEXTOPARG();
next_instr++;
Py_INCREF(value);
@@ -1877,9 +1879,7 @@ handle_eval_breaker:
NEXTOPARG();
next_instr++;
value = GETLOCAL(oparg);
- if (value == NULL) {
- goto unbound_local_error;
- }
+ assert(value != NULL);
Py_INCREF(value);
PUSH(value);
NOTRACE_DISPATCH();
@@ -1902,9 +1902,7 @@ handle_eval_breaker:
Py_INCREF(value);
PUSH(value);
value = GETLOCAL(oparg);
- if (value == NULL) {
- goto unbound_local_error;
- }
+ assert(value != NULL);
Py_INCREF(value);
PUSH(value);
NOTRACE_DISPATCH();