summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-08-13 21:15:58 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-08-13 21:15:58 (GMT)
commit042b128f58a952b2cd04bd5b7401bd54c67a687e (patch)
treec4ac0fda68d9062064f3d28fa8baa80668515c26 /Python
parentd835cf1c84f2b29d54f583139e03b95b906b6081 (diff)
downloadcpython-042b128f58a952b2cd04bd5b7401bd54c67a687e.zip
cpython-042b128f58a952b2cd04bd5b7401bd54c67a687e.tar.gz
cpython-042b128f58a952b2cd04bd5b7401bd54c67a687e.tar.bz2
Issue #9203: Computed gotos are now enabled by default on supported
compilers (which are detected by the configure script). They can still be disable selectively by specifying --without-computed-gotos.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 2d4b16a..c2c4e78 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -840,11 +840,24 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
-fno-crossjumping).
*/
-#if defined(USE_COMPUTED_GOTOS) && defined(DYNAMIC_EXECUTION_PROFILE)
+#ifdef DYNAMIC_EXECUTION_PROFILE
#undef USE_COMPUTED_GOTOS
+#define USE_COMPUTED_GOTOS 0
+#endif
+
+#ifdef HAVE_COMPUTED_GOTOS
+ #ifndef USE_COMPUTED_GOTOS
+ #define USE_COMPUTED_GOTOS 1
+ #endif
+#else
+ #if defined(USE_COMPUTED_GOTOS) && USE_COMPUTED_GOTOS
+ #error "Computed gotos are not supported on this compiler."
+ #endif
+ #undef USE_COMPUTED_GOTOS
+ #define USE_COMPUTED_GOTOS 0
#endif
-#ifdef USE_COMPUTED_GOTOS
+#if USE_COMPUTED_GOTOS
/* Import the static jump table */
#include "opcode_targets.h"
@@ -990,7 +1003,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
*/
-#if defined(DYNAMIC_EXECUTION_PROFILE) || defined(USE_COMPUTED_GOTOS)
+#if defined(DYNAMIC_EXECUTION_PROFILE) || USE_COMPUTED_GOTOS
#define PREDICT(op) if (0) goto PRED_##op
#define PREDICTED(op) PRED_##op:
#define PREDICTED_WITH_ARG(op) PRED_##op:
@@ -2838,7 +2851,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
oparg = oparg<<16 | NEXTARG();
goto dispatch_opcode;
-#ifdef USE_COMPUTED_GOTOS
+#if USE_COMPUTED_GOTOS
_unknown_opcode:
#endif
default: