10000 GH-98894: Fix `function__return` and `function__entry` dTrace probe missing after `GH-103083` by Zheaoli · Pull Request #125019 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-98894: Fix function__return and function__entry dTrace probe missing after GH-103083 #125019

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
Merge branch 'main' of https://github.com/python/cpython into manjusa…
…ka/fix-dtrace

Signed-off-by: Manjusaka <me@manjusaka.me>
  • Loading branch information
Zheaoli committed May 22, 2025
commit e98e3a21ab9bd6161c30d9563ec014bd1b2308d4
2 changes: 1 addition & 1 deletion Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,8 @@ dummy_func(
_PyStackRef temp = PyStackRef_MakeHeapSafe(retval);
DEAD(retval);
SAVE_STACK();
assert(STACK_LEVEL() == 0);
DTRACE_FUNCTION_EXIT();
assert(EMPTY());
_Py_LeaveRecursiveCallPy(tstate);
// GH-99729: We need to unlink the frame *before* clearing it:
_PyInterpreterFrame *dying = frame;
Expand Down
65 changes: 10 additions & 55 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,23 +1017,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
_PyEntryFrame entry;

if (_Py_EnterRecursiveCallTstate(tstate, "")) {
tstate->c_recursion_remaining--;
tstate->py_recursion_remaining--;
goto exit_unwind;
}

/* support for generator.throw() */
if (throwflag) {
if (_Py_EnterRecursivePy(tstate)) {
goto exit_unwind;
}
/* Because this avoids the RESUME,
* we need to update instrumentation */
_Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
monitor_throw(tstate, frame, frame->instr_ptr);
/* TO DO -- Monitor throw entry. */
DTRACE_FUNCTION_ENTRY();
goto resume_with_error;
assert(frame->owner != FRAME_OWNED_BY_INTERPRETER);
_PyEval_FrameClearAndPop(tstate, frame);
return NULL;
}

/* Local "register" variables.
Expand Down Expand Up @@ -1092,6 +1078,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
#endif
/* Because this avoids the RESUME, we need to update instrumentation */
_Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
DTRACE_FUNCTION_ENTRY();
next_instr = frame->instr_ptr;
monitor_throw(tstate, frame, next_instr);
stack_pointer = _PyFrame_GetStackPointer(frame);
Expand All @@ -1111,46 +1098,14 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
_PyExecutorObject *current_executor = NULL;
const _PyUOpInstruction *next_uop = NULL;
#endif

start_frame:
if (_Py_EnterRecursivePy(tstate)) {
goto exit_unwind;
}

next_instr = frame->instr_ptr;
DTRACE_FUNCTION_ENTRY();
resume_frame:
stack_pointer = _PyFrame_GetStackPointer(frame);

#ifdef LLTRACE
lltrace = maybe_lltrace_resume_frame(frame, &entry_frame, GLOBALS());
if (lltrace < 0) {
goto exit_unwind;
}
#endif

#ifdef Py_DEBUG
/* _PyEval_EvalFrameDefault() must not be called with an exception set,
because it can clear it (directly or indirectly) and so the
caller loses its exception */
assert(!_PyErr_Occurred(tstate));
#endif

DISPATCH();

{
/* Start instructions */
#if !USE_COMPUTED_GOTOS
dispatch_opcode:
switch (opcode)
#endif
{

#include "generated_cases.c.h"


#if USE_COMPUTED_GOTOS
_unknown_opcode:
#if Py_TAIL_CALL_INTERP
# if Py_STATS
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0, lastopcode);
# else
return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, 0);
# endif
#else
goto start_frame;
# include "generated_cases.c.h"
Expand Down
2 changes: 1 addition & 1 deletion Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 8 additions & 75 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Tools/jit/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include "pycore_sliceobject.h"
#include "pycore_stackref.h"
#include "pydtrace.h"
#include "pycore_template.h"
#include "pycore_tuple.h"
#include "pycore_unicodeobject.h"

#include "ceval_macros.h"

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0