mirror of
https://github.com/python/cpython.git
synced 2026-02-27 09:31:19 +00:00
gh-141504: Factor out tracing and optimization heuristics into a single object (gh-143381)
This commit is contained in:
parent
3c56f9e2cc
commit
12283f6373
7 changed files with 67 additions and 14 deletions
|
|
@ -113,7 +113,7 @@ insert_executor(PyCodeObject *code, _Py_CODEUNIT *instr, int index, _PyExecutorO
|
|||
}
|
||||
|
||||
static _PyExecutorObject *
|
||||
make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFilter *dependencies, int chain_depth);
|
||||
make_executor_from_uops(_PyThreadStateImpl *tstate, _PyUOpInstruction *buffer, int length, const _PyBloomFilter *dependencies);
|
||||
|
||||
static int
|
||||
uop_optimize(_PyInterpreterFrame *frame, PyThreadState *tstate,
|
||||
|
|
@ -1328,7 +1328,7 @@ sanity_check(_PyExecutorObject *executor)
|
|||
* and not a NOP.
|
||||
*/
|
||||
static _PyExecutorObject *
|
||||
make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFilter *dependencies, int chain_depth)
|
||||
make_executor_from_uops(_PyThreadStateImpl *tstate, _PyUOpInstruction *buffer, int length, const _PyBloomFilter *dependencies)
|
||||
{
|
||||
int exit_count = count_exits(buffer, length);
|
||||
_PyExecutorObject *executor = allocate_executor(exit_count, length);
|
||||
|
|
@ -1337,12 +1337,13 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
|
|||
}
|
||||
|
||||
/* Initialize exits */
|
||||
int chain_depth = tstate->jit_tracer_state.initial_state.chain_depth;
|
||||
_PyExecutorObject *cold = _PyExecutor_GetColdExecutor();
|
||||
_PyExecutorObject *cold_dynamic = _PyExecutor_GetColdDynamicExecutor();
|
||||
cold->vm_data.chain_depth = chain_depth;
|
||||
for (int i = 0; i < exit_count; i++) {
|
||||
executor->exits[i].index = i;
|
||||
executor->exits[i].temperature = initial_temperature_backoff_counter();
|
||||
executor->exits[i].temperature = initial_temperature_backoff_counter(&tstate->policy);
|
||||
}
|
||||
int next_exit = exit_count-1;
|
||||
_PyUOpInstruction *dest = (_PyUOpInstruction *)&executor->trace[length];
|
||||
|
|
@ -1510,7 +1511,7 @@ uop_optimize(
|
|||
length = prepare_for_execution(buffer, length);
|
||||
assert(length <= UOP_MAX_TRACE_LENGTH);
|
||||
_PyExecutorObject *executor = make_executor_from_uops(
|
||||
buffer, length, dependencies, _tstate->jit_tracer_state.initial_state.chain_depth);
|
||||
_tstate, buffer, length, dependencies);
|
||||
if (executor == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue