]> granicus.if.org Git - python/commitdiff
bpo-32616: Disable computed gotos by default for clang < 5 (GH-5574)
authorINADA Naoki <methane@users.noreply.github.com>
Wed, 7 Feb 2018 10:09:36 +0000 (19:09 +0900)
committerGitHub <noreply@github.com>
Wed, 7 Feb 2018 10:09:36 +0000 (19:09 +0900)
Misc/NEWS.d/next/Build/2018-02-07-11-24-38.bpo-32616.o7mFJ3.rst [new file with mode: 0644]
Python/ceval.c

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 (file)
index 0000000..cdddc2f
--- /dev/null
@@ -0,0 +1,2 @@
+Disable computed gotos by default for clang < 5.0. It caused significant
+performance regression.
index 4e4adc2d63dc1b696a72bbdcd69630b66a35c7b6..bae158dc1402b12446c7a27dd453d581a4d46ed2 100644 (file)
@@ -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