mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
GH-91095: Specialize calls to normal Python classes. (GH-99331)
This commit is contained in:
parent
c01da2896a
commit
04492cbc9a
20 changed files with 511 additions and 189 deletions
230
Python/generated_cases.c.h
generated
230
Python/generated_cases.c.h
generated
|
@ -3765,7 +3765,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 2698 "Python/bytecodes.c"
|
||||
#line 2699 "Python/bytecodes.c"
|
||||
int is_meth = method != NULL;
|
||||
int total_args = oparg;
|
||||
if (is_meth) {
|
||||
|
@ -3859,7 +3859,7 @@
|
|||
TARGET(CALL_BOUND_METHOD_EXACT_ARGS) {
|
||||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
#line 2786 "Python/bytecodes.c"
|
||||
#line 2787 "Python/bytecodes.c"
|
||||
DEOPT_IF(method != NULL, CALL);
|
||||
DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
|
@ -3878,7 +3878,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
uint32_t func_version = read_u32(&next_instr[1].cache);
|
||||
#line 2798 "Python/bytecodes.c"
|
||||
#line 2799 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
DEOPT_IF(tstate->interp->eval_frame, CALL);
|
||||
int is_meth = method != NULL;
|
||||
|
@ -3912,7 +3912,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
uint32_t func_version = read_u32(&next_instr[1].cache);
|
||||
#line 2826 "Python/bytecodes.c"
|
||||
#line 2827 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
DEOPT_IF(tstate->interp->eval_frame, CALL);
|
||||
int is_meth = method != NULL;
|
||||
|
@ -3956,7 +3956,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *null = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 2864 "Python/bytecodes.c"
|
||||
#line 2865 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
assert(oparg == 1);
|
||||
DEOPT_IF(null != NULL, CALL);
|
||||
|
@ -3979,7 +3979,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *null = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 2876 "Python/bytecodes.c"
|
||||
#line 2877 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
assert(oparg == 1);
|
||||
DEOPT_IF(null != NULL, CALL);
|
||||
|
@ -4004,7 +4004,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *null = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 2890 "Python/bytecodes.c"
|
||||
#line 2891 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
assert(oparg == 1);
|
||||
DEOPT_IF(null != NULL, CALL);
|
||||
|
@ -4024,12 +4024,84 @@
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(CALL_NO_KW_ALLOC_AND_ENTER_INIT) {
|
||||
PyObject **args = (stack_pointer - oparg);
|
||||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *null = stack_pointer[-(2 + oparg)];
|
||||
#line 2905 "Python/bytecodes.c"
|
||||
/* This instruction does the following:
|
||||
* 1. Creates the object (by calling ``object.__new__``)
|
||||
* 2. Pushes a shim frame to the frame stack (to cleanup after ``__init__``)
|
||||
* 3. Pushes the frame for ``__init__`` to the frame stack
|
||||
* */
|
||||
assert(kwnames == NULL);
|
||||
_PyCallCache *cache = (_PyCallCache *)next_instr;
|
||||
DEOPT_IF(null != NULL, CALL);
|
||||
DEOPT_IF(!PyType_Check(callable), CALL);
|
||||
PyTypeObject *tp = (PyTypeObject *)callable;
|
||||
DEOPT_IF(tp->tp_version_tag != read_u32(cache->func_version), CALL);
|
||||
PyHeapTypeObject *cls = (PyHeapTypeObject *)callable;
|
||||
PyFunctionObject *init = (PyFunctionObject *)cls->_spec_cache.init;
|
||||
PyCodeObject *code = (PyCodeObject *)init->func_code;
|
||||
DEOPT_IF(code->co_argcount != oparg+1, CALL);
|
||||
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize + _Py_InitCleanup.co_framesize), CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyObject *self = _PyType_NewManagedObject(tp);
|
||||
if (self == NULL) {
|
||||
goto error;
|
||||
}
|
||||
Py_DECREF(tp);
|
||||
if (_Py_EnterRecursivePy(tstate)) {
|
||||
goto exit_unwind;
|
||||
}
|
||||
_PyInterpreterFrame *shim = _PyFrame_PushTrampolineUnchecked(
|
||||
tstate, (PyCodeObject *)&_Py_InitCleanup, 1, 0);
|
||||
assert(_PyCode_CODE((PyCodeObject *)shim->f_executable)[1].op.code == EXIT_INIT_CHECK);
|
||||
/* Push self onto stack of shim */
|
||||
Py_INCREF(self);
|
||||
shim->localsplus[0] = self;
|
||||
Py_INCREF(init);
|
||||
_PyInterpreterFrame *init_frame = _PyFrame_PushUnchecked(tstate, init, oparg+1);
|
||||
/* Copy self followed by args to __init__ frame */
|
||||
init_frame->localsplus[0] = self;
|
||||
for (int i = 0; i < oparg; i++) {
|
||||
init_frame->localsplus[i+1] = args[i];
|
||||
}
|
||||
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
|
||||
frame->prev_instr = next_instr - 1;
|
||||
frame->return_offset = 0;
|
||||
STACK_SHRINK(oparg+2);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
/* Link frames */
|
||||
init_frame->previous = shim;
|
||||
shim->previous = frame;
|
||||
frame = cframe.current_frame = init_frame;
|
||||
CALL_STAT_INC(inlined_py_calls);
|
||||
goto start_frame;
|
||||
#line 4082 "Python/generated_cases.c.h"
|
||||
}
|
||||
|
||||
TARGET(EXIT_INIT_CHECK) {
|
||||
PyObject *should_be_none = stack_pointer[-1];
|
||||
#line 2957 "Python/bytecodes.c"
|
||||
assert(STACK_LEVEL() == 2);
|
||||
if (should_be_none != Py_None) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"__init__() should return None, not '%.200s'",
|
||||
Py_TYPE(should_be_none)->tp_name);
|
||||
goto error;
|
||||
}
|
||||
#line 4095 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(1);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(CALL_BUILTIN_CLASS) {
|
||||
PyObject **args = (stack_pointer - oparg);
|
||||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 2904 "Python/bytecodes.c"
|
||||
#line 2967 "Python/bytecodes.c"
|
||||
int is_meth = method != NULL;
|
||||
int total_args = oparg;
|
||||
if (is_meth) {
|
||||
|
@ -4051,7 +4123,7 @@
|
|||
}
|
||||
Py_DECREF(tp);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4055 "Python/generated_cases.c.h"
|
||||
#line 4127 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4065,7 +4137,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 2929 "Python/bytecodes.c"
|
||||
#line 2992 "Python/bytecodes.c"
|
||||
/* Builtin METH_O functions */
|
||||
assert(kwnames == NULL);
|
||||
int is_meth = method != NULL;
|
||||
|
@ -4093,7 +4165,7 @@
|
|||
Py_DECREF(arg);
|
||||
Py_DECREF(callable);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4097 "Python/generated_cases.c.h"
|
||||
#line 4169 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4107,7 +4179,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 2960 "Python/bytecodes.c"
|
||||
#line 3023 "Python/bytecodes.c"
|
||||
/* Builtin METH_FASTCALL functions, without keywords */
|
||||
assert(kwnames == NULL);
|
||||
int is_meth = method != NULL;
|
||||
|
@ -4139,7 +4211,7 @@
|
|||
'invalid'). In those cases an exception is set, so we must
|
||||
handle it.
|
||||
*/
|
||||
#line 4143 "Python/generated_cases.c.h"
|
||||
#line 4215 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4153,7 +4225,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 2995 "Python/bytecodes.c"
|
||||
#line 3058 "Python/bytecodes.c"
|
||||
/* Builtin METH_FASTCALL | METH_KEYWORDS functions */
|
||||
int is_meth = method != NULL;
|
||||
int total_args = oparg;
|
||||
|
@ -4185,7 +4257,7 @@
|
|||
}
|
||||
Py_DECREF(callable);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4189 "Python/generated_cases.c.h"
|
||||
#line 4261 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4199,7 +4271,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 3030 "Python/bytecodes.c"
|
||||
#line 3093 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
/* len(o) */
|
||||
int is_meth = method != NULL;
|
||||
|
@ -4224,7 +4296,7 @@
|
|||
Py_DECREF(callable);
|
||||
Py_DECREF(arg);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4228 "Python/generated_cases.c.h"
|
||||
#line 4300 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4237,7 +4309,7 @@
|
|||
PyObject *callable = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 3057 "Python/bytecodes.c"
|
||||
#line 3120 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
/* isinstance(o, o2) */
|
||||
int is_meth = method != NULL;
|
||||
|
@ -4264,7 +4336,7 @@
|
|||
Py_DECREF(cls);
|
||||
Py_DECREF(callable);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4268 "Python/generated_cases.c.h"
|
||||
#line 4340 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4276,7 +4348,7 @@
|
|||
PyObject **args = (stack_pointer - oparg);
|
||||
PyObject *self = stack_pointer[-(1 + oparg)];
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
#line 3087 "Python/bytecodes.c"
|
||||
#line 3150 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
assert(oparg == 1);
|
||||
assert(method != NULL);
|
||||
|
@ -4294,14 +4366,14 @@
|
|||
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1);
|
||||
assert(next_instr[-1].op.code == POP_TOP);
|
||||
DISPATCH();
|
||||
#line 4298 "Python/generated_cases.c.h"
|
||||
#line 4370 "Python/generated_cases.c.h"
|
||||
}
|
||||
|
||||
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) {
|
||||
PyObject **args = (stack_pointer - oparg);
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 3107 "Python/bytecodes.c"
|
||||
#line 3170 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
int is_meth = method != NULL;
|
||||
int total_args = oparg;
|
||||
|
@ -4332,7 +4404,7 @@
|
|||
Py_DECREF(arg);
|
||||
Py_DECREF(callable);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4336 "Python/generated_cases.c.h"
|
||||
#line 4408 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4345,7 +4417,7 @@
|
|||
PyObject **args = (stack_pointer - oparg);
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 3141 "Python/bytecodes.c"
|
||||
#line 3204 "Python/bytecodes.c"
|
||||
int is_meth = method != NULL;
|
||||
int total_args = oparg;
|
||||
if (is_meth) {
|
||||
|
@ -4374,7 +4446,7 @@
|
|||
}
|
||||
Py_DECREF(callable);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4378 "Python/generated_cases.c.h"
|
||||
#line 4450 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4387,7 +4459,7 @@
|
|||
PyObject **args = (stack_pointer - oparg);
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 3173 "Python/bytecodes.c"
|
||||
#line 3236 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
assert(oparg == 0 || oparg == 1);
|
||||
int is_meth = method != NULL;
|
||||
|
@ -4416,7 +4488,7 @@
|
|||
Py_DECREF(self);
|
||||
Py_DECREF(callable);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4420 "Python/generated_cases.c.h"
|
||||
#line 4492 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4429,7 +4501,7 @@
|
|||
PyObject **args = (stack_pointer - oparg);
|
||||
PyObject *method = stack_pointer[-(2 + oparg)];
|
||||
PyObject *res;
|
||||
#line 3205 "Python/bytecodes.c"
|
||||
#line 3268 "Python/bytecodes.c"
|
||||
assert(kwnames == NULL);
|
||||
int is_meth = method != NULL;
|
||||
int total_args = oparg;
|
||||
|
@ -4457,7 +4529,7 @@
|
|||
}
|
||||
Py_DECREF(callable);
|
||||
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
|
||||
#line 4461 "Python/generated_cases.c.h"
|
||||
#line 4533 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(oparg);
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
|
@ -4467,9 +4539,9 @@
|
|||
}
|
||||
|
||||
TARGET(INSTRUMENTED_CALL_FUNCTION_EX) {
|
||||
#line 3236 "Python/bytecodes.c"
|
||||
#line 3299 "Python/bytecodes.c"
|
||||
GO_TO_INSTRUCTION(CALL_FUNCTION_EX);
|
||||
#line 4473 "Python/generated_cases.c.h"
|
||||
#line 4545 "Python/generated_cases.c.h"
|
||||
}
|
||||
|
||||
TARGET(CALL_FUNCTION_EX) {
|
||||
|
@ -4478,7 +4550,7 @@
|
|||
PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))];
|
||||
PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))];
|
||||
PyObject *result;
|
||||
#line 3240 "Python/bytecodes.c"
|
||||
#line 3303 "Python/bytecodes.c"
|
||||
// DICT_MERGE is called before this opcode if there are kwargs.
|
||||
// It converts all dict subtypes in kwargs into regular dicts.
|
||||
assert(kwargs == NULL || PyDict_CheckExact(kwargs));
|
||||
|
@ -4540,14 +4612,14 @@
|
|||
}
|
||||
result = PyObject_Call(func, callargs, kwargs);
|
||||
}
|
||||
#line 4544 "Python/generated_cases.c.h"
|
||||
#line 4616 "Python/generated_cases.c.h"
|
||||
Py_DECREF(func);
|
||||
Py_DECREF(callargs);
|
||||
Py_XDECREF(kwargs);
|
||||
#line 3302 "Python/bytecodes.c"
|
||||
#line 3365 "Python/bytecodes.c"
|
||||
assert(PEEK(3 + (oparg & 1)) == NULL);
|
||||
if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; }
|
||||
#line 4551 "Python/generated_cases.c.h"
|
||||
#line 4623 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(((oparg & 1) ? 1 : 0));
|
||||
STACK_SHRINK(2);
|
||||
stack_pointer[-1] = result;
|
||||
|
@ -4558,7 +4630,7 @@
|
|||
TARGET(MAKE_FUNCTION) {
|
||||
PyObject *codeobj = stack_pointer[-1];
|
||||
PyObject *func;
|
||||
#line 3308 "Python/bytecodes.c"
|
||||
#line 3371 "Python/bytecodes.c"
|
||||
|
||||
PyFunctionObject *func_obj = (PyFunctionObject *)
|
||||
PyFunction_New(codeobj, GLOBALS());
|
||||
|
@ -4570,7 +4642,7 @@
|
|||
|
||||
func_obj->func_version = ((PyCodeObject *)codeobj)->co_version;
|
||||
func = (PyObject *)func_obj;
|
||||
#line 4574 "Python/generated_cases.c.h"
|
||||
#line 4646 "Python/generated_cases.c.h"
|
||||
stack_pointer[-1] = func;
|
||||
DISPATCH();
|
||||
}
|
||||
|
@ -4578,7 +4650,7 @@
|
|||
TARGET(SET_FUNCTION_ATTRIBUTE) {
|
||||
PyObject *func = stack_pointer[-1];
|
||||
PyObject *attr = stack_pointer[-2];
|
||||
#line 3322 "Python/bytecodes.c"
|
||||
#line 3385 "Python/bytecodes.c"
|
||||
assert(PyFunction_Check(func));
|
||||
PyFunctionObject *func_obj = (PyFunctionObject *)func;
|
||||
switch(oparg) {
|
||||
|
@ -4603,14 +4675,14 @@
|
|||
default:
|
||||
Py_UNREACHABLE();
|
||||
}
|
||||
#line 4607 "Python/generated_cases.c.h"
|
||||
#line 4679 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = func;
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(RETURN_GENERATOR) {
|
||||
#line 3349 "Python/bytecodes.c"
|
||||
#line 3412 "Python/bytecodes.c"
|
||||
assert(PyFunction_Check(frame->f_funcobj));
|
||||
PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj;
|
||||
PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func);
|
||||
|
@ -4631,7 +4703,7 @@
|
|||
frame = cframe.current_frame = prev;
|
||||
_PyFrame_StackPush(frame, (PyObject *)gen);
|
||||
goto resume_frame;
|
||||
#line 4635 "Python/generated_cases.c.h"
|
||||
#line 4707 "Python/generated_cases.c.h"
|
||||
}
|
||||
|
||||
TARGET(BUILD_SLICE) {
|
||||
|
@ -4639,15 +4711,15 @@
|
|||
PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))];
|
||||
PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))];
|
||||
PyObject *slice;
|
||||
#line 3372 "Python/bytecodes.c"
|
||||
#line 3435 "Python/bytecodes.c"
|
||||
slice = PySlice_New(start, stop, step);
|
||||
#line 4645 "Python/generated_cases.c.h"
|
||||
#line 4717 "Python/generated_cases.c.h"
|
||||
Py_DECREF(start);
|
||||
Py_DECREF(stop);
|
||||
Py_XDECREF(step);
|
||||
#line 3374 "Python/bytecodes.c"
|
||||
#line 3437 "Python/bytecodes.c"
|
||||
if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; }
|
||||
#line 4651 "Python/generated_cases.c.h"
|
||||
#line 4723 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(((oparg == 3) ? 1 : 0));
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = slice;
|
||||
|
@ -4657,14 +4729,14 @@
|
|||
TARGET(CONVERT_VALUE) {
|
||||
PyObject *value = stack_pointer[-1];
|
||||
PyObject *result;
|
||||
#line 3378 "Python/bytecodes.c"
|
||||
#line 3441 "Python/bytecodes.c"
|
||||
convertion_func_ptr conv_fn;
|
||||
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
|
||||
conv_fn = CONVERSION_FUNCTIONS[oparg];
|
||||
result = conv_fn(value);
|
||||
Py_DECREF(value);
|
||||
if (result == NULL) goto pop_1_error;
|
||||
#line 4668 "Python/generated_cases.c.h"
|
||||
#line 4740 "Python/generated_cases.c.h"
|
||||
stack_pointer[-1] = result;
|
||||
DISPATCH();
|
||||
}
|
||||
|
@ -4672,7 +4744,7 @@
|
|||
TARGET(FORMAT_SIMPLE) {
|
||||
PyObject *value = stack_pointer[-1];
|
||||
PyObject *res;
|
||||
#line 3387 "Python/bytecodes.c"
|
||||
#line 3450 "Python/bytecodes.c"
|
||||
/* If value is a unicode object, then we know the result
|
||||
* of format(value) is value itself. */
|
||||
if (!PyUnicode_CheckExact(value)) {
|
||||
|
@ -4683,7 +4755,7 @@
|
|||
else {
|
||||
res = value;
|
||||
}
|
||||
#line 4687 "Python/generated_cases.c.h"
|
||||
#line 4759 "Python/generated_cases.c.h"
|
||||
stack_pointer[-1] = res;
|
||||
DISPATCH();
|
||||
}
|
||||
|
@ -4692,12 +4764,12 @@
|
|||
PyObject *fmt_spec = stack_pointer[-1];
|
||||
PyObject *value = stack_pointer[-2];
|
||||
PyObject *res;
|
||||
#line 3400 "Python/bytecodes.c"
|
||||
#line 3463 "Python/bytecodes.c"
|
||||
res = PyObject_Format(value, fmt_spec);
|
||||
Py_DECREF(value);
|
||||
Py_DECREF(fmt_spec);
|
||||
if (res == NULL) goto pop_2_error;
|
||||
#line 4701 "Python/generated_cases.c.h"
|
||||
#line 4773 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
DISPATCH();
|
||||
|
@ -4706,10 +4778,10 @@
|
|||
TARGET(COPY) {
|
||||
PyObject *bottom = stack_pointer[-(1 + (oparg-1))];
|
||||
PyObject *top;
|
||||
#line 3407 "Python/bytecodes.c"
|
||||
#line 3470 "Python/bytecodes.c"
|
||||
assert(oparg > 0);
|
||||
top = Py_NewRef(bottom);
|
||||
#line 4713 "Python/generated_cases.c.h"
|
||||
#line 4785 "Python/generated_cases.c.h"
|
||||
STACK_GROW(1);
|
||||
stack_pointer[-1] = top;
|
||||
DISPATCH();
|
||||
|
@ -4721,7 +4793,7 @@
|
|||
PyObject *rhs = stack_pointer[-1];
|
||||
PyObject *lhs = stack_pointer[-2];
|
||||
PyObject *res;
|
||||
#line 3412 "Python/bytecodes.c"
|
||||
#line 3475 "Python/bytecodes.c"
|
||||
#if ENABLE_SPECIALIZATION
|
||||
_PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr;
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
|
||||
|
@ -4736,12 +4808,12 @@
|
|||
assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops));
|
||||
assert(binary_ops[oparg]);
|
||||
res = binary_ops[oparg](lhs, rhs);
|
||||
#line 4740 "Python/generated_cases.c.h"
|
||||
#line 4812 "Python/generated_cases.c.h"
|
||||
Py_DECREF(lhs);
|
||||
Py_DECREF(rhs);
|
||||
#line 3427 "Python/bytecodes.c"
|
||||
#line 3490 "Python/bytecodes.c"
|
||||
if (res == NULL) goto pop_2_error;
|
||||
#line 4745 "Python/generated_cases.c.h"
|
||||
#line 4817 "Python/generated_cases.c.h"
|
||||
STACK_SHRINK(1);
|
||||
stack_pointer[-1] = res;
|
||||
next_instr += 1;
|
||||
|
@ -4751,16 +4823,16 @@
|
|||
TARGET(SWAP) {
|
||||
PyObject *top = stack_pointer[-1];
|
||||
PyObject *bottom = stack_pointer[-(2 + (oparg-2))];
|
||||
#line 3432 "Python/bytecodes.c"
|
||||
#line 3495 "Python/bytecodes.c"
|
||||
assert(oparg >= 2);
|
||||
#line 4757 "Python/generated_cases.c.h"
|
||||
#line 4829 "Python/generated_cases.c.h"
|
||||
stack_pointer[-1] = bottom;
|
||||
stack_pointer[-(2 + (oparg-2))] = top;
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INSTRUMENTED_INSTRUCTION) {
|
||||
#line 3436 "Python/bytecodes.c"
|
||||
#line 3499 "Python/bytecodes.c"
|
||||
int next_opcode = _Py_call_instrumentation_instruction(
|
||||
tstate, frame, next_instr-1);
|
||||
if (next_opcode < 0) goto error;
|
||||
|
@ -4772,26 +4844,26 @@
|
|||
assert(next_opcode > 0 && next_opcode < 256);
|
||||
opcode = next_opcode;
|
||||
DISPATCH_GOTO();
|
||||
#line 4776 "Python/generated_cases.c.h"
|
||||
#line 4848 "Python/generated_cases.c.h"
|
||||
}
|
||||
|
||||
TARGET(INSTRUMENTED_JUMP_FORWARD) {
|
||||
#line 3450 "Python/bytecodes.c"
|
||||
#line 3513 "Python/bytecodes.c"
|
||||
INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP);
|
||||
#line 4782 "Python/generated_cases.c.h"
|
||||
#line 4854 "Python/generated_cases.c.h"
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
|
||||
#line 3454 "Python/bytecodes.c"
|
||||
#line 3517 "Python/bytecodes.c"
|
||||
INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP);
|
||||
#line 4789 "Python/generated_cases.c.h"
|
||||
#line 4861 "Python/generated_cases.c.h"
|
||||
CHECK_EVAL_BREAKER();
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) {
|
||||
#line 3459 "Python/bytecodes.c"
|
||||
#line 3522 "Python/bytecodes.c"
|
||||
PyObject *cond = POP();
|
||||
int err = PyObject_IsTrue(cond);
|
||||
Py_DECREF(cond);
|
||||
|
@ -4800,12 +4872,12 @@
|
|||
assert(err == 0 || err == 1);
|
||||
int offset = err*oparg;
|
||||
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
|
||||
#line 4804 "Python/generated_cases.c.h"
|
||||
#line 4876 "Python/generated_cases.c.h"
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) {
|
||||
#line 3470 "Python/bytecodes.c"
|
||||
#line 3533 "Python/bytecodes.c"
|
||||
PyObject *cond = POP();
|
||||
int err = PyObject_IsTrue(cond);
|
||||
Py_DECREF(cond);
|
||||
|
@ -4814,12 +4886,12 @@
|
|||
assert(err == 0 || err == 1);
|
||||
int offset = (1-err)*oparg;
|
||||
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
|
||||
#line 4818 "Python/generated_cases.c.h"
|
||||
#line 4890 "Python/generated_cases.c.h"
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) {
|
||||
#line 3481 "Python/bytecodes.c"
|
||||
#line 3544 "Python/bytecodes.c"
|
||||
PyObject *value = POP();
|
||||
_Py_CODEUNIT *here = next_instr-1;
|
||||
int offset;
|
||||
|
@ -4831,12 +4903,12 @@
|
|||
offset = 0;
|
||||
}
|
||||
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
|
||||
#line 4835 "Python/generated_cases.c.h"
|
||||
#line 4907 "Python/generated_cases.c.h"
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) {
|
||||
#line 3495 "Python/bytecodes.c"
|
||||
#line 3558 "Python/bytecodes.c"
|
||||
PyObject *value = POP();
|
||||
_Py_CODEUNIT *here = next_instr-1;
|
||||
int offset;
|
||||
|
@ -4848,30 +4920,30 @@
|
|||
offset = oparg;
|
||||
}
|
||||
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
|
||||
#line 4852 "Python/generated_cases.c.h"
|
||||
#line 4924 "Python/generated_cases.c.h"
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(EXTENDED_ARG) {
|
||||
#line 3509 "Python/bytecodes.c"
|
||||
#line 3572 "Python/bytecodes.c"
|
||||
assert(oparg);
|
||||
opcode = next_instr->op.code;
|
||||
oparg = oparg << 8 | next_instr->op.arg;
|
||||
PRE_DISPATCH_GOTO();
|
||||
DISPATCH_GOTO();
|
||||
#line 4863 "Python/generated_cases.c.h"
|
||||
#line 4935 "Python/generated_cases.c.h"
|
||||
}
|
||||
|
||||
TARGET(CACHE) {
|
||||
#line 3517 "Python/bytecodes.c"
|
||||
#line 3580 "Python/bytecodes.c"
|
||||
assert(0 && "Executing a cache.");
|
||||
Py_UNREACHABLE();
|
||||
#line 4870 "Python/generated_cases.c.h"
|
||||
#line 4942 "Python/generated_cases.c.h"
|
||||
}
|
||||
|
||||
TARGET(RESERVED) {
|
||||
#line 3522 "Python/bytecodes.c"
|
||||
#line 3585 "Python/bytecodes.c"
|
||||
assert(0 && "Executing RESERVED instruction.");
|
||||
Py_UNREACHABLE();
|
||||
#line 4877 "Python/generated_cases.c.h"
|
||||
#line 4949 "Python/generated_cases.c.h"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue