Skip to content

Commit b74e160

Browse files
Address review
1 parent 2d779c4 commit b74e160

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ typedef union {
226226
uintptr_t bits;
227227
} JitOptRef;
228228

229-
#define JIT_BITS_TO_PTR(REF) ((JitOptSymbol *)((REF).bits))
230-
#define JIT_BITS_TO_PTR_MASKED(REF) ((JitOptSymbol *)(((REF).bits) & (~Py_TAG_REFCNT)))
229+
#define REF_IS_BORROWED 1
230+
231+
#define JIT_BITS_TO_PTR_MASKED(REF) ((JitOptSymbol *)(((REF).bits) & (~REF_IS_BORROWED)))
231232

232233
static inline JitOptSymbol *
233234
PyJitRef_Unwrap(JitOptRef ref)
@@ -242,22 +243,18 @@ static inline JitOptRef
242243
PyJitRef_Wrap(JitOptSymbol *sym)
243244
{
244245
if (sym == NULL || _Py_uop_symbol_is_immortal(sym)) {
245-
return (JitOptRef){.bits=(uintptr_t)sym | Py_TAG_REFCNT};
246+
return (JitOptRef){.bits=(uintptr_t)sym | REF_IS_BORROWED};
246247
}
247248
return (JitOptRef){.bits=(uintptr_t)sym};
248249
}
249250

250251
static inline JitOptRef
251252
PyJitRef_Borrow(JitOptRef ref)
252253
{
253-
return (JitOptRef){ .bits = ref.bits | Py_TAG_REFCNT };
254+
return (JitOptRef){ .bits = ref.bits | REF_IS_BORROWED };
254255
}
255256

256-
#ifndef Py_GIL_DISABLED
257-
static const JitOptRef PyJitRef_NULL = {.bits = PyStackRef_NULL_BITS};
258-
#else
259-
static const JitOptRef PyJitRef_NULL = {.bits = Py_TAG_DEFERRED};
260-
#endif
257+
static const JitOptRef PyJitRef_NULL = {.bits = REF_IS_BORROWED};
261258

262259
static inline bool
263260
PyJitRef_IsNull(JitOptRef ref)
@@ -268,7 +265,7 @@ PyJitRef_IsNull(JitOptRef ref)
268265
static inline int
269266
PyJitRef_IsBorrowed(JitOptRef ref)
270267
{
271-
return (ref.bits & Py_TAG_REFCNT) == Py_TAG_REFCNT;
268+
return (ref.bits & REF_IS_BORROWED) == REF_IS_BORROWED;
272269
}
273270

274271
struct _Py_UOpsAbstractFrame {

0 commit comments

Comments
 (0)