8000 gh-117139: Add header for tagged pointers by Fidget-Spinner · Pull Request #118330 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-117139: Add header for tagged pointers #118330

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 19 commits into from
Apr 30, 2024
Merged
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
cleanup
  • Loading branch information
Fidget-Spinner committed Apr 26, 2024
commit f783bc4e0cec6519def85cf21e475dd1cdf5c69a
21 changes: 2 additions & 19 deletions Include/internal/pycore_tagged.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,6 @@ _Py_untag_stack_owned(PyObject **dst, const _PyStackRef *src, size_t length) {
#define Py_DECREF_STACKREF(op) Py_DECREF(Py_STACKREF_UNTAG_BORROWED(op))
#endif

#if defined(Py_GIL_DISABLED)
static inline _PyStackRef
_Py_NewRef_StackRef_Owned(_PyStackRef tagged) {
if ((tagged.bits & Py_TAG_DEFERRED) == Py_TAG_DEFERRED) {
Py_INCREF(Py_STACKREF_UNTAG_BORROWED(tagged));
uintptr_t res = tagged.bits & (~Py_TAG_DEFERRED);
return ((_PyStackRef){.bits = res});
}
return tagged;
}
#define Py_NEWREF_STACKREF_OWNED(op) _Py_NewRef_StackRef_Owned(op)
#else
#define Py_NEWREF_STACKREF_OWNED(op) (op)
#endif

#define Py_DECREF_STACKREF_OWNED(op) Py_DECREF(Py_STACKREF_UNTAG_BORROWED(op));

#if defined(Py_GIL_DISABLED)
static inline void
_Py_IncRef_StackRef(_PyStackRef tagged) {
Expand All @@ -193,14 +176,14 @@ _Py_XDECREF_STACKREF(_PyStackRef op)
#define Py_XDECREF_STACKREF(op) _Py_XDECREF_STACKREF(op)

static inline _PyStackRef
Py_NewRef_StackRef(_PyStackRef obj)
_Py_NewRef_StackRef(_PyStackRef obj)
{
Py_INCREF_STACKREF(obj);
return obj;
}


#define Py_NewRef_StackRef(op) Py_NewRef_StackRef(op)
#define Py_NewRef_StackRef(op) _Py_NewRef_StackRef(op)

#ifdef __cplusplus
}
Expand Down
0