Skip to content

GH-118095: Allow a variant of RESUME_CHECK in tier 2 #118286

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 4 commits into from
Apr 29, 2024
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
204 changes: 103 additions & 101 deletions Include/internal/pycore_uop_ids.h

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

8 changes: 8 additions & 0 deletions Include/internal/pycore_uop_metadata.h

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

23 changes: 23 additions & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4222,6 +4222,29 @@ dummy_func(
GOTO_UNWIND();
}

/* Special version of RESUME_CHECK that (when paired with _EVAL_BREAKER_EXIT)
* is safe for tier 2. Progress is guaranteed because _EVAL_BREAKER_EXIT calls
* _Py_HandlePending which clears the eval_breaker so that _TIER2_RESUME_CHECK
* will not exit if it is immediately executed again. */
tier2 op(_TIER2_RESUME_CHECK, (--)) {
#if defined(__EMSCRIPTEN__)
EXIT_IF(_Py_emscripten_signal_clock == 0);
_Py_emscripten_signal_clock -= Py_EMSCRIPTEN_SIGNAL_HANDLING;
#endif
uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker);
EXIT_IF(eval_breaker & _PY_EVAL_EVENTS_MASK);
EXIT_IF(eval_breaker == FT_ATOMIC_LOAD_UINTPTR_ACQUIRE(_PyFrame_GetCode(frame)->_co_instrumentation_version));
}

tier2 op(_EVAL_BREAKER_EXIT, (--)) {
_Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY();
QSBR_QUIESCENT_STATE(tstate);
if (_Py_HandlePending(tstate) != 0) {
GOTO_UNWIND();
}
EXIT_TO_TRACE();
}

// END BYTECODES //

}
Expand Down
28 changes: 28 additions & 0 deletions Python/executor_cases.c.h

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

Loading
Loading