mirror of
https://github.com/python/cpython.git
synced 2026-01-23 15:48:53 +00:00
gh-143421: Move JitOptContext from stack allocation to per-thread heap allocation (GH-143536)
* move JitOptContext to _PyThreadStateImpl * make _PyUOpInstruction buffer a part of _PyThreadStateImpl Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
cea2d2475d
commit
aeb3403563
6 changed files with 150 additions and 147 deletions
|
|
@ -18,6 +18,7 @@
|
|||
#include "pycore_opcode_metadata.h"
|
||||
#include "pycore_opcode_utils.h"
|
||||
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
||||
#include "pycore_tstate.h" // _PyThreadStateImpl
|
||||
#include "pycore_uop_metadata.h"
|
||||
#include "pycore_long.h"
|
||||
#include "pycore_interpframe.h" // _PyFrame_GetCode
|
||||
|
|
@ -334,7 +335,7 @@ _Py_opt_assert_within_stack_bounds(
|
|||
/* >0 (length) for success, 0 for not ready, clears all possible errors. */
|
||||
static int
|
||||
optimize_uops(
|
||||
PyFunctionObject *func,
|
||||
_PyThreadStateImpl *tstate,
|
||||
_PyUOpInstruction *trace,
|
||||
int trace_len,
|
||||
int curr_stacklen,
|
||||
|
|
@ -342,9 +343,9 @@ optimize_uops(
|
|||
)
|
||||
{
|
||||
assert(!PyErr_Occurred());
|
||||
PyFunctionObject *func = tstate->jit_tracer_state.initial_state.func;
|
||||
|
||||
JitOptContext context;
|
||||
JitOptContext *ctx = &context;
|
||||
JitOptContext *ctx = &tstate->jit_tracer_state.opt_context;
|
||||
uint32_t opcode = UINT16_MAX;
|
||||
|
||||
// Make sure that watchers are set up
|
||||
|
|
@ -574,7 +575,7 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
|
|||
// > 0 - length of optimized trace
|
||||
int
|
||||
_Py_uop_analyze_and_optimize(
|
||||
PyFunctionObject *func,
|
||||
_PyThreadStateImpl *tstate,
|
||||
_PyUOpInstruction *buffer,
|
||||
int length,
|
||||
int curr_stacklen,
|
||||
|
|
@ -584,7 +585,7 @@ _Py_uop_analyze_and_optimize(
|
|||
OPT_STAT_INC(optimizer_attempts);
|
||||
|
||||
length = optimize_uops(
|
||||
func, buffer,
|
||||
tstate, buffer,
|
||||
length, curr_stacklen, dependencies);
|
||||
|
||||
if (length == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue