File tree Expand file tree Collapse file tree 5 files changed +87
-0
lines changed
Misc/NEWS.d/next/Core_and_Builtins Expand file tree Collapse file tree 5 files changed +87
-0
lines changed Original file line number Diff line number Diff line change @@ -1506,6 +1506,12 @@ Compiler flags
15061506
15071507 .. versionadded :: 3.7
15081508
1509+ .. envvar :: CFLAGS_CEVAL
1510+
1511+ Flags used to compile ``Python/ceval.c ``.
1512+
1513+ .. versionadded :: 3.14.5
1514+
15091515.. envvar :: CCSHARED
15101516
15111517 Compiler flags used to build a shared library.
Original file line number Diff line number Diff line change @@ -126,6 +126,8 @@ PY_CORE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE
126126PY_CORE_LDFLAGS=$(PY_LDFLAGS) $(PY_LDFLAGS_NODIST)
127127# Strict or non-strict aliasing flags used to compile dtoa.c, see above
128128CFLAGS_ALIASING=@CFLAGS_ALIASING@
129+ # Compilation flags only for ceval.c.
130+ CFLAGS_CEVAL=@CFLAGS_CEVAL@
129131
130132
131133# Machine-dependent subdirectories
@@ -3142,6 +3144,9 @@ regen-jit:
31423144Python/dtoa.o: Python/dtoa.c
31433145 $(CC) -c $(PY_CORE_CFLAGS) $(CFLAGS_ALIASING) -o $@ $<
31443146
3147+ Python/ceval.o: Python/ceval.c
3148+ $(CC) -c $(PY_CORE_CFLAGS) $(CFLAGS_CEVAL) -o $@ $<
3149+
31453150# Run reindent on the library
31463151.PHONY: reindent
31473152reindent:
Original file line number Diff line number Diff line change 1+ Fix high stack consumption in Python's interpreter loop on Clang 22 by setting function limits for inlining when building with computed gotos.
Original file line number Diff line number Diff line change @@ -7244,6 +7244,34 @@ if test "$have_glibc_memmove_bug" = yes; then
72447244 for memmove and bcopy.] )
72457245fi
72467246
7247+ AC_MSG_CHECKING ( [ if we need to manually block large inlining in ceval.c] )
7248+ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
7249+ int main(void) {
7250+ // See gh-148284: Clang 22 seems to have interactions with inlining
7251+ // and the stackref buffer which cause 40 kB of stack usage on x86-64
7252+ // in buggy versions of _PyEval_EvalFrameDefault() in computed goto
7253+ // interpreter. The normal usage seen is normally 1-2 kB.
7254+ #if defined(__clang__) && (__clang_major__ == 22)
7255+ return 1;
7256+ #else
7257+ return 0;
7258+ #endif
7259+ }
7260+ ] ] ) ] ,
7261+ [ block_huge_inlining_in_ceval=no] ,
7262+ [ block_huge_inlining_in_ceval=yes] ,
7263+ [ block_huge_inlining_in_ceval=undefined] )
7264+ AC_MSG_RESULT ( [ $block_huge_inlining_in_ceval] )
7265+
7266+ if test "$block_huge_inlining_in_ceval" = yes && test "$ac_cv_computed_gotos" = yes; then
7267+ # gh-148284: Suppress inlining of functions whose stack size exceeds
7268+ # 512 bytes. This number should be tuned to follow the C stack
7269+ # consumption in _PyEval_EvalFrameDefault() on computed goto
7270+ # interpreter.
7271+ CFLAGS_CEVAL="$CFLAGS_CEVAL -finline-max-stacksize=512"
7272+ fi
7273+ AC_SUBST ( [ CFLAGS_CEVAL] )
7274+
72477275if test "$ac_cv_gcc_asm_for_x87" = yes; then
72487276 # Some versions of gcc miscompile inline asm:
72497277 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
You can’t perform that action at this time.
0 commit comments