Skip to content

Commit ebbb2ca

Browse files
authored
gh-144145: Revert PR#144122 for performance and potential bugs. (GH-144391)
Revert "gh-144145: Track nullness of properties in the Tier 2 JIT optimizer (GH-144122)" This reverts commit 1dc12b2.
1 parent c3b61ef commit ebbb2ca

File tree

11 files changed

+902
-1589
lines changed

11 files changed

+902
-1589
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,10 @@ typedef struct _JitOptContext {
3737
// Arena for the symbolic types.
3838
ty_arena t_arena;
3939

40-
// Arena for the descriptor mappings.
41-
descr_arena d_arena;
42-
4340
JitOptRef *n_consumed;
4441
JitOptRef *limit;
4542
JitOptRef locals_and_stack[MAX_ABSTRACT_INTERP_SIZE];
4643
_PyJitUopBuffer out_buffer;
47-
// Index of the last escaped uop in out_buffer.
48-
int last_escape_index;
4944
} JitOptContext;
5045

5146

@@ -300,9 +295,6 @@ extern JitOptRef _Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptRef value,
300295
extern bool _Py_uop_sym_is_compact_int(JitOptRef sym);
301296
extern JitOptRef _Py_uop_sym_new_compact_int(JitOptContext *ctx);
302297
extern void _Py_uop_sym_set_compact_int(JitOptContext *ctx, JitOptRef sym);
303-
extern JitOptRef _Py_uop_sym_new_descr_object(JitOptContext *ctx, unsigned int type_version);
304-
extern JitOptRef _Py_uop_sym_get_attr(JitOptContext *ctx, JitOptRef ref, uint16_t slot_index);
305-
extern JitOptRef _Py_uop_sym_set_attr(JitOptContext *ctx, JitOptRef ref, uint16_t slot_index, JitOptRef value);
306298
extern JitOptRef _Py_uop_sym_new_predicate(JitOptContext *ctx, JitOptRef lhs_ref, JitOptRef rhs_ref, JitOptPredicateKind kind);
307299
extern void _Py_uop_sym_apply_predicate_narrowing(JitOptContext *ctx, JitOptRef sym, bool branch_is_true);
308300

Include/internal/pycore_optimizer_types.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ extern "C" {
1616

1717
#define TY_ARENA_SIZE (UOP_MAX_TRACE_LENGTH * 5)
1818

19-
// Maximum descriptor mappings per object tracked symbolically
20-
#define MAX_SYMBOLIC_DESCR_SIZE 16
21-
#define DESCR_ARENA_SIZE (MAX_SYMBOLIC_DESCR_SIZE * 100)
22-
2319
// Need extras for root frame and for overflow frame (see TRACE_STACK_PUSH())
2420
#define MAX_ABSTRACT_FRAME_DEPTH (16)
2521

@@ -45,7 +41,6 @@ typedef enum _JitSymType {
4541
JIT_SYM_TRUTHINESS_TAG = 9,
4642
JIT_SYM_COMPACT_INT = 10,
4743
JIT_SYM_PREDICATE_TAG = 11,
48-
JIT_SYM_DESCR_TAG = 12,
4944
} JitSymType;
5045

5146
typedef struct _jit_opt_known_class {
@@ -96,31 +91,6 @@ typedef struct {
9691
uint8_t tag;
9792
} JitOptCompactInt;
9893

99-
/*
100-
Mapping from slot index or attribute offset to its symbolic value.
101-
SAFETY:
102-
This structure is used for both STORE_ATTR_SLOT and STORE_ATTR_INSTANCE_VALUE.
103-
These two never appear on the same object type because:
104-
__slots__ classes don't have Py_TPFLAGS_INLINE_VALUES
105-
Therefore, there is no index collision between slot offsets and inline value offsets.
106-
Note:
107-
STORE_ATTR_WITH_HINT is NOT currently tracked.
108-
If we want to track it in the future, we need to be careful about
109-
potential index collisions with STORE_ATTR_INSTANCE_VALUE.
110-
*/
111-
typedef struct {
112-
uint16_t slot_index;
113-
uint16_t symbol;
114-
} JitOptDescrMapping;
115-
116-
typedef struct _jit_opt_descr {
117-
uint8_t tag;
118-
uint8_t num_descrs;
119-
uint16_t last_modified_index; // Index in out_buffer when this object was last modified
120-
uint32_t type_version;
121-
JitOptDescrMapping *descrs;
122-
} JitOptDescrObject;
123-
12494
typedef union _jit_opt_symbol {
12595
uint8_t tag;
12696
JitOptKnownClass cls;
@@ -129,7 +99,6 @@ typedef union _jit_opt_symbol {
12999
JitOptTuple tuple;
130100
JitOptTruthiness truthiness;
131101
JitOptCompactInt compact;
132-
JitOptDescrObject descr;
133102
JitOptPredicate predicate;
134103
} JitOptSymbol;
135104

@@ -159,11 +128,6 @@ typedef struct ty_arena {
159128
JitOptSymbol arena[TY_ARENA_SIZE];
160129
} ty_arena;
161130

162-
typedef struct descr_arena {
163-
int descr_curr_number;
164-
int descr_max_number;
165-
JitOptDescrMapping arena[DESCR_ARENA_SIZE];
166-
} descr_arena;
167131

168132
#ifdef __cplusplus
169133
}

0 commit comments

Comments
 (0)