diff --git a/Include/cinder/hooks.h b/Include/cinder/hooks.h index eb66d94e3d7..36bbc2d1ac3 100644 --- a/Include/cinder/hooks.h +++ b/Include/cinder/hooks.h @@ -20,14 +20,9 @@ CiAPI_DATA(int8_t) Ci_cinderx_initialized; /* Hooks for JIT type profiling. */ typedef void(*Ci_TypeCallback)(PyTypeObject *type); -CiAPI_DATA(Ci_TypeCallback) Ci_hook_type_created; CiAPI_DATA(Ci_TypeCallback) Ci_hook_type_destroyed; CiAPI_DATA(Ci_TypeCallback) Ci_hook_type_name_modified; -typedef int (*Ci_HookType_JIT_GetProfileNewInterpThread)(void); -CiAPI_DATA(Ci_HookType_JIT_GetProfileNewInterpThread) - Ci_hook_JIT_GetProfileNewInterpThread; - /* Hooks for JIT Shadow frames*/ typedef PyFrameObject *(*Ci_HookType_JIT_GetFrame)(PyThreadState *tstate); diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index c9fa531225e..a25ea7074f8 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -152,13 +152,6 @@ struct _ts { /* The current top of the shadow frame stack; analogous to the frame member * up above. */ struct _PyShadowFrame *shadow_frame; - - /* TODO(T123968561): Put remaining fields somewhere CinderX-specific. */ - - /* 0 or 1 to indicate if this thread has interpreter type profiling - * enabled. */ - char profile_interp; - }; // Alias for backward compatibility with Python 3.8 diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 0a252c47513..124d88ae84b 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -45,13 +45,6 @@ struct _ceval_state { #ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS struct _gil_runtime_state gil; #endif - - /* TODO(T123968561): Put remaining fields somewhere CinderX-specific. */ - - /* Global instruction counter used by interpreter type profiling. */ - long profile_instr_counter; - /* Configurable period for interpreter type profiling. */ - long profile_instr_period; }; /* fs_codec.encoding is initialized to NULL. diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index 05bc6012f81..8328ba2e144 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -50,8 +50,7 @@ _Py_ThreadCanHandlePendingCalls(void) static inline int _Py_ThreadStateHasTracing(PyThreadState* ts) { - return ts->c_tracefunc != NULL || ts->c_profilefunc != NULL || - ts->profile_interp; + return ts->c_tracefunc != NULL || ts->c_profilefunc != NULL; } /* Variable and macro for in-line access to current thread diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 566febae446..cafa3efa8f3 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3469,9 +3469,6 @@ type_new_impl(type_new_ctx *ctx) } assert(_PyType_CheckConsistency(type)); - if (Ci_hook_type_created) { - Ci_hook_type_created(type); - } return (PyObject *)type; error: @@ -6909,11 +6906,6 @@ PyType_Ready(PyTypeObject *type) /* All done -- set the ready flag */ type->tp_flags = (type->tp_flags & ~Py_TPFLAGS_READYING) | Py_TPFLAGS_READY; assert(_PyType_CheckConsistency(type)); - if (Ci_hook_type_created && !PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) { - /* type_new_impl() has more work to do on heap types; only tell the callback - * about static types right here. */ - Ci_hook_type_created(type); - } return 0; } diff --git a/Python/ceval.c b/Python/ceval.c index 42340ecf264..c9afe67167d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -862,10 +862,6 @@ _PyEval_InitState(struct _ceval_state *ceval) _gil_initialize(&ceval->gil); #endif - // Added for Cinder - ceval->profile_instr_counter = 0; - ceval->profile_instr_period = 0; - return 0; } diff --git a/Python/cinderhooks.c b/Python/cinderhooks.c index 064e4af2e88..01cc2633d2b 100644 --- a/Python/cinderhooks.c +++ b/Python/cinderhooks.c @@ -11,10 +11,8 @@ int _PyShadow_PolymorphicCacheEnabled = 1; int8_t Ci_cinderx_initialized = 0; /* JIT type profiling. */ -Ci_TypeCallback Ci_hook_type_created = NULL; Ci_TypeCallback Ci_hook_type_destroyed = NULL; Ci_TypeCallback Ci_hook_type_name_modified = NULL; -Ci_HookType_JIT_GetProfileNewInterpThread Ci_hook_JIT_GetProfileNewInterpThread = NULL; /* Hooks for JIT Shadow frames*/ Ci_HookType_JIT_GetFrame Ci_hook_JIT_GetFrame = NULL; diff --git a/Python/pystate.c b/Python/pystate.c index e20e85ea8ac..6bf6af25224 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -687,11 +687,6 @@ new_threadstate(PyInterpreterState *interp, int init) interp->tstate_head = tstate; HEAD_UNLOCK(runtime); - tstate->profile_interp = 0; - if (Ci_hook_JIT_GetProfileNewInterpThread != NULL && Ci_hook_JIT_GetProfileNewInterpThread()) { - Ci_ThreadState_SetProfileInterp(tstate, 1); - } - return tstate; } @@ -1333,33 +1328,6 @@ _PyThread_CurrentExceptions(void) return result; } -void Ci_ThreadState_SetProfileInterpAll(int enabled) { - PyThreadState *tstate; - _PyRuntimeState *runtime = &_PyRuntime; - - HEAD_LOCK(runtime); - for (tstate = _PyThreadState_GET()->interp->tstate_head; - tstate != NULL; - tstate = tstate->next) { - Ci_ThreadState_SetProfileInterp(tstate, enabled); - } - HEAD_UNLOCK(runtime); -} - -void -Ci_ThreadState_SetProfileInterp(PyThreadState *tstate, int enabled) { - if (!tstate->profile_interp == !enabled) { - return; - } - tstate->profile_interp = !!enabled; - tstate->cframe->use_tracing = _Py_ThreadStateHasTracing(tstate); -} - -void -Ci_RuntimeState_SetProfileInterpPeriod(long period) { - PyThreadState_Get()->interp->ceval.profile_instr_period = period; -} - /* Python "auto thread state" API. */ /* Keep this as a static, as it is not reliable! It can only