@@ -882,143 +882,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
882882
883883 DISPATCH ();
884884
885- {
886- /* Start instructions */
887- #if !USE_COMPUTED_GOTOS
888- dispatch_opcode :
889- switch (opcode )
890- #endif
891- {
892-
893885#include "generated_cases.c.h"
894886
895887
896- #if USE_COMPUTED_GOTOS
897- _unknown_opcode :
898- #else
899- EXTRA_CASES // From pycore_opcode_metadata.h, a 'case' for each unused opcode
900- #endif
901- /* Tell C compilers not to hold the opcode variable in the loop.
902- next_instr points the current instruction without TARGET(). */
903- opcode = next_instr -> op .code ;
904- _PyErr_Format (tstate , PyExc_SystemError ,
905- "%U:%d: unknown opcode %d" ,
906- _PyFrame_GetCode (frame )-> co_filename ,
907- PyUnstable_InterpreterFrame_GetLine (frame ),
908- opcode );
909- goto error ;
910-
911- } /* End instructions */
912-
913- /* This should never be reached. Every opcode should end with DISPATCH()
914- or goto error. */
915- Py_UNREACHABLE ();
916-
917- pop_4_error :
918- STACK_SHRINK (1 );
919- pop_3_error :
920- STACK_SHRINK (1 );
921- pop_2_error :
922- STACK_SHRINK (1 );
923- pop_1_error :
924- STACK_SHRINK (1 );
925- error :
926- /* Double-check exception status. */
927- #ifdef NDEBUG
928- if (!_PyErr_Occurred (tstate )) {
929- _PyErr_SetString (tstate , PyExc_SystemError ,
930- "error return without exception set" );
931- }
932- #else
933- assert (_PyErr_Occurred (tstate ));
934- #endif
935-
936- /* Log traceback info. */
937- assert (frame != & entry_frame );
938- if (!_PyFrame_IsIncomplete (frame )) {
939- PyFrameObject * f = _PyFrame_GetFrameObject (frame );
940- if (f != NULL ) {
941- PyTraceBack_Here (f );
942- }
943- }
944- _PyEval_MonitorRaise (tstate , frame , next_instr - 1 );
945- exception_unwind :
946- {
947- /* We can't use frame->instr_ptr here, as RERAISE may have set it */
948- int offset = INSTR_OFFSET ()- 1 ;
949- int level , handler , lasti ;
950- if (get_exception_handler (_PyFrame_GetCode (frame ), offset , & level , & handler , & lasti ) == 0 ) {
951- // No handlers, so exit.
952- assert (_PyErr_Occurred (tstate ));
953-
954- /* Pop remaining stack entries. */
955- _PyStackRef * stackbase = _PyFrame_Stackbase (frame );
956- while (stack_pointer > stackbase ) {
957- PyStackRef_XCLOSE (POP ());
958- }
959- assert (STACK_LEVEL () == 0 );
960- _PyFrame_SetStackPointer (frame , stack_pointer );
961- monitor_unwind (tstate , frame , next_instr - 1 );
962- goto exit_unwind ;
963- }
964-
965- assert (STACK_LEVEL () >= level );
966- _PyStackRef * new_top = _PyFrame_Stackbase (frame ) + level ;
967- while (stack_pointer > new_top ) {
968- PyStackRef_XCLOSE (POP ());
969- }
970- if (lasti ) {
971- int frame_lasti = _PyInterpreterFrame_LASTI (frame );
972- PyObject * lasti = PyLong_FromLong (frame_lasti );
973- if (lasti == NULL ) {
974- goto exception_unwind ;
975- }
976- PUSH (PyStackRef_FromPyObjectSteal (lasti ));
977- }
978-
979- /* Make the raw exception data
980- available to the handler,
981- so a program can emulate the
982- Python main loop. */
983- PyObject * exc = _PyErr_GetRaisedException (tstate );
984- PUSH (PyStackRef_FromPyObjectSteal (exc ));
985- next_instr = _PyFrame_GetBytecode (frame ) + handler ;
986-
987- if (monitor_handled (tstate , frame , next_instr , exc ) < 0 ) {
988- goto exception_unwind ;
989- }
990- /* Resume normal execution */
991- #ifdef LLTRACE
992- if (frame -> lltrace >= 5 ) {
993- lltrace_resume_frame (frame );
994- }
995- #endif
996- DISPATCH ();
997- }
998- }
999-
1000- exit_unwind :
1001- assert (_PyErr_Occurred (tstate ));
1002- _Py_LeaveRecursiveCallPy (tstate );
1003- assert (frame != & entry_frame );
1004- // GH-99729: We need to unlink the frame *before* clearing it:
1005- _PyInterpreterFrame * dying = frame ;
1006- frame = tstate -> current_frame = dying -> previous ;
1007- _PyEval_FrameClearAndPop (tstate , dying );
1008- frame -> return_offset = 0 ;
1009- if (frame == & entry_frame ) {
1010- /* Restore previous frame and exit */
1011- tstate -> current_frame = frame -> previous ;
1012- tstate -> c_recursion_remaining += PY_EVAL_C_STACK_UNITS ;
1013- return NULL ;
1014- }
1015-
1016- resume_with_error :
1017- next_instr = frame -> instr_ptr ;
1018- stack_pointer = _PyFrame_GetStackPointer (frame );
1019- goto error ;
1020-
1021-
1022888#ifdef _Py_TIER2
1023889
1024890// Tier 2 is also here!
0 commit comments