Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-103615: Use local events for opcode tracing #109472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove f_opcode_trace_set and fix a bug
  • Loading branch information
gaogaotiantian committed Sep 15, 2023
commit dfc5aa6dba9a86ed8a545e642caef497f5ce69ce
1 change: 0 additions & 1 deletion 1 Include/internal/pycore_interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ struct _is {
uint32_t next_func_version;

_Py_GlobalMonitors monitors;
bool f_opcode_trace_set;
bool sys_profile_initialized;
bool sys_trace_initialized;
Py_ssize_t sys_profiling_threads; /* Count of threads with c_profilefunc set */
Expand Down
1 change: 0 additions & 1 deletion 1 Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ frame_settrace_opcodes(PyFrameObject *f, PyObject* value, void *Py_UNUSED(ignore
}
if (value == Py_True) {
f->f_trace_opcodes = 1;
_PyInterpreterState_GET()->f_opcode_trace_set = true;
if (f->f_trace) {
return _PyEval_SetOpcodeTrace(f, true);
}
Expand Down
4 changes: 2 additions & 2 deletions 4 Python/legacy_tracing.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ sys_trace_instruction_func(
"Missing frame when calling trace function.");
return NULL;
}
if (!frame->f_trace_opcodes) {
PyThreadState *tstate = _PyThreadState_GET();
if (!tstate->c_tracefunc || !frame->f_trace_opcodes) {
if (_PyEval_SetOpcodeTrace(frame, false) != 0) {
return NULL;
}
Py_RETURN_NONE;
}
Py_INCREF(frame);
PyThreadState *tstate = _PyThreadState_GET();
int err = tstate->c_tracefunc(tstate->c_traceobj, frame, self->event, Py_None);
frame->f_lineno = 0;
Py_DECREF(frame);
Expand Down
2 changes: 0 additions & 2 deletions 2 Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ init_interpreter(PyInterpreterState *interp,
/* Fix the self-referential, statically initialized fields. */
interp->dtoa = (struct _dtoa_state)_dtoa_state_INIT(interp);
}
interp->f_opcode_trace_set = false;
interp->_initialized = 1;
return _PyStatus_OK();
}
Expand Down Expand Up @@ -947,7 +946,6 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
interp->code_watchers[i] = NULL;
}
interp->active_code_watchers = 0;
interp->f_opcode_trace_set = false;
// XXX Once we have one allocator per interpreter (i.e.
// per-interpreter GC) we must ensure that all of the interpreter's
// objects have been cleaned up at the point.
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.