@@ -2185,8 +2185,11 @@ dummy_func(
21852185 }
21862186 // we make no attempt to optimize here; specializations should
21872187 // handle any case whose performance we care about
2188- PyObject * stack [] = {class , self };
2189- PyObject * super = PyObject_Vectorcall (global_super , stack , oparg & 2 , NULL );
2188+ PyObject * super ;
2189+ {
2190+ PyObject * stack [] = {class , self };
2191+ super = PyObject_Vectorcall (global_super , stack , oparg & 2 , NULL );
2192+ }
21902193 if (opcode == INSTRUMENTED_LOAD_SUPER_ATTR ) {
21912194 PyObject * arg = oparg & 2 ? class : & _PyInstrumentation_MISSING ;
21922195 if (super == NULL ) {
@@ -2245,8 +2248,12 @@ dummy_func(
22452248 PyObject * name = GETITEM (FRAME_CO_NAMES , oparg >> 2 );
22462249 PyTypeObject * cls = (PyTypeObject * )class ;
22472250 int method_found = 0 ;
2248- PyObject * attr_o = _PySuper_Lookup (cls , self , name ,
2249- Py_TYPE (self )-> tp_getattro == PyObject_GenericGetAttr ? & method_found : NULL );
2251+ PyObject * attr_o ;
2252+ {
2253+ int * method_found_ptr = & method_found ;
2254+ attr_o = _PySuper_Lookup (cls , self , name ,
2255+ Py_TYPE (self )-> tp_getattro == PyObject_GenericGetAttr ? method_found_ptr : NULL );
2256+ }
22502257 if (attr_o == NULL ) {
22512258 ERROR_NO_POP ();
22522259 }
@@ -3472,10 +3479,13 @@ dummy_func(
34723479 }
34733480 assert (PyStackRef_IsTaggedInt (lasti ));
34743481 (void )lasti ; // Shut up compiler warning if asserts are off
3475- PyObject * stack [5 ] = {NULL , PyStackRef_AsPyObjectBorrow (exit_self ), exc , val_o , tb };
3476- int has_self = !PyStackRef_IsNull (exit_self );
3477- PyObject * res_o = PyObject_Vectorcall (exit_func_o , stack + 2 - has_self ,
3478- (3 + has_self ) | PY_VECTORCALL_ARGUMENTS_OFFSET , NULL );
3482+ PyObject * res_o ;
3483+ {
3484+ PyObject * stack [5 ] = {NULL , PyStackRef_AsPyObjectBorrow (exit_self ), exc , val_o , tb };
3485+ int has_self = !PyStackRef_IsNull (exit_self );
3486+ res_o = PyObject_Vectorcall (exit_func_o , stack + 2 - has_self ,
3487+ (3 + has_self ) | PY_VECTORCALL_ARGUMENTS_OFFSET , NULL );
3488+ }
34793489 Py_XDECREF (original_tb );
34803490 ERROR_IF (res_o == NULL );
34813491 res = PyStackRef_FromPyObjectSteal (res_o );
@@ -3707,36 +3717,18 @@ dummy_func(
37073717 frame -> return_offset = INSTRUCTION_SIZE ;
37083718 DISPATCH_INLINED (new_frame );
37093719 }
3710- /* Callable is not a normal Python function */
3711- STACKREFS_TO_PYOBJECTS (arguments , total_args , args_o );
3712- if (CONVERSION_FAILED (args_o )) {
3713- DECREF_INPUTS ();
3714- ERROR_IF (true);
3715- }
3716- PyObject * res_o = PyObject_Vectorcall (
3717- callable_o , args_o ,
3718- total_args | PY_VECTORCALL_ARGUMENTS_OFFSET ,
3719- NULL );
3720- STACKREFS_TO_PYOBJECTS_CLEANUP (args_o );
3721- if (opcode == INSTRUMENTED_CALL ) {
3722- PyObject * arg = total_args == 0 ?
3723- & _PyInstrumentation_MISSING : PyStackRef_AsPyObjectBorrow (arguments [0 ]);
3724- if (res_o == NULL ) {
3725- _Py_call_instrumentation_exc2 (
3726- tstate , PY_MONITORING_EVENT_C_RAISE ,
3727- frame , this_instr , callable_o , arg );
3728- }
3729- else {
3730- int err = _Py_call_instrumentation_2args (
3731- tstate , PY_MONITORING_EVENT_C_RETURN ,
3732- frame , this_instr , callable_o , arg );
3733- if (err < 0 ) {
3734- Py_CLEAR (res_o );
3735- }
3736- }
3737- }
3738- assert ((res_o != NULL ) ^ (_PyErr_Occurred (tstate ) != NULL ));
3739- DECREF_INPUTS ();
3720+ PyObject * res_o = _Py_VectorCallInstrumentation_StackRefSteal (
3721+ callable ,
3722+ arguments ,
3723+ total_args ,
3724+ PyStackRef_NULL ,
3725+ opcode == INSTRUMENTED_CALL ,
3726+ frame ,
3727+ this_instr ,
3728+ tstate );
3729+ DEAD (args );
3730+ DEAD (self_or_null );
3731+ DEAD (callable );
37403732 ERROR_IF (res_o == NULL );
37413733 res = PyStackRef_FromPyObjectSteal (res_o );
37423734 }
@@ -4587,35 +4579,19 @@ dummy_func(
45874579 frame -> return_offset = INSTRUCTION_SIZE ;
45884580 DISPATCH_INLINED (new_frame );
45894581 }
4590- /* Callable is not a normal Python function */
4591- STACKREFS_TO_PYOBJECTS (arguments , total_args , args_o );
4592- if (CONVERSION_FAILED (args_o )) {
4593- DECREF_INPUTS ();
4594- ERROR_IF (true);
4595- }
4596- PyObject * res_o = PyObject_Vectorcall (
4597- callable_o , args_o ,
4598- positional_args | PY_VECTORCALL_ARGUMENTS_OFFSET ,
4599- kwnames_o );
4600- STACKREFS_TO_PYOBJECTS_CLEANUP (args_o );
4601- if (opcode == INSTRUMENTED_CALL_KW ) {
4602- PyObject * arg = total_args == 0 ?
4603- & _PyInstrumentation_MISSING : PyStackRef_AsPyObjectBorrow (arguments [0 ]);
4604- if (res_o == NULL ) {
4605- _Py_call_instrumentation_exc2 (
4606- tstate , PY_MONITORING_EVENT_C_RAISE ,
4607- frame , this_instr , callable_o , arg );
4608- }
4609- else {
4610- int err = _Py_call_instrumentation_2args (
4611- tstate , PY_MONITORING_EVENT_C_RETURN ,
4612- frame , this_instr , callable_o , arg );
4613- if (err < 0 ) {
4614- Py_CLEAR (res_o );
4615- }
4616- }
4617- }
4618- DECREF_INPUTS ();
4582+ PyObject * res_o = _Py_VectorCallInstrumentation_StackRefSteal (
4583+ callable ,
4584+ arguments ,
4585+ total_args ,
4586+ kwnames ,
4587+ opcode == INSTRUMENTED_CALL_KW ,
4588+ frame ,
4589+ this_instr ,
4590+ tstate );
4591+ DEAD (kwnames );
4592+ DEAD (args );
4593+ DEAD (self_or_null );
4594+ DEAD (callable );
46194595 ERROR_IF (res_o == NULL );
46204596 res = PyStackRef_FromPyObjectSteal (res_o );
46214597 }
0 commit comments