Skip to content

Commit a7f9df3

Browse files
committed
remove _INTERNAL_INCREMENT_OPT_COUNTER
1 parent d763008 commit a7f9df3

File tree

6 files changed

+88
-153
lines changed

6 files changed

+88
-153
lines changed

Include/internal/pycore_uop_ids.h

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

Include/internal/pycore_uop_metadata.h

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

Python/bytecodes.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5065,13 +5065,6 @@ dummy_func(
50655065
DECREF_INPUTS();
50665066
}
50675067

5068-
/* Internal -- for testing executors */
5069-
op(_INTERNAL_INCREMENT_OPT_COUNTER, (opt --)) {
5070-
_PyCounterOptimizerObject *exe = (_PyCounterOptimizerObject *)PyStackRef_AsPyObjectBorrow(opt);
5071-
exe->count++;
5072-
DEAD(opt);
5073-
}
5074-
50755068
tier2 op(_DYNAMIC_EXIT, (exit_p/4 --)) {
50765069
tstate->previous_executor = (PyObject *)current_executor;
50775070
_PyExitData *exit = (_PyExitData *)exit_p;

Python/executor_cases.c.h

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

Python/optimizer.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,43 +1352,6 @@ PyTypeObject _PyCounterExecutor_Type = {
13521352
.tp_clear = (inquiry)executor_clear,
13531353
};
13541354

1355-
static int
1356-
counter_optimize(
1357-
_PyOptimizerObject* self,
1358-
_PyInterpreterFrame *frame,
1359-
_Py_CODEUNIT *instr,
1360-
_PyExecutorObject **exec_ptr,
1361-
int Py_UNUSED(curr_stackentries),
1362-
bool Py_UNUSED(progress_needed)
1363-
)
1364-
{
1365-
PyCodeObject *code = _PyFrame_GetCode(frame);
1366-
int oparg = instr->op.arg;
1367-
while (instr->op.code == EXTENDED_ARG) {
1368-
instr++;
1369-
oparg = (oparg << 8) | instr->op.arg;
1370-
}
1371-
if (instr->op.code != JUMP_BACKWARD) {
1372-
/* Counter optimizer can only handle backward edges */
1373-
return 0;
1374-
}
1375-
_Py_CODEUNIT *target = instr + 1 + _PyOpcode_Caches[JUMP_BACKWARD] - oparg;
1376-
_PyUOpInstruction buffer[4] = {
1377-
{ .opcode = _START_EXECUTOR, .jump_target = 3, .format=UOP_FORMAT_JUMP },
1378-
{ .opcode = _LOAD_CONST_INLINE, .operand0 = (uintptr_t)self },
1379-
{ .opcode = _INTERNAL_INCREMENT_OPT_COUNTER },
1380-
{ .opcode = _EXIT_TRACE, .target = (uint32_t)(target - _PyCode_CODE(code)), .format=UOP_FORMAT_TARGET }
1381-
};
1382-
_PyExecutorObject *executor = make_executor_from_uops(buffer, 4, &EMPTY_FILTER);
1383-
if (executor == NULL) {
1384-
return -1;
1385-
}
1386-
Py_INCREF(self);
1387-
Py_SET_TYPE(executor, &_PyCounterExecutor_Type);
1388-
*exec_ptr = executor;
1389-
return 1;
1390-
}
1391-
13921355
static PyObject *
13931356
counter_get_counter(PyObject *self, PyObject *args)
13941357
{

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)