Skip to content

Commit 33903c5

Browse files
authored
GH-116017: Get rid of _COLD_EXITs (GH-120960)
1 parent 294e724 commit 33903c5

File tree

16 files changed

+246
-337
lines changed

16 files changed

+246
-337
lines changed

Include/internal/pycore_backoff.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ initial_jump_backoff_counter(void)
122122
* otherwise when a side exit warms up we may construct
123123
* a new trace before the Tier 1 code has properly re-specialized.
124124
* Backoff sequence 64, 128, 256, 512, 1024, 2048, 4096. */
125-
#define COLD_EXIT_INITIAL_VALUE 64
126-
#define COLD_EXIT_INITIAL_BACKOFF 6
125+
#define SIDE_EXIT_INITIAL_VALUE 64
126+
#define SIDE_EXIT_INITIAL_BACKOFF 6
127127

128128
static inline _Py_BackoffCounter
129129
initial_temperature_backoff_counter(void)
130130
{
131-
return make_backoff_counter(COLD_EXIT_INITIAL_VALUE,
132-
COLD_EXIT_INITIAL_BACKOFF);
131+
return make_backoff_counter(SIDE_EXIT_INITIAL_VALUE,
132+
SIDE_EXIT_INITIAL_BACKOFF);
133133
}
134134

135135
/* Unreachable backoff counter. */

Include/internal/pycore_code.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ write_location_entry_start(uint8_t *ptr, int code, int length)
535535
#define ADAPTIVE_COOLDOWN_BACKOFF 0
536536

537537
// Can't assert this in pycore_backoff.h because of header order dependencies
538-
static_assert(COLD_EXIT_INITIAL_VALUE > ADAPTIVE_COOLDOWN_VALUE,
538+
static_assert(SIDE_EXIT_INITIAL_VALUE > ADAPTIVE_COOLDOWN_VALUE,
539539
"Cold exit value should be larger than adaptive cooldown value");
540540

541541
static inline _Py_BackoffCounter

Include/internal/pycore_optimizer.h

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,18 @@ typedef struct {
4141
* the 32 bits between the oparg and operand are:
4242
* UOP_FORMAT_TARGET:
4343
* uint32_t target;
44-
* UOP_FORMAT_EXIT
45-
* uint16_t exit_index;
46-
* uint16_t error_target;
4744
* UOP_FORMAT_JUMP
4845
* uint16_t jump_target;
4946
* uint16_t error_target;
5047
*/
5148
typedef struct {
52-
uint16_t opcode:14;
53-
uint16_t format:2;
49+
uint16_t opcode:15;
50+
uint16_t format:1;
5451
uint16_t oparg;
5552
union {
5653
uint32_t target;
5754
struct {
58-
union {
59-
uint16_t exit_index;
60-
uint16_t jump_target;
61-
};
55+
uint16_t jump_target;
6256
uint16_t error_target;
6357
};
6458
};
@@ -160,22 +154,14 @@ struct _Py_UopsSymbol {
160154
};
161155

162156
#define UOP_FORMAT_TARGET 0
163-
#define UOP_FORMAT_EXIT 1
164-
#define UOP_FORMAT_JUMP 2
165-
#define UOP_FORMAT_UNUSED 3
157+
#define UOP_FORMAT_JUMP 1
166158

167159
static inline uint32_t uop_get_target(const _PyUOpInstruction *inst)
168160
{
169161
assert(inst->format == UOP_FORMAT_TARGET);
170162
return inst->target;
171163
}
172164

173-
static inline uint16_t uop_get_exit_index(const _PyUOpInstruction *inst)
174-
{
175-
assert(inst->format == UOP_FORMAT_EXIT);
176-
return inst->exit_index;
177-
}
178-
179165
static inline uint16_t uop_get_jump_target(const _PyUOpInstruction *inst)
180166
{
181167
assert(inst->format == UOP_FORMAT_JUMP);

Include/internal/pycore_uop_ids.h

Lines changed: 112 additions & 113 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)