Skip to content

Commit

Permalink
bpo-32616: Disable computed gotos by default for clang < 5 (GH-5574)
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Feb 7, 2018
1 parent 0a18422 commit 2942b90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Disable computed gotos by default for clang < 5.0. It caused significant
performance regression.
12 changes: 10 additions & 2 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2942b90

Please sign in to comment.