mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-46329: Change calling sequence (again) (GH-31373)
* Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
This commit is contained in:
parent
e2c28616ce
commit
cf345e945f
13 changed files with 365 additions and 344 deletions
|
@ -1584,7 +1584,7 @@ pop_frame(PyThreadState *tstate, InterpreterFrame *frame)
|
|||
return prev_frame;
|
||||
}
|
||||
|
||||
/* It is only between a PRECALL_METHOD/FUNCTION instruction and the following CALL,
|
||||
/* It is only between the PRECALL instruction and the following CALL,
|
||||
* that these values have any meaning.
|
||||
*/
|
||||
typedef struct {
|
||||
|
@ -1872,6 +1872,12 @@ handle_eval_breaker:
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PUSH_NULL) {
|
||||
/* Use BASIC_PUSH as NULL is not a valid object pointer */
|
||||
BASIC_PUSH(NULL);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(UNARY_POSITIVE) {
|
||||
PyObject *value = TOP();
|
||||
PyObject *res = PyNumber_Positive(value);
|
||||
|
@ -4476,25 +4482,7 @@ handle_eval_breaker:
|
|||
NOTRACE_DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_FUNCTION) {
|
||||
/* Move ownership of reference from stack to call_shape */
|
||||
call_shape.callable = PEEK(oparg + 1);
|
||||
call_shape.postcall_shrink = 1;
|
||||
|
||||
call_shape.total_args = oparg;
|
||||
assert(call_shape.kwnames == NULL);
|
||||
#ifdef Py_STATS
|
||||
extern int _PySpecialization_ClassifyCallable(PyObject *);
|
||||
SpecializationStats *stats =
|
||||
&_py_stats.opcode_stats[PRECALL_FUNCTION].specialization;
|
||||
stats->failure++;
|
||||
int kind = _PySpecialization_ClassifyCallable(call_shape.callable);
|
||||
stats->failure_kinds[kind]++;
|
||||
#endif
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(PRECALL_METHOD) {
|
||||
TARGET(PRECALL) {
|
||||
/* Designed to work in tamdem with LOAD_METHOD. */
|
||||
/* `meth` is NULL when LOAD_METHOD thinks that it's not
|
||||
a method call.
|
||||
|
@ -4533,7 +4521,7 @@ handle_eval_breaker:
|
|||
#ifdef Py_STATS
|
||||
extern int _PySpecialization_ClassifyCallable(PyObject *);
|
||||
SpecializationStats *stats =
|
||||
&_py_stats.opcode_stats[PRECALL_METHOD].specialization;
|
||||
&_py_stats.opcode_stats[PRECALL].specialization;
|
||||
stats->failure++;
|
||||
int kind = _PySpecialization_ClassifyCallable(call_shape.callable);
|
||||
stats->failure_kinds[kind]++;
|
||||
|
@ -5118,6 +5106,8 @@ handle_eval_breaker:
|
|||
Py_DECREF(callargs);
|
||||
Py_XDECREF(kwargs);
|
||||
|
||||
STACK_SHRINK(1);
|
||||
assert(TOP() == NULL);
|
||||
SET_TOP(result);
|
||||
if (result == NULL) {
|
||||
goto error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue