GH-99005: More intrinsics (GH-100774)

* Remove UNARY_POSITIVE, LIST_TO_TUPLE and ASYNC_GEN_WRAP, replacing them with intrinsics.
This commit is contained in:
Mark Shannon 2023-01-06 14:47:57 +00:00 committed by GitHub
parent 659c2607f5
commit 78068126a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 151 additions and 204 deletions

View file

@ -173,12 +173,6 @@ dummy_func(
macro(END_FOR) = POP_TOP + POP_TOP;
inst(UNARY_POSITIVE, (value -- res)) {
res = PyNumber_Positive(value);
DECREF_INPUTS();
ERROR_IF(res == NULL, error);
}
inst(UNARY_NEGATIVE, (value -- res)) {
res = PyNumber_Negative(value);
DECREF_INPUTS();
@ -757,13 +751,6 @@ dummy_func(
}
}
inst(ASYNC_GEN_WRAP, (v -- w)) {
assert(frame->f_code->co_flags & CO_ASYNC_GENERATOR);
w = _PyAsyncGenValueWrapperNew(v);
DECREF_INPUTS();
ERROR_IF(w == NULL, error);
}
inst(YIELD_VALUE, (retval -- unused)) {
// NOTE: It's important that YIELD_VALUE never raises an exception!
// The compiler treats any exception raised here as a failed close()
@ -1348,12 +1335,6 @@ dummy_func(
PUSH(list);
}
inst(LIST_TO_TUPLE, (list -- tuple)) {
tuple = PyList_AsTuple(list);
DECREF_INPUTS();
ERROR_IF(tuple == NULL, error);
}
inst(LIST_EXTEND, (iterable -- )) {
PyObject *list = PEEK(oparg + 1); // iterable is still on the stack
PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable);