8000 GH-126491: Lower heap size limit with faster marking by markshannon · Pull Request #127519 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-126491: Lower heap size limit with faster marking #127519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3038a78
Faster marking of reachable objects
markshannon Nov 9, 2024
c024484
Handle more classes in fast marking
markshannon Nov 10, 2024
e8497ae
Add support for asyn generators on fast path. Simplify counting
markshannon Nov 11, 2024
4c1a6bc
Check stackref before converting to PyObject *
markshannon Nov 11, 2024
6efb4c0
Rename stuff
markshannon Nov 13, 2024
b1c7ab0
Remove expand_region_transitively_reachable and use move_all_transiti…
markshannon Nov 13, 2024
07f228b
Merge branch 'main' into faster-marking
markshannon Dec 2, 2024
51ff78e
Fix compiler warnings and linkage
markshannon Dec 2, 2024
df907b5
Fix another linkage issue
markshannon Dec 2, 2024
9ca64f5
Try 'extern'
markshannon Dec 2, 2024
bda13f4
Go back to PyAPI_FUNC and move functions together
markshannon Dec 2, 2024
d9d63c8
Use _Py_FALLTHROUGH
markshannon Dec 2, 2024
57b8820
Add necessary #ifndef Py_GIL_DISABLED
markshannon Dec 2, 2024
a607059
Go back to using tp_traverse, but make tra 10000 versal more efficient
markshannon Dec 3, 2024
1545508
Tidy up
markshannon Dec 3, 2024
a1a38c8
A bit more tidying up
markshannon Dec 3, 2024
68fc90b
Move all work to do calculations to one place
markshannon Dec 3, 2024
8893cf5
Assume that increments are 50% garbage for work done calculation
markshannon Dec 3, 2024
ba20c7c
Elaborate comment
markshannon Dec 4, 2024
8262bf0
More tweaking of thresholds
markshannon Dec 4, 2024
3c2116e
Do some algebra
markshannon Dec 4, 2024
72d0284
Revert to 2M+I from 3M+I
markshannon Dec 4, 2024
0f182e2
Address review comments
markshannon Dec 5, 2024
d3c21bb
Address review comments and clarify code a bit
markshannon Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tidy up
  • Loading branch information
markshannon committed Dec 3, 2024
commit 15455081f85f9cf119f439d09fae735636fe011e
2 changes: 0 additions & 2 deletions Include/internal/pycore_gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,6 @@ extern void _PyGC_VisitObjectsWorldStopped(PyInterpreterState *interp,
gcvisitobjects_t callback, void *arg);
#endif

PyAPI_FUNC(void) _PyGC_MoveUnvisited(PyObject *op, PyGC_Head *to, int visited_space);

#ifdef __cplusplus
}
#endif
Expand Down
10 changes: 2 additions & 8 deletions Include/internal/pycore_typeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ extern "C" {
#define _Py_TYPE_VERSION_BYTEARRAY 9
#define _Py_TYPE_VERSION_BYTES 10
#define _Py_TYPE_VERSION_COMPLEX 11
#define _Py_TYPE_VERSION_GENERATOR 12
#define _Py_TYPE_VERSION_COROUTINE 13
#define _Py_TYPE_VERSION_MODULE 14
#define _Py_TYPE_VERSION_TYPE 15
#define _Py_TYPE_VERSION_ASYNC_GENERATOR 16
#define _Py_TYPE_VERSION_ASYNC_ASEND 17

#define _Py_TYPE_VERSION_NEXT 20

#define _Py_TYPE_VERSION_NEXT 16


#define _Py_TYPE_BASE_VERSION_TAG (2<<16)
Expand Down
4 changes: 0 additions & 4 deletions Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,6 @@ PyTypeObject PyGen_Type = {
gen_memberlist, /* tp_members */
gen_getsetlist, /* tp_getset */
.tp_finalize = _PyGen_Finalize,
.tp_version_tag = _Py_TYPE_VERSION_GENERATOR,
};

static PyObject *
Expand Down Expand Up @@ -1226,7 +1225,6 @@ PyTypeObject PyCoro_Type = {
coro_memberlist, /* tp_members */
coro_getsetlist, /* tp_getset */
.tp_finalize = _PyGen_Finalize,
.tp_version_tag = _Py_TYPE_VERSION_COROUTINE,
};

static void
Expand Down Expand Up @@ -1640,7 +1638,6 @@ PyTypeObject PyAsyncGen_Type = {
async_gen_memberlist, /* tp_members */
async_gen_getsetlist, /* tp_getset */
.tp_finalize = _PyGen_Finalize,
.tp_version_tag = _Py_TYPE_VERSION_ASYNC_GENERATOR,
};


Expand Down Expand Up @@ -1886,7 +1883,6 @@ PyTypeObject _PyAsyncGenASend_Type = {
async_gen_asend_iternext, /* tp_iternext */
async_gen_asend_methods, /* tp_methods */
.tp_finalize = async_gen_asend_finalize,
.tp_version_tag = _Py_TYPE_VERSION_ASYNC_ASEND,
};


Expand Down
1 change: 0 additions & 1 deletion Objects/moduleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,5 +1356,4 @@ PyTypeObject PyModule_Type = {
0, /* tp_alloc */
new_module, /* tp_new */
PyObject_GC_Del, /* tp_free */
.tp_version_tag = _Py_TYPE_VERSION_MODULE,
};
1 change: 0 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6384,7 +6384,6 @@ PyTypeObject PyType_Type = {
PyObject_GC_Del, /* tp_free */
type_is_gc, /* tp_is_gc */
.tp_vectorcall = type_vectorcall,
.tp_version_tag = _Py_TYPE_VERSION_TYPE,
};


Expand Down
6 changes: 4 additions & 2 deletions Python/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1436,9 +1436,11 @@ frame_move_unvisited(_PyInterpreterFrame *frame, WorkStack *stack, int visited_s
while (sp > locals) {
sp--;
_PyStackRef ref = *sp;
if (PyStackRef_IsNonNullMortal(ref)) {
if (!PyStackRef_IsNull(ref)) {
PyObject *op = PyStackRef_AsPyObjectBorrow(ref);
move_unvisited(op, stack, visited_space);
if (!_Py_IsImmortal(op)) {
move_unvisited(op, stack, visited_space);
}
}
}
}
Expand Down 4256
Loading
0