gh-93143: Avoid NULL check in LOAD_FAST based on analysis in the compiler (GH-93144)

This commit is contained in:
Dennis Sweeney 2022-05-31 16:32:30 -04:00 committed by GitHub
parent 8a5e3c2ec6
commit f425f3bb27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 371 additions and 52 deletions

View file

@ -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();