Skip to content

Commit 4aab2df

Browse files
Move specializing ddetection to specialize inst
1 parent 5733455 commit 4aab2df

File tree

7 files changed

+73
-751
lines changed

7 files changed

+73
-751
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/test/test_generated_cases.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,6 @@ def test_predictions(self):
329329
if (xxx) {
330330
UPDATE_MISS_STATS(OP1);
331331
assert(_PyOpcode_Deopt[opcode] == (OP1));
332-
#if _Py_TIER2
333-
tstate->interp->jit_state.specialize_counter++;
334-
#endif
335332
JUMP_TO_PREDICTED(OP1);
336333
}
337334
res = Py_None;

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,7 +2939,7 @@ dummy_func(
29392939
JUMP_BACKWARD_JIT,
29402940
};
29412941

2942-
tier1 op(_SPECIALIZE_JUMP_BACKWARD, (--)) {
2942+
specializing tier1 op(_SPECIALIZE_JUMP_BACKWARD, (--)) {
29432943
#if ENABLE_SPECIALIZATION
29442944
if (this_instr->op.code == JUMP_BACKWARD) {
29452945
uint8_t desired = tstate->interp->jit ? JUMP_BACKWARD_JIT : JUMP_BACKWARD_NO_JIT;

Python/ceval_macros.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
#if (_Py_TAIL_CALL_INTERP || USE_COMPUTED_GOTOS) && _Py_TIER2
137137
# define IS_JIT_TRACING() (DISPATCH_TABLE_VAR == TRACING_DISPATCH_TABLE)
138138
// Required to not get stuck in infinite specialization loops due to specialization failure.
139-
# define IS_JIT_TRACING_MAKING_PROGRESS() (IS_JIT_TRACING() && tstate->interp->jit_state.specialize_counter <= 2)
139+
# define IS_JIT_TRACING_MAKING_PROGRESS() (IS_JIT_TRACING() && tstate->interp->jit_state.specialize_counter < 1)
140140
# define ENTER_TRACING() \
141141
DISPATCH_TABLE_VAR = TRACING_DISPATCH_TABLE;
142142
# define LEAVE_TRACING() \
@@ -192,31 +192,12 @@ do { \
192192
DISPATCH_GOTO_NON_TRACING(); \
193193
}
194194

195-
#if _Py_TIER2
196195
#define DISPATCH_SAME_OPARG() \
197196
{ \
198-
tstate->interp->jit_state.specialize_counter++; \
199197
opcode = next_instr->op.code; \
200198
PRE_DISPATCH_GOTO(); \
201199
DISPATCH_GOTO_NON_TRACING(); \
202200
}
203-
#define DISPATCH_INLINED(NEW_FRAME) \
204-
do { \
205-
assert(tstate->interp->eval_frame == NULL); \
206-
_PyFrame_SetStackPointer(frame, stack_pointer); \
207-
assert((NEW_FRAME)->previous == frame); \
208-
frame = tstate->current_frame = (NEW_FRAME); \
209-
CALL_STAT_INC(inlined_py_calls); \
210-
JUMP_TO_LABEL(start_frame); \
211-
} while (0)
212-
#else
213-
214-
#define DISPATCH_SAME_OPARG() \
215-
{ \
216-
opcode = next_instr->op.code; \
217-
PRE_DISPATCH_GOTO(); \
218-
DISPATCH_GOTO(); \
219-
}
220201

221202
#define DISPATCH_INLINED(NEW_FRAME) \
222203
do { \
@@ -227,7 +208,6 @@ do { \
227208
CALL_STAT_INC(inlined_py_calls); \
228209
JUMP_TO_LABEL(start_frame); \
229210
} while (0)
230-
#endif
231211

232212

233213
/* Tuple access macros */

0 commit comments

Comments
 (0)