Skip to content

Commit 247b50d

Browse files
gh-130004: Revert commit 9e52e55 (GH-130005)
Revert commit 9e52e55
1 parent 374abde commit 247b50d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

PCbuild/pyproject.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<ClCompile>
5454
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(GeneratedPyConfigDir);$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
5555
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
56+
<PreprocessorDefinitions Condition="'$(SupportPGO)' and ($(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate')">_Py_USING_PGO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
5657

5758
<Optimization>MaxSpeed</Optimization>
5859
<IntrinsicFunctions>true</IntrinsicFunctions>

Python/ceval.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,23 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
764764
#define PY_EVAL_C_STACK_UNITS 2
765765

766766

767+
/* _PyEval_EvalFrameDefault is too large to optimize for speed with PGO on MSVC
768+
when the JIT is enabled or GIL is disabled. Disable that optimization around
769+
this function only. If this is fixed upstream, we should gate this on the
770+
version of MSVC.
771+
*/
772+
#if (defined(_MSC_VER) && \
773+
defined(_Py_USING_PGO) && \
774+
(defined(_Py_JIT) || \
775+
defined(Py_GIL_DISABLED)))
776+
#define DO_NOT_OPTIMIZE_INTERP_LOOP
777+
#endif
778+
779+
#ifdef DO_NOT_OPTIMIZE_INTERP_LOOP
780+
# pragma optimize("t", off)
781+
/* This setting is reversed below following _PyEval_EvalFrameDefault */
782+
#endif
783+
767784
#ifdef Py_TAIL_CALL_INTERP
768785
#include "opcode_targets.h"
769786
#include "generated_cases.c.h"
@@ -986,6 +1003,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
9861003
return NULL;
9871004
}
9881005

1006+
#ifdef DO_NOT_OPTIMIZE_INTERP_LOOP
1007+
# pragma optimize("", on)
1008+
#endif
1009+
9891010
#if defined(__GNUC__)
9901011
# pragma GCC diagnostic pop
9911012
#elif defined(_MSC_VER) /* MS_WINDOWS */

0 commit comments

Comments
 (0)