Skip to content

Commit 9438c19

Browse files
committed
Zero out unused registers to reduce register pressure
1 parent 51d4342 commit 9438c19

File tree

3 files changed

+456
-0
lines changed

3 files changed

+456
-0
lines changed

Include/internal/pycore_stackref.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ static const _PyStackRef PyStackRef_ERROR = { .index = 2 };
7070
#define PyStackRef_False ((_PyStackRef){ .index = 6 })
7171
#define PyStackRef_True ((_PyStackRef){ .index = 8 })
7272

73+
#define PyStackRef_ZERO_BITS PyStackRef_NULL
74+
75+
7376
#define INITIAL_STACKREF_INDEX 10
7477

7578
static inline int
@@ -264,6 +267,10 @@ PyStackRef_IsNullOrInt(_PyStackRef ref);
264267

265268
static const _PyStackRef PyStackRef_ERROR = { .bits = Py_TAG_INVALID };
266269

270+
/* For use in the JIT to clear an unused value.
271+
* PyStackRef_ZERO_BITS has no meaning and should not be used other than by the JIT. */
272+
static const _PyStackRef PyStackRef_ZERO_BITS = { .bits = 0 };
273+
267274
/* Wrap a pointer in a stack ref.
268275
* The resulting stack reference is not safe and should only be used
269276
* in the interpreter to pass values from one uop to another.

0 commit comments

Comments
 (0)