@@ -827,7 +827,7 @@ instrument_per_instruction(PyCodeObject *code, _Py_CODEUNIT *bytecode,
827827static void
828828remove_tools (PyCodeObject * code , int offset , int event , int tools )
829829{
830- ASSERT_WORLD_STOPPED_OR_LOCKED ( code );
830+ ASSERT_WORLD_STOPPED ( );
831831 assert (event != PY_MONITORING_EVENT_LINE );
832832 assert (event != PY_MONITORING_EVENT_INSTRUCTION );
833833 assert (PY_MONITORING_IS_INSTRUMENTED_EVENT (event ));
@@ -863,7 +863,7 @@ tools_is_subset_for_event(PyCodeObject * code, int event, int tools)
863863static void
864864remove_line_tools (PyCodeObject * code , int offset , int tools )
865865{
866- ASSERT_WORLD_STOPPED_OR_LOCKED ( code );
866+ ASSERT_WORLD_STOPPED ( );
867867
868868 _PyCoMonitoringData * monitoring = code -> _co_monitoring ;
869869 assert (monitoring );
@@ -888,7 +888,7 @@ remove_line_tools(PyCodeObject * code, int offset, int tools)
888888static void
889889add_tools (PyCodeObject * code , int offset , int event , int tools )
890890{
891- ASSERT_WORLD_STOPPED_OR_LOCKED ( code );
891+ ASSERT_WORLD_STOPPED ( );
892892 assert (event != PY_MONITORING_EVENT_LINE );
893893 assert (event != PY_MONITORING_EVENT_INSTRUCTION );
894894 assert (PY_MONITORING_IS_INSTRUMENTED_EVENT (event ));
@@ -909,7 +909,7 @@ add_tools(PyCodeObject * code, int offset, int event, int tools)
909909static void
910910add_line_tools (PyCodeObject * code , int offset , int tools )
911911{
912- ASSERT_WORLD_STOPPED_OR_LOCKED ( code );
912+ ASSERT_WORLD_STOPPED ( );
913913
914914 assert (tools_is_subset_for_event (code , PY_MONITORING_EVENT_LINE , tools ));
915915 assert (code -> _co_monitoring );
@@ -927,7 +927,7 @@ add_line_tools(PyCodeObject * code, int offset, int tools)
927927static void
928928add_per_instruction_tools (PyCodeObject * code , int offset , int tools )
929929{
930- ASSERT_WORLD_STOPPED_OR_LOCKED ( code );
930+ ASSERT_WORLD_STOPPED ( );
931931
932932 assert (tools_is_subset_for_event (code , PY_MONITORING_EVENT_INSTRUCTION , tools ));
933933 assert (code -> _co_monitoring );
@@ -1190,9 +1190,9 @@ call_instrumentation_vector(
11901190 break ;
11911191 }
11921192 else {
1193- LOCK_CODE ( code );
1193+ _PyEval_StopTheWorld ( tstate -> interp );
11941194 remove_tools (code , offset , event , 1 << tool );
1195- UNLOCK_CODE ( );
1195+ _PyEval_StartTheWorld ( tstate -> interp );
11961196 }
11971197 }
11981198 }
@@ -1773,7 +1773,7 @@ update_instrumentation_data(PyCodeObject *code, PyInterpreterState *interp)
17731773static int
17741774force_instrument_lock_held (PyCodeObject * code , PyInterpreterState * interp )
17751775{
1776- ASSERT_WORLD_STOPPED_OR_LOCKED ( code );
1776+ ASSERT_WORLD_STOPPED ( );
17771777
17781778#ifdef _Py_TIER2
17791779 if (code -> co_executors != NULL ) {
@@ -1904,7 +1904,7 @@ force_instrument_lock_held(PyCodeObject *code, PyInterpreterState *interp)
19041904static int
19051905instrument_lock_held (PyCodeObject * code , PyInterpreterState * interp )
19061906{
1907- ASSERT_WORLD_STOPPED_OR_LOCKED ( code );
1907+ ASSERT_WORLD_STOPPED ( );
19081908
19091909 if (is_version_up_to_date (code , interp )) {
19101910 assert (
@@ -1921,9 +1921,9 @@ int
19211921_Py_Instrument (PyCodeObject * code , PyInterpreterState * interp )
19221922{
19231923 int res ;
1924- LOCK_CODE ( code );
1924+ _PyEval_StopTheWorld ( interp );
19251925 res = instrument_lock_held (code , interp );
1926- UNLOCK_CODE ( );
1926+ _PyEval_StartTheWorld ( interp );
19271927 return res ;
19281928}
19291929
0 commit comments