8000 GH-91095: Specialize calls to normal python classes by markshannon · Pull Request #93221 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-91095: Specialize calls to normal python classes #93221

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

Closed
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
158010e
Spacialize calls to normal Python classes.
markshannon Dec 8, 2021
4f74e30
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Dec 15, 2021
a62f708
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jan 4, 2022
c607dfe
Don't change magic number.
markshannon Jan 5, 2022
b9ee4f9
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jan 5, 2022
e6002c4
Add news
markshannon Jan 5, 2022
2254d06
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jan 5, 2022
2f32fcd
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon May 24, 2022
697bc4f
Fix line table for init cleanup function.
markshannon May 25, 2022
c6f8f8e
Fix refleaks
markshannon May 25, 2022
5edb423
Add news
markshannon May 25, 2022
7166184
Update summarize stats script.
markshannon May 25, 2022
3260c42
Fix stats for inlined py calls
markshannon May 25, 2022
641c46e
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon May 25, 2022
6749242
Remove duplicate news item.
markshannon May 25, 2022
426b5b3
Tidy up
markshannon May 25, 2022
e70711a
Fix decrefs
markshannon May 27, 2022
70e3e06
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon May 27, 2022
4a58e68
Make it explicit that shim frame is artificial and should not show up…
markshannon May 27, 2022
7c0876c
Fixup sys._getframe
markshannon May 27, 2022
365fceb
Add explanatory comment to CALL_NO_KW_ALLOC_AND_ENTER_INIT.
markshannon Jun 7, 2022
1ee2f1c
Add test for tracing when quickening calls to Python classes.
markshannon Jun 7, 2022
b75b1aa
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jun 7, 2022
224c4ac
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jun 20, 2022
f368a30
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jun 21, 2022
b5cf97d
Remove is_artificial and use _co_firsttraceable instead.
markshannon Jun 29, 2022
ba83e76
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jun 29, 2022
8a5c7e6
Explain unusual structure of _Py_InitCleanupFunc code.
markshannon Jun 29, 2022
80444e4
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jul 19, 2022
cd41308
Do not include incomplete frames in tracebacks.
markshannon Jul 19, 2022
9ffd10d
Make init-cleanup function per-interpreter, rather than global.
markshannon Jul 25, 2022
3645ea4
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Jul 25, 2022
255e1c1
Fix whitespace
markshannon Jul 25, 2022
72e50e0
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Aug 24, 2022
5b94ad6
Merge branch 'main' into specialize-calls-to-normal-python-classes
markshannon Aug 25, 2022
ff3ffef
Use code object instead of function as trampoline.
markshannon Aug 25, 2022
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
Fix line table for init cleanup function.
  • Loading branch information
markshannon committed May 25, 2022
commit 697bc4fae11920b9b9c0bd04f40b2d9d56e4bba3
6 changes: 5 additions & 1 deletion Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -2027,8 +2027,11 @@ setup_init_cleanup_func(void) {
PyObject *empty_str = _PyUnicode_FromASCII("", 0);
PyObject *name = _PyUnicode_FromASCII("type.__call__", strlen("type.__call__"));
PyObject *code = PyBytes_FromStringAndSize(INIT_CLEANUP_CODE, 8);
const unsigned char loc[2] = { 0x80 | (PY_CODE_LOCATION_INFO_NO_COLUMNS << 3) | 3, 0 };
PyObject *lines = PyBytes_FromStringAndSize((const char *)&loc, 2);
if (empty_bytes == NULL || empty_str == NULL || name == NULL || code == NULL) {
goto cleanup;

}
struct _PyCodeConstructor con = {
.filename = empty_str,
Expand All @@ -2038,7 +2041,7 @@ setup_init_cleanup_func(void) {

.code = code,
.firstlineno = 1,
.linetable = empty_bytes,
.linetable = lines,

.consts = empty_tuple,
.names = empty_tuple,
Expand Down Expand Up @@ -2081,6 +2084,7 @@ setup_init_cleanup_func(void) {
Py_XDECREF(empty_str);
Py_XDECREF(name);
Py_XDECREF(code);
Py_XDECREF(lines);
PyErr_Clear();
return _Py_InitCleanupFunc == NULL ? -1 : 0;
}
Expand Down
0