summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2018-02-07 10:09:36 (GMT)
committerGitHub <noreply@github.com>2018-02-07 10:09:36 (GMT)
commit2942b909d9a428e6683d90b3436cfa4a81bd5d8a (patch)
treee05b4e4314a71e4b915c0814b6d41c7a1184cedd
parent0a18422b31e0d7549da5ddbf62194f8c583c2091 (diff)
downloadcpython-2942b909d9a428e6683d90b3436cfa4a81bd5d8a.zip
cpython-2942b909d9a428e6683d90b3436cfa4a81bd5d8a.tar.gz
cpython-2942b909d9a428e6683d90b3436cfa4a81bd5d8a.tar.bz2
bpo-32616: Disable computed gotos by default for clang < 5 (GH-5574)
-rw-r--r--Misc/NEWS.d/next/Build/2018-02-07-11-24-38.bpo-32616.o7mFJ3.rst2
-rw-r--r--Python/ceval.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Build/2018-02-07-11-24-38.bpo-32616.o7mFJ3.rst b/Misc/NEWS.d/next/Build/2018-02-07-11-24-38.bpo-32616.o7mFJ3.rst
new file mode 100644
index 0000000..cdddc2f
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2018-02-07-11-24-38.bpo-32616.o7mFJ3.rst
@@ -0,0 +1,2 @@
+Disable computed gotos by default for clang < 5.0. It caused significant
+performance regression.
diff --git a/Python/ceval.c b/Python/ceval.c
index 4e4adc2..bae158d 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -689,11 +689,19 @@ PyObject *
PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
{
#ifdef DYNAMIC_EXECUTION_PROFILE
- #undef USE_COMPUTED_GOTOS
+ #undef USE_COMPUTED_GOTOS
#endif
#ifdef HAVE_COMPUTED_GOTOS
#ifndef USE_COMPUTED_GOTOS
- #define USE_COMPUTED_GOTOS 1
+ #if defined(__clang__) && (__clang_major__ < 5)
+ /* Computed gotos caused significant performance regression
+ * with clang < 5.0.
+ * https://bugs.python.org/issue32616
+ */
+ #define USE_COMPUTED_GOTOS 0
+ #else
+ #define USE_COMPUTED_GOTOS 1
+ #endif
#endif
#else
#if defined(USE_COMPUTED_GOTOS) && USE_COMPUTED_GOTOS