-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-139922: Tail calling for MSVC (VS 2026) #139962
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
Changes from 1 commit
82d1259
3248658
9ac430d
085c1d7
0b12f2e
acf48f5
35e96c1
d7737e9
86f19cf
40013cc
48db59e
bc9d23c
19e02c2
66ec774
50f8ff7
5d908b4
0786133
e699d40
66d6c39
5584fec
7eeeaa8
6f3d525
81618e2
2008d1d
7c84388
68b41cf
c7316fc
9214d5b
52c6f9c
34d98d3
7ec626e
ad1c5a2
4155337
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1534,7 +1534,7 @@ dummy_func( | |
| } | ||
|
|
||
| inst(LOAD_BUILD_CLASS, ( -- bc)) { | ||
| PyObject *restrict bc_o; | ||
| PyObject *Py_MSVC_RESTRICT bc_o; | ||
| int err = _PyEval_Mapping_GetOptionalItem(BUILTINS(), &_Py_ID(__build_class__), &bc_o); | ||
| ERROR_IF(err < 0); | ||
| if (bc_o == NULL) { | ||
|
|
@@ -1738,7 +1738,7 @@ dummy_func( | |
|
|
||
| inst(LOAD_FROM_DICT_OR_GLOBALS, (mod_or_class_dict -- v)) { | ||
| PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); | ||
| PyObject *restrict v_o; | ||
| PyObject *Py_MSVC_RESTRICT v_o; | ||
| int err = _PyEval_Mapping_GetOptionalItem(PyStackRef_AsPyObjectBorrow(mod_or_class_dict), name, &v_o); | ||
| PyStackRef_CLOSE(mod_or_class_dict); | ||
| ERROR_IF(err < 0); | ||
|
|
@@ -1925,7 +1925,7 @@ dummy_func( | |
| } | ||
|
|
||
| inst(LOAD_FROM_DICT_OR_DEREF, (class_dict_st -- value)) { | ||
| PyObject *restrict value_o; | ||
| PyObject *Py_MSVC_RESTRICT value_o; | ||
| PyObject *name; | ||
| PyObject *class_dict = PyStackRef_AsPyObjectBorrow(class_dict_st); | ||
|
|
||
|
|
@@ -2115,7 +2115,7 @@ dummy_func( | |
| } | ||
|
|
||
| inst(SETUP_ANNOTATIONS, (--)) { | ||
| PyObject *restrict ann_dict; | ||
| PyObject *Py_MSVC_RESTRICT ann_dict; | ||
| if (LOCALS() == NULL) { | ||
| _PyErr_Format(tstate, PyExc_SystemError, | ||
| "no locals found when setting up annotations"); | ||
|
|
@@ -2228,7 +2228,7 @@ dummy_func( | |
| // handle any case whose performance we care about | ||
| PyObject *super; | ||
| Py_BEGIN_LOCALS_MUST_NOT_ESCAPE(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We usually don't require parentheses on macros like this, especially when they define a scope. |
||
| PyObject *restrict stack[] = {class, self}; | ||
| PyObject *Py_MSVC_RESTRICT stack[] = {class, self}; | ||
| super = PyObject_Vectorcall(global_super, stack, oparg & 2, NULL); | ||
| Py_END_LOCALS_MUST_NOT_ESCAPE(); | ||
| if (opcode == INSTRUMENTED_LOAD_SUPER_ATTR) { | ||
|
|
@@ -2295,7 +2295,7 @@ dummy_func( | |
| } | ||
| PyStackRef_CLOSE(self_st); | ||
| self_or_null = PyStackRef_NULL; | ||
|
|
||
| DECREF_INPUTS(); | ||
|
|
||
| attr = PyStackRef_FromPyObjectSteal(attr_o); | ||
|
|
@@ -3509,7 +3509,7 @@ dummy_func( | |
| (void)lasti; // Shut up compiler warning if asserts are off | ||
| PyObject* res_o; | ||
| Py_BEGIN_LOCALS_MUST_NOT_ESCAPE(); | ||
| PyObject *restrict stack[5] = {NULL, PyStackRef_AsPyObjectBorrow(exit_self), exc, val_o, tb}; | ||
| PyObject *Py_MSVC_RESTRICT stack[5] = {NULL, PyStackRef_AsPyObjectBorrow(exit_self), exc, val_o, tb}; | ||
| int has_self = !PyStackRef_IsNull(exit_self); | ||
| res_o = PyObject_Vectorcall(exit_func_o, stack + 2 - has_self, | ||
| (3 + has_self) | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there's a more semantically meaningful name than
Py_MSVC_RESTRICThere? "Unaliased" or "no escape"?And possibly define it as a macro like
#define UNALIASED(x) x Py_MSVC_RESTRICTto getUNALIASED(PyObject *) bc_o?Just looking to reduce the sense of "oh I have to go look up this MSVC thing to know what's going on here" when reading the code. There may be other ways.