@@ -2212,8 +2212,11 @@ dummy_func(
22122212 }
22132213 // we make no attempt to optimize here; specializations should
22142214 // handle any case whose performance we care about
2215- PyObject * stack [] = {class , self };
2216- PyObject * super = PyObject_Vectorcall (global_super , stack , oparg & 2 , NULL );
2215+ PyObject * super ;
2216+ {
2217+ PyObject * stack [] = {class , self };
2218+ super = PyObject_Vectorcall (global_super , stack , oparg & 2 , NULL );
2219+ }
22172220 if (opcode == INSTRUMENTED_LOAD_SUPER_ATTR ) {
22182221 PyObject * arg = oparg & 2 ? class : & _PyInstrumentation_MISSING ;
22192222 if (super == NULL ) {
@@ -2272,8 +2275,12 @@ dummy_func(
22722275 PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >> 2 );
22732276 PyTypeObject * cls = (PyTypeObject * )class ;
22742277 int method_found = 0 ;
2275- PyObject * attr_o = _PySuper_Lookup (cls , self , name ,
2276- Py_TYPE (self )-> tp_getattro == PyObject_GenericGetAttr ? & method_found : NULL );
2278+ PyObject * attr_o ;
2279+ {
2280+ int * method_found_ptr = & method_found ;
2281+ attr_o = _PySuper_Lookup (cls , self , name ,
2282+ Py_TYPE (self )-> tp_getattro == PyObject_GenericGetAttr ? method_found_ptr : NULL );
2283+ }
22772284 if (attr_o == NULL ) {
22782285 ERROR_NO_POP ();
22792286 }
@@ -3499,10 +3506,13 @@ dummy_func(
34993506 }
35003507 assert (PyStackRef_IsTaggedInt (lasti ));
35013508 (void )lasti ; // Shut up compiler warning if asserts are off
3502- PyObject * stack [5 ] = {NULL , PyStackRef_AsPyObjectBorrow (exit_self ), exc , val_o , tb };
3503- int has_self = !PyStackRef_IsNull (exit_self );
3504- PyObject * res_o = PyObject_Vectorcall (exit_func_o , stack + 2 - has_self ,
3505- (3 + has_self ) | PY_VECTORCALL_ARGUMENTS_OFFSET , NULL );
3509+ PyObject * res_o ;
3510+ {
3511+ PyObject * stack [5 ] = {NULL , PyStackRef_AsPyObjectBorrow (exit_self ), exc , val_o , tb };
3512+ int has_self = !PyStackRef_IsNull (exit_self );
3513+ res_o = PyObject_Vectorcall (exit_func_o , stack + 2 - has_self ,
3514+ (3 + has_self ) | PY_VECTORCALL_ARGUMENTS_OFFSET , NULL );
3515+ }
35063516 Py_XDECREF (original_tb );
35073517 ERROR_IF (res_o == NULL );
35083518 res = PyStackRef_FromPyObjectSteal (res_o );
@@ -3734,36 +3744,18 @@ dummy_func(
37343744 frame -> return_offset = INSTRUCTION_SIZE ;
37353745 DISPATCH_INLINED (new_frame );
37363746 }
3737- /* Callable is not a normal Python function */
3738- STACKREFS_TO_PYOBJECTS (arguments , total_args , args_o );
3739- if (CONVERSION_FAILED (args_o )) {
3740- DECREF_INPUTS ();
3741- ERROR_IF (true);
3742- }
3743- PyObject * res_o = PyObject_Vectorcall (
3744- callable_o , args_o ,
3745- total_args | PY_VECTORCALL_ARGUMENTS_OFFSET ,
3746- NULL );
3747- STACKREFS_TO_PYOBJECTS_CLEANUP (args_o );
3748- if (opcode == INSTRUMENTED_CALL ) {
3749- PyObject * arg = total_args == 0 ?
3750- & _PyInstrumentation_MISSING : PyStackRef_AsPyObjectBorrow (arguments [0 ]);
3751- if (res_o == NULL ) {
3752- _Py_call_instrumentation_exc2 (
3753- tstate , PY_MONITORING_EVENT_C_RAISE ,
3754- frame , this_instr , callable_o , arg );
3755- }
3756- else {
3757- int err = _Py_call_instrumentation_2args (
3758- tstate , PY_MONITORING_EVENT_C_RETURN ,
3759- frame , this_instr , callable_o , arg );
3760- if (err < 0 ) {
3761- Py_CLEAR (res_o );
3762- }
3763- }
3764- }
3765- assert ((res_o != NULL ) ^ (_PyErr_Occurred (tstate ) != NULL ));
3766- DECREF_INPUTS ();
3747+ PyObject * res_o = _Py_VectorCallInstrumentation_StackRefSteal (
3748+ callable ,
3749+ arguments ,
3750+ total_args ,
3751+ PyStackRef_NULL ,
3752+ opcode == INSTRUMENTED_CALL ,
3753+ frame ,
3754+ this_instr ,
3755+ tstate );
3756+ DEAD (args );
3757+ DEAD (self_or_null );
3758+ DEAD (callable );
37673759 ERROR_IF (res_o == NULL );
37683760 res = PyStackRef_FromPyObjectSteal (res_o );
37693761 }
@@ -4607,35 +4599,19 @@ dummy_func(
46074599 frame -> return_offset = INSTRUCTION_SIZE ;
46084600 DISPATCH_INLINED (new_frame );
46094601 }
4610- /* Callable is not a normal Python function */
4611- STACKREFS_TO_PYOBJECTS (arguments , total_args , args_o );
4612- if (CONVERSION_FAILED (args_o )) {
4613- DECREF_INPUTS ();
4614- ERROR_IF (true);
4615- }
4616- PyObject * res_o = PyObject_Vectorcall (
4617- callable_o , args_o ,
4618- positional_args | PY_VECTORCALL_ARGUMENTS_OFFSET ,
4619- kwnames_o );
4620- STACKREFS_TO_PYOBJECTS_CLEANUP (args_o );
4621- if (opcode == INSTRUMENTED_CALL_KW ) {
4622- PyObject * arg = total_args == 0 ?
4623- & _PyInstrumentation_MISSING : PyStackRef_AsPyObjectBorrow (arguments [0 ]);
4624- if (res_o == NULL ) {
4625- _Py_call_instrumentation_exc2 (
4626- tstate , PY_MONITORING_EVENT_C_RAISE ,
4627- frame , this_instr , callable_o , arg );
4628- }
4629- else {
4630- int err = _Py_call_instrumentation_2args (
4631- tstate , PY_MONITORING_EVENT_C_RETURN ,
4632- frame , this_instr , callable_o , arg );
4633- if (err < 0 ) {
4634- Py_CLEAR (res_o );
4635- }
4636- }
4637- }
4638- DECREF_INPUTS ();
4602+ PyObject * res_o = _Py_VectorCallInstrumentation_StackRefSteal (
4603+ callable ,
4604+ arguments ,
4605+ total_args ,
4606+ kwnames ,
4607+ opcode == INSTRUMENTED_CALL_KW ,
4608+ frame ,
4609+ this_instr ,
4610+ tstate );
4611+ DEAD (kwnames );
4612+ DEAD (args );
4613+ DEAD (self_or_null );
4614+ DEAD (callable );
46394615 ERROR_IF (res_o == NULL );
46404616 res = PyStackRef_FromPyObjectSteal (res_o );
46414617 }
0 commit comments