Message412334
FWIW, it seems -O0 don't merge local variables in different path or lifetime.
For example, see _Py_abspath
```
if (path[0] == '\0' || !wcscmp(path, L".")) {
wchar_t cwd[MAXPATHLEN + 1];
//(snip)
}
//(snip)
wchar_t cwd[MAXPATHLEN + 1];
```
wchar_t is 4bytes and MAXPATHLEN is 4096 on Linux. So each cwd is 16388bytes.
-Og allocates 32856 bytes for it and -Og allocates 16440 bytes for it.
I don't know what is the specific optimization flag in -Og do merge local variable, but I think -Og is very important for _PyEval_EvalFrameDefault() since it has many local variables in huge switch-case statements.
-Og allocates 312 bytes for it and -O0 allocates 8280 bytes for it.
By the way, clang 13 has `-fstack-usage` option like gcc, but clang 12 don't have it.
Since Ubuntu 20.04 have only clang 12, I use `-fstack-size-segment` and https://github.com/mvanotti/stack-sizes to get stack size. |
|
Date |
User |
Action |
Args |
2022-02-02 02:50:12 | methane | set | recipients:
+ methane, vstinner, pablogsal |
2022-02-02 02:50:12 | methane | set | messageid: <1643770212.29.0.594888401019.issue46600@roundup.psfhosted.org> |
2022-02-02 02:50:12 | methane | link | issue46600 messages |
2022-02-02 02:50:12 | methane | create | |
|