FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-120501: Fix reference leak in JIT build by Eclips4 · Pull Request #120649 · python/cpython · GitHub

Repository navigation

Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (2) .h  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions Include/internal/pycore_optimizer.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ PyAPI_FUNC(_PyExecutorObject*) _Py_GetExecutor(PyCodeObject *code, int offset);

void _Py_ExecutorInit(_PyExecutorObject *, const _PyBloomFilter *);
void _Py_ExecutorDetach(_PyExecutorObject *);
int _Py_ExecutorClear(PyObject *);
void _Py_BloomFilter_Init(_PyBloomFilter *);
void _Py_BloomFilter_Add(_PyBloomFilter *bloom, void *obj);
PyAPI_FUNC(void) _Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj);
Expand Down
2 changes: 1 addition & 1 deletion Objects/codeobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ clear_executors(PyCodeObject *co)
assert(co->co_executors);
for (int i = 0; i < co->co_executors->size; i++) {
if (co->co_executors->executors[i]) {
_Py_ExecutorDetach(co->co_executors->executors[i]);
_Py_ExecutorClear(co->co_executors->executors[i]);
assert(co->co_executors->executors[i] == NULL);
}
}
Expand Down
14 changes: 12 additions & 2 deletions Python/optimizer.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ uop_dealloc(PyObject *op) {
_PyObject_GC_UNTRACK(self);
assert(self->vm_data.code == NULL);
unlink_executor(self);
for (uint32_t i = 0; i < self->exit_count; i++) {
self->exits[i].temperature = initial_unreachable_backoff_counter();
Py_CLEAR(self->exits[i].executor);
}
#ifdef _Py_JIT
_PyJIT_Free(self);
#endif
Expand Down Expand Up @@ -1424,8 +1428,8 @@ _Py_ExecutorDetach(_PyExecutorObject *executor)
Py_DECREF(executor);
}

static int
executor_clear(PyObject *op)
int
_Py_ExecutorClear(PyObject *op)
{
_PyExecutorObject *executor = _PyExecutorObject_CAST(op);
if (!executor->vm_data.valid) {
Expand All @@ -1448,6 +1452,12 @@ executor_clear(PyObject *op)
return 0;
}
Comment thread
Eclips4 marked this conversation as resolved.

static int
executor_clear(PyObject *executor)
{
return _Py_ExecutorClear(executor);
}

void
_Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj)
{
Expand Down

Back | FazBrowse Home | New Git URL