Blame SOURCES/00233-Computed-Goto-dispatch.patch

04a680
From 66818f47df1e37b105fd42d6cbaa756c4d72393c Mon Sep 17 00:00:00 2001
04a680
From: Charalampos Stratakis <cstratak@redhat.com>
04a680
Date: Wed, 30 Mar 2016 15:54:29 +0200
04a680
Subject: [PATCH] Computed Goto dispatch for Python2
04a680
04a680
---
04a680
 Include/opcode.h            |   9 +
04a680
 Makefile.pre.in             |  15 +
04a680
 Python/ceval.c              | 770 +++++++++++++++++++++++++++++++-------------
04a680
 Python/makeopcodetargets.py |  45 +++
04a680
 Python/opcode_targets.h     | 258 +++++++++++++++
04a680
 configure                   |  81 +++++
04a680
 configure.ac                |  51 +++
04a680
 pyconfig.h.in               |   6 +
04a680
 8 files changed, 1005 insertions(+), 230 deletions(-)
04a680
04a680
diff --git a/Include/opcode.h b/Include/opcode.h
04a680
index 9764109..9ed5487 100644
04a680
--- a/Include/opcode.h
04a680
+++ b/Include/opcode.h
04a680
@@ -37,12 +37,21 @@ extern "C" {
04a680
 
04a680
 #define SLICE		30
04a680
 /* Also uses 31-33 */
04a680
+#define SLICE_1		31
04a680
+#define SLICE_2		32
04a680
+#define SLICE_3		33
04a680
 
04a680
 #define STORE_SLICE	40
04a680
 /* Also uses 41-43 */
04a680
+#define STORE_SLICE_1	41
04a680
+#define STORE_SLICE_2	42
04a680
+#define STORE_SLICE_3	43
04a680
 
04a680
 #define DELETE_SLICE	50
04a680
 /* Also uses 51-53 */
04a680
+#define DELETE_SLICE_1	51
04a680
+#define DELETE_SLICE_2	52
04a680
+#define DELETE_SLICE_3	53
04a680
 
04a680
 #define STORE_MAP	54
04a680
 #define INPLACE_ADD	55
04a680
diff --git a/Makefile.pre.in b/Makefile.pre.in
04a680
index 4ee61f6..611f63a 100644
04a680
--- a/Makefile.pre.in
04a680
+++ b/Makefile.pre.in
04a680
@@ -299,6 +299,16 @@ ASDLGEN=	$(srcdir)/Parser/asdl_c.py
04a680
 
04a680
 ##########################################################################
04a680
 # Python
04a680
+
04a680
+OPCODETARGETS_H= \
04a680
+			   $(srcdir)/Python/opcode_targets.h
04a680
+
04a680
+OPCODETARGETGEN= \
04a680
+			   $(srcdir)/Python/makeopcodetargets.py
04a680
+
04a680
+OPCODETARGETGEN_FILES= \
04a680
+			   $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
04a680
+
04a680
 PYTHON_OBJS=	\
04a680
 		Python/_warnings.o \
04a680
 		Python/Python-ast.o \
04a680
@@ -648,6 +658,11 @@ Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
04a680
 Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
04a680
 				$(STRINGLIB_HEADERS)
04a680
 
04a680
+$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
04a680
+	   $(OPCODETARGETGEN) $(OPCODETARGETS_H)
04a680
+
04a680
+Python/ceval.o: $(OPCODETARGETS_H)
04a680
+
04a680
 Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
04a680
 				$(STRINGLIB_HEADERS)
04a680
 
04a680
diff --git a/Python/ceval.c b/Python/ceval.c
04a680
index 8c6f8d7..67d1576 100644
04a680
--- a/Python/ceval.c
04a680
+++ b/Python/ceval.c
04a680
@@ -757,6 +757,99 @@ PyEval_EvalFrame(PyFrameObject *f) {
04a680
 PyObject *
04a680
 PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
 {
04a680
+#ifdef DYNAMIC_EXECUTION_PROFILE
04a680
+  #undef USE_COMPUTED_GOTOS
04a680
+#endif
04a680
+#ifdef HAVE_COMPUTED_GOTOS
04a680
+    #ifndef USE_COMPUTED_GOTOS
04a680
+    #define USE_COMPUTED_GOTOS 1
04a680
+    #endif
04a680
+#else
04a680
+    #if defined(USE_COMPUTED_GOTOS) && USE_COMPUTED_GOTOS
04a680
+    #error "Computed gotos are not supported on this compiler."
04a680
+    #endif
04a680
+    #undef USE_COMPUTED_GOTOS
04a680
+    #define USE_COMPUTED_GOTOS 0
04a680
+#endif
04a680
+#if USE_COMPUTED_GOTOS
04a680
+/* Import the static jump table */
04a680
+#include "opcode_targets.h"
04a680
+
04a680
+  /* This macro is used when several opcodes defer to the same implementation
04a680
+    (e.g. SETUP_LOOP, SETUP_FINALLY) */
04a680
+#define TARGET_WITH_IMPL(op, impl) \
04a680
+               TARGET_##op: \
04a680
+               opcode = op; \
04a680
+               oparg = NEXTARG(); \
04a680
+               case op: \
04a680
+               goto impl; \
04a680
+
04a680
+#define TARGET_WITH_IMPL_NOARG(op, impl) \
04a680
+               TARGET_##op: \
04a680
+               opcode = op; \
04a680
+               case op: \
04a680
+               goto impl; \
04a680
+
04a680
+#define TARGET_NOARG(op) \
04a680
+               TARGET_##op: \
04a680
+               opcode = op; \
04a680
+               case op: \
04a680
+
04a680
+#define TARGET(op) \
04a680
+               TARGET_##op: \
04a680
+               opcode = op; \
04a680
+               oparg = NEXTARG(); \
04a680
+               case op:\
04a680
+
04a680
+#define DISPATCH() \
04a680
+               { \
04a680
+       int _tick = _Py_Ticker - 1; \
04a680
+       _Py_Ticker = _tick; \
04a680
+       if (_tick >= 0) { \
04a680
+               FAST_DISPATCH(); \
04a680
+       } \
04a680
+       continue; \
04a680
+               }
04a680
+
04a680
+#ifdef LLTRACE
04a680
+#define FAST_DISPATCH() \
04a680
+               { \
04a680
+       if (!lltrace && !_Py_TracingPossible) { \
04a680
+               f->f_lasti = INSTR_OFFSET(); \
04a680
+               goto *opcode_targets[*next_instr++]; \
04a680
+       } \
04a680
+       goto fast_next_opcode; \
04a680
+               }
04a680
+#else
04a680
+#define FAST_DISPATCH() { \
04a680
+               if (!_Py_TracingPossible) { \
04a680
+                       f->f_lasti = INSTR_OFFSET(); \
04a680
+                       goto *opcode_targets[*next_instr++]; \
04a680
+               } \
04a680
+               goto fast_next_opcode;\
04a680
+}
04a680
+#endif
04a680
+
04a680
+#else
04a680
+#define TARGET(op) \
04a680
+               case op:
04a680
+#define TARGET_WITH_IMPL(op, impl) \
04a680
+               /* silence compiler warnings about `impl` unused */ \
04a680
+               if (0) goto impl;
04a680
+               case op:\
04a680
+
04a680
+#define TARGET_NOARG(op) \
04a680
+               case op:\
04a680
+
04a680
+#define TARGET_WITH_IMPL_NOARG(op, impl) \
04a680
+               if (0) goto impl; \
04a680
+               case op:\
04a680
+
04a680
+#define DISPATCH() continue
04a680
+#define FAST_DISPATCH() goto fast_next_opcode
04a680
+#endif
04a680
+
04a680
+
04a680
 #ifdef DXPAIRS
04a680
     int lastopcode = 0;
04a680
 #endif
04a680
@@ -874,14 +967,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
     counter updates for both opcodes.
04a680
 */
04a680
 
04a680
-#ifdef DYNAMIC_EXECUTION_PROFILE
04a680
+// Next opcode prediction is also enabled for Computed Gotos as well.
04a680
+#if defined(DYNAMIC_EXECUTION_PROFILE) || USE_COMPUTED_GOTOS
04a680
 #define PREDICT(op)             if (0) goto PRED_##op
04a680
+#define PREDICTED(op)           PRED_##op:
04a680
+#define PREDICTED_WITH_ARG(op)  PRED_##op:
04a680
 #else
04a680
 #define PREDICT(op)             if (*next_instr == op) goto PRED_##op
04a680
-#endif
04a680
-
04a680
 #define PREDICTED(op)           PRED_##op: next_instr++
04a680
 #define PREDICTED_WITH_ARG(op)  PRED_##op: oparg = PEEKARG(); next_instr += 3
04a680
+#endif
04a680
+
04a680
 
04a680
 /* Stack manipulation macros */
04a680
 
04a680
@@ -1179,55 +1275,71 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
 
04a680
         /* case STOP_CODE: this is an error! */
04a680
 
04a680
-        case NOP:
04a680
-            goto fast_next_opcode;
04a680
+        TARGET_NOARG(NOP)
04a680
+       {
04a680
+               FAST_DISPATCH();
04a680
+       }
04a680
+        TARGET(LOAD_FAST)
04a680
+        {
04a680
 
04a680
-        case LOAD_FAST:
04a680
             x = GETLOCAL(oparg);
04a680
             if (x != NULL) {
04a680
                 Py_INCREF(x);
04a680
                 PUSH(x);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             format_exc_check_arg(PyExc_UnboundLocalError,
04a680
                 UNBOUNDLOCAL_ERROR_MSG,
04a680
                 PyTuple_GetItem(co->co_varnames, oparg));
04a680
             break;
04a680
 
04a680
-        case LOAD_CONST:
04a680
+        }
04a680
+
04a680
+        TARGET(LOAD_CONST)
04a680
+        {
04a680
             x = GETITEM(consts, oparg);
04a680
             Py_INCREF(x);
04a680
             PUSH(x);
04a680
-            goto fast_next_opcode;
04a680
+            FAST_DISPATCH();
04a680
+        }
04a680
 
04a680
         PREDICTED_WITH_ARG(STORE_FAST);
04a680
-        case STORE_FAST:
04a680
+        TARGET(STORE_FAST)
04a680
+        {
04a680
             v = POP();
04a680
             SETLOCAL(oparg, v);
04a680
-            goto fast_next_opcode;
04a680
+            FAST_DISPATCH();
04a680
+        }
04a680
 
04a680
-        case POP_TOP:
04a680
+        TARGET_NOARG(POP_TOP)
04a680
+        {
04a680
             v = POP();
04a680
             Py_DECREF(v);
04a680
-            goto fast_next_opcode;
04a680
+            FAST_DISPATCH();
04a680
+        }
04a680
 
04a680
-        case ROT_TWO:
04a680
+        TARGET_NOARG(ROT_TWO)
04a680
+        {
04a680
             v = TOP();
04a680
             w = SECOND();
04a680
             SET_TOP(w);
04a680
             SET_SECOND(v);
04a680
-            goto fast_next_opcode;
04a680
+            FAST_DISPATCH();
04a680
+        }
04a680
 
04a680
-        case ROT_THREE:
04a680
+        TARGET_NOARG(ROT_THREE)
04a680
+        {
04a680
             v = TOP();
04a680
             w = SECOND();
04a680
             x = THIRD();
04a680
             SET_TOP(w);
04a680
             SET_SECOND(x);
04a680
             SET_THIRD(v);
04a680
-            goto fast_next_opcode;
04a680
+            FAST_DISPATCH();
04a680
+        }
04a680
 
04a680
-        case ROT_FOUR:
04a680
+        TARGET_NOARG(ROT_FOUR)
04a680
+        {
04a680
             u = TOP();
04a680
             v = SECOND();
04a680
             w = THIRD();
04a680
@@ -1236,15 +1348,19 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             SET_SECOND(w);
04a680
             SET_THIRD(x);
04a680
             SET_FOURTH(u);
04a680
-            goto fast_next_opcode;
04a680
+            FAST_DISPATCH();
04a680
+        }
04a680
 
04a680
-        case DUP_TOP:
04a680
+        TARGET_NOARG(DUP_TOP)
04a680
+        {
04a680
             v = TOP();
04a680
             Py_INCREF(v);
04a680
             PUSH(v);
04a680
-            goto fast_next_opcode;
04a680
+            FAST_DISPATCH();
04a680
+        }
04a680
 
04a680
-        case DUP_TOPX:
04a680
+        TARGET(DUP_TOPX)
04a680
+        {
04a680
             if (oparg == 2) {
04a680
                 x = TOP();
04a680
                 Py_INCREF(x);
04a680
@@ -1253,7 +1369,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 STACKADJ(2);
04a680
                 SET_TOP(x);
04a680
                 SET_SECOND(w);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             } else if (oparg == 3) {
04a680
                 x = TOP();
04a680
                 Py_INCREF(x);
04a680
@@ -1265,84 +1381,100 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 SET_TOP(x);
04a680
                 SET_SECOND(w);
04a680
                 SET_THIRD(v);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             Py_FatalError("invalid argument to DUP_TOPX"
04a680
                           " (bytecode corruption?)");
04a680
             /* Never returns, so don't bother to set why. */
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case UNARY_POSITIVE:
04a680
+        TARGET_NOARG(UNARY_POSITIVE)
04a680
+        {
04a680
             v = TOP();
04a680
             x = PyNumber_Positive(v);
04a680
             Py_DECREF(v);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case UNARY_NEGATIVE:
04a680
+        TARGET_NOARG( UNARY_NEGATIVE)
04a680
+        {
04a680
             v = TOP();
04a680
             x = PyNumber_Negative(v);
04a680
             Py_DECREF(v);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case UNARY_NOT:
04a680
+        TARGET_NOARG(UNARY_NOT)
04a680
+        {
04a680
             v = TOP();
04a680
             err = PyObject_IsTrue(v);
04a680
             Py_DECREF(v);
04a680
             if (err == 0) {
04a680
                 Py_INCREF(Py_True);
04a680
                 SET_TOP(Py_True);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             else if (err > 0) {
04a680
                 Py_INCREF(Py_False);
04a680
                 SET_TOP(Py_False);
04a680
                 err = 0;
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             STACKADJ(-1);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case UNARY_CONVERT:
04a680
+        TARGET_NOARG(UNARY_CONVERT)
04a680
+        {
04a680
             v = TOP();
04a680
             x = PyObject_Repr(v);
04a680
             Py_DECREF(v);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case UNARY_INVERT:
04a680
+        TARGET_NOARG(UNARY_INVERT)
04a680
+        {
04a680
             v = TOP();
04a680
             x = PyNumber_Invert(v);
04a680
             Py_DECREF(v);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_POWER:
04a680
+        TARGET_NOARG(BINARY_POWER)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_Power(v, w, Py_None);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_MULTIPLY:
04a680
+        TARGET_NOARG(BINARY_MULTIPLY)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_Multiply(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if(x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_DIVIDE:
04a680
+        TARGET_NOARG(BINARY_DIVIDE)
04a680
+        {
04a680
             if (!_Py_QnewFlag) {
04a680
                 w = POP();
04a680
                 v = TOP();
04a680
@@ -1350,32 +1482,37 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 Py_DECREF(v);
04a680
                 Py_DECREF(w);
04a680
                 SET_TOP(x);
04a680
-                if (x != NULL) continue;
04a680
+                if (x != NULL) DISPATCH();
04a680
                 break;
04a680
             }
04a680
-            /* -Qnew is in effect:  fall through to
04a680
-               BINARY_TRUE_DIVIDE */
04a680
-        case BINARY_TRUE_DIVIDE:
04a680
+        }
04a680
+        /* -Qnew is in effect:  fall through to BINARY_TRUE_DIVIDE */
04a680
+        TARGET_NOARG(BINARY_TRUE_DIVIDE)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_TrueDivide(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_FLOOR_DIVIDE:
04a680
+        TARGET_NOARG(BINARY_FLOOR_DIVIDE)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_FloorDivide(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_MODULO:
04a680
+        TARGET_NOARG(BINARY_MODULO)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             if (PyString_CheckExact(v))
04a680
@@ -1385,10 +1522,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_ADD:
04a680
+        TARGET_NOARG(BINARY_ADD)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
04a680
@@ -1417,10 +1556,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
           skip_decref_vx:
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_SUBTRACT:
04a680
+        TARGET_NOARG(BINARY_SUBTRACT)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
04a680
@@ -1442,10 +1583,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_SUBSCR:
04a680
+        TARGET_NOARG(BINARY_SUBSCR)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             if (PyList_CheckExact(v) && PyInt_CheckExact(w)) {
04a680
@@ -1466,102 +1609,122 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_LSHIFT:
04a680
+        TARGET_NOARG(BINARY_LSHIFT)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_Lshift(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_RSHIFT:
04a680
+        TARGET_NOARG(BINARY_RSHIFT)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_Rshift(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_AND:
04a680
+        TARGET_NOARG(BINARY_AND)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_And(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_XOR:
04a680
+        TARGET_NOARG(BINARY_XOR)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_Xor(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BINARY_OR:
04a680
+        TARGET_NOARG(BINARY_OR)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_Or(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case LIST_APPEND:
04a680
+        TARGET(LIST_APPEND)
04a680
+        {
04a680
             w = POP();
04a680
             v = PEEK(oparg);
04a680
             err = PyList_Append(v, w);
04a680
             Py_DECREF(w);
04a680
             if (err == 0) {
04a680
                 PREDICT(JUMP_ABSOLUTE);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case SET_ADD:
04a680
+        TARGET(SET_ADD)
04a680
+        {
04a680
             w = POP();
04a680
             v = stack_pointer[-oparg];
04a680
             err = PySet_Add(v, w);
04a680
             Py_DECREF(w);
04a680
             if (err == 0) {
04a680
                 PREDICT(JUMP_ABSOLUTE);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_POWER:
04a680
+        TARGET_NOARG(INPLACE_POWER)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlacePower(v, w, Py_None);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_MULTIPLY:
04a680
+        TARGET_NOARG(INPLACE_MULTIPLY)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceMultiply(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_DIVIDE:
04a680
+        TARGET_NOARG(INPLACE_DIVIDE)
04a680
+        {
04a680
             if (!_Py_QnewFlag) {
04a680
                 w = POP();
04a680
                 v = TOP();
04a680
@@ -1569,42 +1732,50 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 Py_DECREF(v);
04a680
                 Py_DECREF(w);
04a680
                 SET_TOP(x);
04a680
-                if (x != NULL) continue;
04a680
+                if (x != NULL) DISPATCH();
04a680
                 break;
04a680
             }
04a680
+        }
04a680
             /* -Qnew is in effect:  fall through to
04a680
                INPLACE_TRUE_DIVIDE */
04a680
-        case INPLACE_TRUE_DIVIDE:
04a680
+        TARGET_NOARG(INPLACE_TRUE_DIVIDE)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceTrueDivide(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_FLOOR_DIVIDE:
04a680
+        TARGET_NOARG(INPLACE_FLOOR_DIVIDE)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceFloorDivide(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_MODULO:
04a680
+        TARGET_NOARG(INPLACE_MODULO)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceRemainder(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_ADD:
04a680
+        TARGET_NOARG(INPLACE_ADD)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
04a680
@@ -1631,10 +1802,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
           skip_decref_v:
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_SUBTRACT:
04a680
+        TARGET_NOARG(INPLACE_SUBTRACT)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
04a680
@@ -1654,63 +1827,78 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_LSHIFT:
04a680
+        TARGET_NOARG(INPLACE_LSHIFT)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceLshift(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_RSHIFT:
04a680
+        TARGET_NOARG(INPLACE_RSHIFT)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceRshift(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_AND:
04a680
+        TARGET_NOARG(INPLACE_AND)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceAnd(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_XOR:
04a680
+        TARGET_NOARG(INPLACE_XOR)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceXor(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case INPLACE_OR:
04a680
+        TARGET_NOARG(INPLACE_OR)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             x = PyNumber_InPlaceOr(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
+
04a680
 
04a680
-        case SLICE+0:
04a680
-        case SLICE+1:
04a680
-        case SLICE+2:
04a680
-        case SLICE+3:
04a680
+
04a680
+        TARGET_WITH_IMPL_NOARG(SLICE, _slice)
04a680
+        TARGET_WITH_IMPL_NOARG(SLICE_1, _slice)
04a680
+        TARGET_WITH_IMPL_NOARG(SLICE_2, _slice)
04a680
+        TARGET_WITH_IMPL_NOARG(SLICE_3, _slice)
04a680
+        _slice:
04a680
+        {
04a680
             if ((opcode-SLICE) & 2)
04a680
                 w = POP();
04a680
             else
04a680
@@ -1725,13 +1913,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_XDECREF(v);
04a680
             Py_XDECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+               }
04a680
+
04a680
 
04a680
-        case STORE_SLICE+0:
04a680
-        case STORE_SLICE+1:
04a680
-        case STORE_SLICE+2:
04a680
-        case STORE_SLICE+3:
04a680
+        TARGET_WITH_IMPL_NOARG(STORE_SLICE, _store_slice)
04a680
+        TARGET_WITH_IMPL_NOARG(STORE_SLICE_1, _store_slice)
04a680
+        TARGET_WITH_IMPL_NOARG(STORE_SLICE_2, _store_slice)
04a680
+        TARGET_WITH_IMPL_NOARG(STORE_SLICE_3, _store_slice)
04a680
+        _store_slice:
04a680
+        {
04a680
             if ((opcode-STORE_SLICE) & 2)
04a680
                 w = POP();
04a680
             else
04a680
@@ -1747,13 +1939,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(u);
04a680
             Py_XDECREF(v);
04a680
             Py_XDECREF(w);
04a680
-            if (err == 0) continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+               }
04a680
+
04a680
 
04a680
-        case DELETE_SLICE+0:
04a680
-        case DELETE_SLICE+1:
04a680
-        case DELETE_SLICE+2:
04a680
-        case DELETE_SLICE+3:
04a680
+        TARGET_WITH_IMPL_NOARG(DELETE_SLICE, _delete_slice)
04a680
+        TARGET_WITH_IMPL_NOARG(DELETE_SLICE_1, _delete_slice)
04a680
+        TARGET_WITH_IMPL_NOARG(DELETE_SLICE_2, _delete_slice)
04a680
+        TARGET_WITH_IMPL_NOARG(DELETE_SLICE_3, _delete_slice)
04a680
+        _delete_slice:
04a680
+        {
04a680
             if ((opcode-DELETE_SLICE) & 2)
04a680
                 w = POP();
04a680
             else
04a680
@@ -1768,10 +1964,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(u);
04a680
             Py_XDECREF(v);
04a680
             Py_XDECREF(w);
04a680
-            if (err == 0) continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case STORE_SUBSCR:
04a680
+        TARGET_NOARG(STORE_SUBSCR)
04a680
+        {
04a680
             w = TOP();
04a680
             v = SECOND();
04a680
             u = THIRD();
04a680
@@ -1781,10 +1979,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(u);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
-            if (err == 0) continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case DELETE_SUBSCR:
04a680
+        TARGET_NOARG(DELETE_SUBSCR)
04a680
+        {
04a680
             w = TOP();
04a680
             v = SECOND();
04a680
             STACKADJ(-2);
04a680
@@ -1792,10 +1992,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             err = PyObject_DelItem(v, w);
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
-            if (err == 0) continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case PRINT_EXPR:
04a680
+        TARGET_NOARG(PRINT_EXPR)
04a680
+        {
04a680
             v = POP();
04a680
             w = PySys_GetObject("displayhook");
04a680
             if (w == NULL) {
04a680
@@ -1818,12 +2020,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_XDECREF(x);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case PRINT_ITEM_TO:
04a680
+        TARGET_NOARG(PRINT_ITEM_TO)
04a680
+        {
04a680
             w = stream = POP();
04a680
             /* fall through to PRINT_ITEM */
04a680
+        }
04a680
 
04a680
-        case PRINT_ITEM:
04a680
+        TARGET_NOARG(PRINT_ITEM)
04a680
+        {
04a680
             v = POP();
04a680
             if (stream == NULL || stream == Py_None) {
04a680
                 w = PySys_GetObject("stdout");
04a680
@@ -1869,16 +2075,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_XDECREF(stream);
04a680
             stream = NULL;
04a680
-            if (err == 0)
04a680
-                continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case PRINT_NEWLINE_TO:
04a680
+        TARGET_NOARG(PRINT_NEWLINE_TO)
04a680
+        {
04a680
             w = stream = POP();
04a680
             /* fall through to PRINT_NEWLINE */
04a680
+        }
04a680
 
04a680
-        case PRINT_NEWLINE:
04a680
-            if (stream == NULL || stream == Py_None) {
04a680
+        TARGET_NOARG(PRINT_NEWLINE)
04a680
+        {
04a680
+            if (stream == NULL || stream == Py_None)
04a680
+            {
04a680
                 w = PySys_GetObject("stdout");
04a680
                 if (w == NULL) {
04a680
                     PyErr_SetString(PyExc_RuntimeError,
04a680
@@ -1899,11 +2109,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             stream = NULL;
04a680
             break;
04a680
 
04a680
-
04a680
+        }
04a680
 #ifdef CASE_TOO_BIG
04a680
         default: switch (opcode) {
04a680
 #endif
04a680
-        case RAISE_VARARGS:
04a680
+
04a680
+        TARGET(RAISE_VARARGS)
04a680
+        {
04a680
             u = v = w = NULL;
04a680
             switch (oparg) {
04a680
             case 3:
04a680
@@ -1924,28 +2136,37 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 break;
04a680
             }
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case LOAD_LOCALS:
04a680
-            if ((x = f->f_locals) != NULL) {
04a680
+        TARGET_NOARG(LOAD_LOCALS)
04a680
+        {
04a680
+            if ((x = f->f_locals) != NULL)
04a680
+            {
04a680
                 Py_INCREF(x);
04a680
                 PUSH(x);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             PyErr_SetString(PyExc_SystemError, "no locals");
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case RETURN_VALUE:
04a680
+        TARGET_NOARG(RETURN_VALUE)
04a680
+        {
04a680
             retval = POP();
04a680
             why = WHY_RETURN;
04a680
             goto fast_block_end;
04a680
+        }
04a680
 
04a680
-        case YIELD_VALUE:
04a680
+        TARGET_NOARG(YIELD_VALUE)
04a680
+        {
04a680
             retval = POP();
04a680
             f->f_stacktop = stack_pointer;
04a680
             why = WHY_YIELD;
04a680
             goto fast_yield;
04a680
+        }
04a680
 
04a680
-        case EXEC_STMT:
04a680
+        TARGET_NOARG(EXEC_STMT)
04a680
+        {
04a680
             w = TOP();
04a680
             v = SECOND();
04a680
             u = THIRD();
04a680
@@ -1957,8 +2178,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case POP_BLOCK:
04a680
+        TARGET_NOARG(POP_BLOCK)
04a680
+        {
04a680
             {
04a680
                 PyTryBlock *b = PyFrame_BlockPop(f);
04a680
                 while (STACK_LEVEL() > b->b_level) {
04a680
@@ -1966,10 +2189,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                     Py_DECREF(v);
04a680
                 }
04a680
             }
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
         PREDICTED(END_FINALLY);
04a680
-        case END_FINALLY:
04a680
+        TARGET_NOARG(END_FINALLY)
04a680
+        {
04a680
             v = POP();
04a680
             if (PyInt_Check(v)) {
04a680
                 why = (enum why_code) PyInt_AS_LONG(v);
04a680
@@ -1993,8 +2218,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             }
04a680
             Py_DECREF(v);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BUILD_CLASS:
04a680
+        TARGET_NOARG(BUILD_CLASS)
04a680
+        {
04a680
             u = TOP();
04a680
             v = SECOND();
04a680
             w = THIRD();
04a680
@@ -2005,8 +2232,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(w);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case STORE_NAME:
04a680
+        TARGET(STORE_NAME)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             v = POP();
04a680
             if ((x = f->f_locals) != NULL) {
04a680
@@ -2015,15 +2244,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 else
04a680
                     err = PyObject_SetItem(x, w, v);
04a680
                 Py_DECREF(v);
04a680
-                if (err == 0) continue;
04a680
+                if (err == 0) DISPATCH();
04a680
                 break;
04a680
             }
04a680
             PyErr_Format(PyExc_SystemError,
04a680
                          "no locals found when storing %s",
04a680
                          PyObject_REPR(w));
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case DELETE_NAME:
04a680
+        TARGET(DELETE_NAME)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             if ((x = f->f_locals) != NULL) {
04a680
                 if ((err = PyObject_DelItem(x, w)) != 0)
04a680
@@ -2036,9 +2267,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                          "no locals when deleting %s",
04a680
                          PyObject_REPR(w));
04a680
             break;
04a680
+        }
04a680
 
04a680
         PREDICTED_WITH_ARG(UNPACK_SEQUENCE);
04a680
-        case UNPACK_SEQUENCE:
04a680
+        TARGET(UNPACK_SEQUENCE)
04a680
+        {
04a680
             v = POP();
04a680
             if (PyTuple_CheckExact(v) &&
04a680
                 PyTuple_GET_SIZE(v) == oparg) {
04a680
@@ -2050,7 +2283,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                     PUSH(w);
04a680
                 }
04a680
                 Py_DECREF(v);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             } else if (PyList_CheckExact(v) &&
04a680
                        PyList_GET_SIZE(v) == oparg) {
04a680
                 PyObject **items = \
04a680
@@ -2069,8 +2302,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             }
04a680
             Py_DECREF(v);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case STORE_ATTR:
04a680
+        TARGET(STORE_ATTR)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             v = TOP();
04a680
             u = SECOND();
04a680
@@ -2078,33 +2313,41 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             err = PyObject_SetAttr(v, w, u); /* v.w = u */
04a680
             Py_DECREF(v);
04a680
             Py_DECREF(u);
04a680
-            if (err == 0) continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case DELETE_ATTR:
04a680
+        TARGET(DELETE_ATTR)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             v = POP();
04a680
             err = PyObject_SetAttr(v, w, (PyObject *)NULL);
04a680
                                             /* del v.w */
04a680
             Py_DECREF(v);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case STORE_GLOBAL:
04a680
+        TARGET(STORE_GLOBAL)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             v = POP();
04a680
             err = PyDict_SetItem(f->f_globals, w, v);
04a680
             Py_DECREF(v);
04a680
-            if (err == 0) continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case DELETE_GLOBAL:
04a680
+        TARGET(DELETE_GLOBAL)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             if ((err = PyDict_DelItem(f->f_globals, w)) != 0)
04a680
                 format_exc_check_arg(
04a680
                     PyExc_NameError, GLOBAL_NAME_ERROR_MSG, w);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case LOAD_NAME:
04a680
+        TARGET(LOAD_NAME)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             if ((v = f->f_locals) == NULL) {
04a680
                 PyErr_Format(PyExc_SystemError,
04a680
@@ -2140,9 +2383,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 Py_INCREF(x);
04a680
             }
04a680
             PUSH(x);
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
-        case LOAD_GLOBAL:
04a680
+        TARGET(LOAD_GLOBAL)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             if (PyString_CheckExact(w)) {
04a680
                 /* Inline the PyDict_GetItem() calls.
04a680
@@ -2162,7 +2407,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                     if (x != NULL) {
04a680
                         Py_INCREF(x);
04a680
                         PUSH(x);
04a680
-                        continue;
04a680
+                        DISPATCH();
04a680
                     }
04a680
                     d = (PyDictObject *)(f->f_builtins);
04a680
                     e = d->ma_lookup(d, w, hash);
04a680
@@ -2174,7 +2419,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                     if (x != NULL) {
04a680
                         Py_INCREF(x);
04a680
                         PUSH(x);
04a680
-                        continue;
04a680
+                        DISPATCH();
04a680
                     }
04a680
                     goto load_global_error;
04a680
                 }
04a680
@@ -2193,13 +2438,15 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             }
04a680
             Py_INCREF(x);
04a680
             PUSH(x);
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
-        case DELETE_FAST:
04a680
+        TARGET(DELETE_FAST)
04a680
+        {
04a680
             x = GETLOCAL(oparg);
04a680
             if (x != NULL) {
04a680
                 SETLOCAL(oparg, NULL);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             format_exc_check_arg(
04a680
                 PyExc_UnboundLocalError,
04a680
@@ -2207,20 +2454,24 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 PyTuple_GetItem(co->co_varnames, oparg)
04a680
                 );
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case LOAD_CLOSURE:
04a680
+        TARGET(LOAD_CLOSURE)
04a680
+        {
04a680
             x = freevars[oparg];
04a680
             Py_INCREF(x);
04a680
             PUSH(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case LOAD_DEREF:
04a680
+        TARGET(LOAD_DEREF)
04a680
+        {
04a680
             x = freevars[oparg];
04a680
             w = PyCell_Get(x);
04a680
             if (w != NULL) {
04a680
                 PUSH(w);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             err = -1;
04a680
             /* Don't stomp existing exception */
04a680
@@ -2240,15 +2491,19 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                                      UNBOUNDFREE_ERROR_MSG, v);
04a680
             }
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case STORE_DEREF:
04a680
+        TARGET(STORE_DEREF)
04a680
+        {
04a680
             w = POP();
04a680
             x = freevars[oparg];
04a680
             PyCell_Set(x, w);
04a680
             Py_DECREF(w);
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
-        case BUILD_TUPLE:
04a680
+        TARGET(BUILD_TUPLE)
04a680
+        {
04a680
             x = PyTuple_New(oparg);
04a680
             if (x != NULL) {
04a680
                 for (; --oparg >= 0;) {
04a680
@@ -2256,11 +2511,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                     PyTuple_SET_ITEM(x, oparg, w);
04a680
                 }
04a680
                 PUSH(x);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BUILD_LIST:
04a680
+        TARGET(BUILD_LIST)
04a680
+        {
04a680
             x =  PyList_New(oparg);
04a680
             if (x != NULL) {
04a680
                 for (; --oparg >= 0;) {
04a680
@@ -2268,11 +2525,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                     PyList_SET_ITEM(x, oparg, w);
04a680
                 }
04a680
                 PUSH(x);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case BUILD_SET:
04a680
+        TARGET(BUILD_SET)
04a680
+        {
04a680
             x = PySet_New(NULL);
04a680
             if (x != NULL) {
04a680
                 for (; --oparg >= 0;) {
04a680
@@ -2286,18 +2545,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                     break;
04a680
                 }
04a680
                 PUSH(x);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             break;
04a680
+        }
04a680
 
04a680
-
04a680
-        case BUILD_MAP:
04a680
+        TARGET(BUILD_MAP)
04a680
+        {
04a680
             x = _PyDict_NewPresized((Py_ssize_t)oparg);
04a680
             PUSH(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case STORE_MAP:
04a680
+        TARGET_NOARG(STORE_MAP)
04a680
+        {
04a680
             w = TOP();     /* key */
04a680
             u = SECOND();  /* value */
04a680
             v = THIRD();   /* dict */
04a680
@@ -2306,10 +2568,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             err = PyDict_SetItem(v, w, u);  /* v[w] = u */
04a680
             Py_DECREF(u);
04a680
             Py_DECREF(w);
04a680
-            if (err == 0) continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case MAP_ADD:
04a680
+        TARGET(MAP_ADD)
04a680
+        {
04a680
             w = TOP();     /* key */
04a680
             u = SECOND();  /* value */
04a680
             STACKADJ(-2);
04a680
@@ -2320,20 +2584,24 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(w);
04a680
             if (err == 0) {
04a680
                 PREDICT(JUMP_ABSOLUTE);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case LOAD_ATTR:
04a680
+        TARGET(LOAD_ATTR)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             v = TOP();
04a680
             x = PyObject_GetAttr(v, w);
04a680
             Py_DECREF(v);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case COMPARE_OP:
04a680
+        TARGET(COMPARE_OP)
04a680
+        {
04a680
             w = POP();
04a680
             v = TOP();
04a680
             if (PyInt_CheckExact(w) && PyInt_CheckExact(v)) {
04a680
@@ -2366,9 +2634,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             if (x == NULL) break;
04a680
             PREDICT(POP_JUMP_IF_FALSE);
04a680
             PREDICT(POP_JUMP_IF_TRUE);
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
-        case IMPORT_NAME:
04a680
+        TARGET(IMPORT_NAME)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             x = PyDict_GetItemString(f->f_builtins, "__import__");
04a680
             if (x == NULL) {
04a680
@@ -2409,10 +2679,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             READ_TIMESTAMP(intr1);
04a680
             Py_DECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case IMPORT_STAR:
04a680
+        TARGET_NOARG(IMPORT_STAR)
04a680
+        {
04a680
             v = POP();
04a680
             PyFrame_FastToLocals(f);
04a680
             if ((x = f->f_locals) == NULL) {
04a680
@@ -2425,34 +2697,40 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             READ_TIMESTAMP(intr1);
04a680
             PyFrame_LocalsToFast(f, 0);
04a680
             Py_DECREF(v);
04a680
-            if (err == 0) continue;
04a680
+            if (err == 0) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case IMPORT_FROM:
04a680
+        TARGET(IMPORT_FROM)
04a680
+        {
04a680
             w = GETITEM(names, oparg);
04a680
             v = TOP();
04a680
             READ_TIMESTAMP(intr0);
04a680
             x = import_from(v, w);
04a680
             READ_TIMESTAMP(intr1);
04a680
             PUSH(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case JUMP_FORWARD:
04a680
+        TARGET(JUMP_FORWARD)
04a680
+        {
04a680
             JUMPBY(oparg);
04a680
-            goto fast_next_opcode;
04a680
+            FAST_DISPATCH();
04a680
+        }
04a680
 
04a680
         PREDICTED_WITH_ARG(POP_JUMP_IF_FALSE);
04a680
-        case POP_JUMP_IF_FALSE:
04a680
+        TARGET(POP_JUMP_IF_FALSE)
04a680
+        {
04a680
             w = POP();
04a680
             if (w == Py_True) {
04a680
                 Py_DECREF(w);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             if (w == Py_False) {
04a680
                 Py_DECREF(w);
04a680
                 JUMPTO(oparg);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             err = PyObject_IsTrue(w);
04a680
             Py_DECREF(w);
04a680
@@ -2462,19 +2740,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 JUMPTO(oparg);
04a680
             else
04a680
                 break;
04a680
-            continue;
04a680
-
04a680
+            DISPATCH();
04a680
+        }
04a680
         PREDICTED_WITH_ARG(POP_JUMP_IF_TRUE);
04a680
-        case POP_JUMP_IF_TRUE:
04a680
+        TARGET(POP_JUMP_IF_TRUE)
04a680
+        {
04a680
             w = POP();
04a680
             if (w == Py_False) {
04a680
                 Py_DECREF(w);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             if (w == Py_True) {
04a680
                 Py_DECREF(w);
04a680
                 JUMPTO(oparg);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             err = PyObject_IsTrue(w);
04a680
             Py_DECREF(w);
04a680
@@ -2486,18 +2765,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 ;
04a680
             else
04a680
                 break;
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
-        case JUMP_IF_FALSE_OR_POP:
04a680
+        TARGET(JUMP_IF_FALSE_OR_POP)
04a680
+        {
04a680
             w = TOP();
04a680
             if (w == Py_True) {
04a680
                 STACKADJ(-1);
04a680
                 Py_DECREF(w);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             if (w == Py_False) {
04a680
                 JUMPTO(oparg);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             err = PyObject_IsTrue(w);
04a680
             if (err > 0) {
04a680
@@ -2509,18 +2790,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 JUMPTO(oparg);
04a680
             else
04a680
                 break;
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
-        case JUMP_IF_TRUE_OR_POP:
04a680
+        TARGET(JUMP_IF_TRUE_OR_POP)
04a680
+        {
04a680
             w = TOP();
04a680
             if (w == Py_False) {
04a680
                 STACKADJ(-1);
04a680
                 Py_DECREF(w);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             if (w == Py_True) {
04a680
                 JUMPTO(oparg);
04a680
-                goto fast_next_opcode;
04a680
+                FAST_DISPATCH();
04a680
             }
04a680
             err = PyObject_IsTrue(w);
04a680
             if (err > 0) {
04a680
@@ -2533,10 +2816,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             }
04a680
             else
04a680
                 break;
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
         PREDICTED_WITH_ARG(JUMP_ABSOLUTE);
04a680
-        case JUMP_ABSOLUTE:
04a680
+        TARGET(JUMP_ABSOLUTE)
04a680
+        {
04a680
             JUMPTO(oparg);
04a680
 #if FAST_LOOPS
04a680
             /* Enabling this path speeds-up all while and for-loops by bypassing
04a680
@@ -2548,10 +2833,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             */
04a680
             goto fast_next_opcode;
04a680
 #else
04a680
-            continue;
04a680
+            DISPATCH();
04a680
 #endif
04a680
+        }
04a680
 
04a680
-        case GET_ITER:
04a680
+        TARGET_NOARG(GET_ITER)
04a680
+        {
04a680
             /* before: [obj]; after [getiter(obj)] */
04a680
             v = TOP();
04a680
             x = PyObject_GetIter(v);
04a680
@@ -2559,13 +2846,15 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             if (x != NULL) {
04a680
                 SET_TOP(x);
04a680
                 PREDICT(FOR_ITER);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             STACKADJ(-1);
04a680
             break;
04a680
+        }
04a680
 
04a680
         PREDICTED_WITH_ARG(FOR_ITER);
04a680
-        case FOR_ITER:
04a680
+        TARGET(FOR_ITER)
04a680
+        {
04a680
             /* before: [iter]; after: [iter, iter()] *or* [] */
04a680
             v = TOP();
04a680
             x = (*v->ob_type->tp_iternext)(v);
04a680
@@ -2573,7 +2862,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 PUSH(x);
04a680
                 PREDICT(STORE_FAST);
04a680
                 PREDICT(UNPACK_SEQUENCE);
04a680
-                continue;
04a680
+                DISPATCH();
04a680
             }
04a680
             if (PyErr_Occurred()) {
04a680
                 if (!PyErr_ExceptionMatches(
04a680
@@ -2585,13 +2874,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             x = v = POP();
04a680
             Py_DECREF(v);
04a680
             JUMPBY(oparg);
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
-        case BREAK_LOOP:
04a680
+        TARGET_NOARG(BREAK_LOOP)
04a680
+        {
04a680
             why = WHY_BREAK;
04a680
             goto fast_block_end;
04a680
+        }
04a680
 
04a680
-        case CONTINUE_LOOP:
04a680
+        TARGET(CONTINUE_LOOP)
04a680
+        {
04a680
             retval = PyInt_FromLong(oparg);
04a680
             if (!retval) {
04a680
                 x = NULL;
04a680
@@ -2599,10 +2892,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             }
04a680
             why = WHY_CONTINUE;
04a680
             goto fast_block_end;
04a680
+        }
04a680
 
04a680
-        case SETUP_LOOP:
04a680
-        case SETUP_EXCEPT:
04a680
-        case SETUP_FINALLY:
04a680
+        TARGET_WITH_IMPL(SETUP_LOOP, _setup_finally)
04a680
+        TARGET_WITH_IMPL(SETUP_EXCEPT, _setup_finally)
04a680
+        TARGET(SETUP_FINALLY)
04a680
+        _setup_finally:
04a680
+        {
04a680
             /* NOTE: If you add any new block-setup opcodes that
04a680
                are not try/except/finally handlers, you may need
04a680
                to update the PyGen_NeedsFinalizing() function.
04a680
@@ -2610,9 +2906,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
 
04a680
             PyFrame_BlockSetup(f, opcode, INSTR_OFFSET() + oparg,
04a680
                                STACK_LEVEL());
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+        }
04a680
 
04a680
-        case SETUP_WITH:
04a680
+
04a680
+        TARGET(SETUP_WITH)
04a680
+        {
04a680
         {
04a680
             static PyObject *exit, *enter;
04a680
             w = TOP();
04a680
@@ -2638,10 +2937,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                                STACK_LEVEL());
04a680
 
04a680
             PUSH(x);
04a680
-            continue;
04a680
+            DISPATCH();
04a680
+          }
04a680
         }
04a680
 
04a680
-        case WITH_CLEANUP:
04a680
+        TARGET_NOARG(WITH_CLEANUP)
04a680
         {
04a680
             /* At the top of the stack are 1-3 values indicating
04a680
                how/why we entered the finally clause:
04a680
@@ -2729,7 +3029,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             break;
04a680
         }
04a680
 
04a680
-        case CALL_FUNCTION:
04a680
+        TARGET(CALL_FUNCTION)
04a680
         {
04a680
             PyObject **sp;
04a680
             PCALL(PCALL_ALL);
04a680
@@ -2741,14 +3041,14 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
 #endif
04a680
             stack_pointer = sp;
04a680
             PUSH(x);
04a680
-            if (x != NULL)
04a680
-                continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
         }
04a680
 
04a680
-        case CALL_FUNCTION_VAR:
04a680
-        case CALL_FUNCTION_KW:
04a680
-        case CALL_FUNCTION_VAR_KW:
04a680
+        TARGET_WITH_IMPL(CALL_FUNCTION_VAR, _call_function_var_kw)
04a680
+        TARGET_WITH_IMPL(CALL_FUNCTION_KW, _call_function_var_kw)
04a680
+        TARGET(CALL_FUNCTION_VAR_KW)
04a680
+        _call_function_var_kw:
04a680
         {
04a680
             int na = oparg & 0xff;
04a680
             int nk = (oparg>>8) & 0xff;
04a680
@@ -2786,12 +3086,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
                 Py_DECREF(w);
04a680
             }
04a680
             PUSH(x);
04a680
-            if (x != NULL)
04a680
-                continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
         }
04a680
 
04a680
-        case MAKE_FUNCTION:
04a680
+        TARGET(MAKE_FUNCTION)
04a680
+        {
04a680
             v = POP(); /* code object */
04a680
             x = PyFunction_New(v, f->f_globals);
04a680
             Py_DECREF(v);
04a680
@@ -2812,8 +3112,9 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             }
04a680
             PUSH(x);
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case MAKE_CLOSURE:
04a680
+        TARGET(MAKE_CLOSURE)
04a680
         {
04a680
             v = POP(); /* code object */
04a680
             x = PyFunction_New(v, f->f_globals);
04a680
@@ -2848,7 +3149,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             break;
04a680
         }
04a680
 
04a680
-        case BUILD_SLICE:
04a680
+        TARGET(BUILD_SLICE)
04a680
+        {
04a680
             if (oparg == 3)
04a680
                 w = POP();
04a680
             else
04a680
@@ -2860,14 +3162,22 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
04a680
             Py_DECREF(v);
04a680
             Py_XDECREF(w);
04a680
             SET_TOP(x);
04a680
-            if (x != NULL) continue;
04a680
+            if (x != NULL) DISPATCH();
04a680
             break;
04a680
+        }
04a680
 
04a680
-        case EXTENDED_ARG:
04a680
+        TARGET(EXTENDED_ARG)
04a680
+        {
04a680
             opcode = NEXTOP();
04a680
             oparg = oparg<<16 | NEXTARG();
04a680
             goto dispatch_opcode;
04a680
 
04a680
+        }
04a680
+
04a680
+
04a680
+#if USE_COMPUTED_GOTOS
04a680
+        _unknown_opcode:
04a680
+#endif
04a680
         default:
04a680
             fprintf(stderr,
04a680
                 "XXX lineno: %d, opcode: %d\n",
04a680
diff --git a/Python/makeopcodetargets.py b/Python/makeopcodetargets.py
04a680
index e69de29..703e5f2 100644
04a680
--- a/Python/makeopcodetargets.py
04a680
+++ b/Python/makeopcodetargets.py
04a680
@@ -0,0 +1,45 @@
04a680
+#! /usr/bin/env python
04a680
+"""Generate C code for the jump table of the threaded code interpreter
04a680
+(for compilers supporting computed gotos or "labels-as-values", such as gcc).
04a680
+"""
04a680
+
04a680
+# This code should stay compatible with Python 2.3, at least while
04a680
+# some of the buildbots have Python 2.3 as their system Python.
04a680
+
04a680
+import imp
04a680
+import os
04a680
+
04a680
+
04a680
+def find_module(modname):
04a680
+    """Finds and returns a module in the local dist/checkout.
04a680
+    """
04a680
+    modpath = os.path.join(
04a680
+        os.path.dirname(os.path.dirname(__file__)), "Lib")
04a680
+    return imp.load_module(modname, *imp.find_module(modname, [modpath]))
04a680
+
04a680
+def write_contents(f):
04a680
+    """Write C code contents to the target file object.
04a680
+    """
04a680
+    opcode = find_module("opcode")
04a680
+    targets = ['_unknown_opcode'] * 256
04a680
+    for opname, op in opcode.opmap.items():
04a680
+        if opname == "STOP_CODE":
04a680
+            continue
04a680
+        targets[op] = "TARGET_%s" % opname.replace("+0", " ").replace("+", "_")
04a680
+    f.write("static void *opcode_targets[256] = {\n")
04a680
+    f.write(",\n".join(["    &&%s" % s for s in targets]))
04a680
+    f.write("\n};\n")
04a680
+
04a680
+
04a680
+if __name__ == "__main__":
04a680
+    import sys
04a680
+    assert len(sys.argv) < 3, "Too many arguments"
04a680
+    if len(sys.argv) == 2:
04a680
+        target = sys.argv[1]
04a680
+    else:
04a680
+        target = "Python/opcode_targets.h"
04a680
+    f = open(target, "w")
04a680
+    try:
04a680
+        write_contents(f)
04a680
+    finally:
04a680
+        f.close()
04a680
\ No newline at end of file
04a680
diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h
04a680
index e69de29..2203566 100644
04a680
--- a/Python/opcode_targets.h
04a680
+++ b/Python/opcode_targets.h
04a680
@@ -0,0 +1,258 @@
04a680
+static void *opcode_targets[256] = {
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_POP_TOP,
04a680
+    &&TARGET_ROT_TWO,
04a680
+    &&TARGET_ROT_THREE,
04a680
+    &&TARGET_DUP_TOP,
04a680
+    &&TARGET_ROT_FOUR,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_NOP,
04a680
+    &&TARGET_UNARY_POSITIVE,
04a680
+    &&TARGET_UNARY_NEGATIVE,
04a680
+    &&TARGET_UNARY_NOT,
04a680
+    &&TARGET_UNARY_CONVERT,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_UNARY_INVERT,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_BINARY_POWER,
04a680
+    &&TARGET_BINARY_MULTIPLY,
04a680
+    &&TARGET_BINARY_DIVIDE,
04a680
+    &&TARGET_BINARY_MODULO,
04a680
+    &&TARGET_BINARY_ADD,
04a680
+    &&TARGET_BINARY_SUBTRACT,
04a680
+    &&TARGET_BINARY_SUBSCR,
04a680
+    &&TARGET_BINARY_FLOOR_DIVIDE,
04a680
+    &&TARGET_BINARY_TRUE_DIVIDE,
04a680
+    &&TARGET_INPLACE_FLOOR_DIVIDE,
04a680
+    &&TARGET_INPLACE_TRUE_DIVIDE,
04a680
+    &&TARGET_SLICE ,
04a680
+    &&TARGET_SLICE_1,
04a680
+    &&TARGET_SLICE_2,
04a680
+    &&TARGET_SLICE_3,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_STORE_SLICE ,
04a680
+    &&TARGET_STORE_SLICE_1,
04a680
+    &&TARGET_STORE_SLICE_2,
04a680
+    &&TARGET_STORE_SLICE_3,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_DELETE_SLICE ,
04a680
+    &&TARGET_DELETE_SLICE_1,
04a680
+    &&TARGET_DELETE_SLICE_2,
04a680
+    &&TARGET_DELETE_SLICE_3,
04a680
+    &&TARGET_STORE_MAP,
04a680
+    &&TARGET_INPLACE_ADD,
04a680
+    &&TARGET_INPLACE_SUBTRACT,
04a680
+    &&TARGET_INPLACE_MULTIPLY,
04a680
+    &&TARGET_INPLACE_DIVIDE,
04a680
+    &&TARGET_INPLACE_MODULO,
04a680
+    &&TARGET_STORE_SUBSCR,
04a680
+    &&TARGET_DELETE_SUBSCR,
04a680
+    &&TARGET_BINARY_LSHIFT,
04a680
+    &&TARGET_BINARY_RSHIFT,
04a680
+    &&TARGET_BINARY_AND,
04a680
+    &&TARGET_BINARY_XOR,
04a680
+    &&TARGET_BINARY_OR,
04a680
+    &&TARGET_INPLACE_POWER,
04a680
+    &&TARGET_GET_ITER,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_PRINT_EXPR,
04a680
+    &&TARGET_PRINT_ITEM,
04a680
+    &&TARGET_PRINT_NEWLINE,
04a680
+    &&TARGET_PRINT_ITEM_TO,
04a680
+    &&TARGET_PRINT_NEWLINE_TO,
04a680
+    &&TARGET_INPLACE_LSHIFT,
04a680
+    &&TARGET_INPLACE_RSHIFT,
04a680
+    &&TARGET_INPLACE_AND,
04a680
+    &&TARGET_INPLACE_XOR,
04a680
+    &&TARGET_INPLACE_OR,
04a680
+    &&TARGET_BREAK_LOOP,
04a680
+    &&TARGET_WITH_CLEANUP,
04a680
+    &&TARGET_LOAD_LOCALS,
04a680
+    &&TARGET_RETURN_VALUE,
04a680
+    &&TARGET_IMPORT_STAR,
04a680
+    &&TARGET_EXEC_STMT,
04a680
+    &&TARGET_YIELD_VALUE,
04a680
+    &&TARGET_POP_BLOCK,
04a680
+    &&TARGET_END_FINALLY,
04a680
+    &&TARGET_BUILD_CLASS,
04a680
+    &&TARGET_STORE_NAME,
04a680
+    &&TARGET_DELETE_NAME,
04a680
+    &&TARGET_UNPACK_SEQUENCE,
04a680
+    &&TARGET_FOR_ITER,
04a680
+    &&TARGET_LIST_APPEND,
04a680
+    &&TARGET_STORE_ATTR,
04a680
+    &&TARGET_DELETE_ATTR,
04a680
+    &&TARGET_STORE_GLOBAL,
04a680
+    &&TARGET_DELETE_GLOBAL,
04a680
+    &&TARGET_DUP_TOPX,
04a680
+    &&TARGET_LOAD_CONST,
04a680
+    &&TARGET_LOAD_NAME,
04a680
+    &&TARGET_BUILD_TUPLE,
04a680
+    &&TARGET_BUILD_LIST,
04a680
+    &&TARGET_BUILD_SET,
04a680
+    &&TARGET_BUILD_MAP,
04a680
+    &&TARGET_LOAD_ATTR,
04a680
+    &&TARGET_COMPARE_OP,
04a680
+    &&TARGET_IMPORT_NAME,
04a680
+    &&TARGET_IMPORT_FROM,
04a680
+    &&TARGET_JUMP_FORWARD,
04a680
+    &&TARGET_JUMP_IF_FALSE_OR_POP,
04a680
+    &&TARGET_JUMP_IF_TRUE_OR_POP,
04a680
+    &&TARGET_JUMP_ABSOLUTE,
04a680
+    &&TARGET_POP_JUMP_IF_FALSE,
04a680
+    &&TARGET_POP_JUMP_IF_TRUE,
04a680
+    &&TARGET_LOAD_GLOBAL,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_CONTINUE_LOOP,
04a680
+    &&TARGET_SETUP_LOOP,
04a680
+    &&TARGET_SETUP_EXCEPT,
04a680
+    &&TARGET_SETUP_FINALLY,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_LOAD_FAST,
04a680
+    &&TARGET_STORE_FAST,
04a680
+    &&TARGET_DELETE_FAST,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_RAISE_VARARGS,
04a680
+    &&TARGET_CALL_FUNCTION,
04a680
+    &&TARGET_MAKE_FUNCTION,
04a680
+    &&TARGET_BUILD_SLICE,
04a680
+    &&TARGET_MAKE_CLOSURE,
04a680
+    &&TARGET_LOAD_CLOSURE,
04a680
+    &&TARGET_LOAD_DEREF,
04a680
+    &&TARGET_STORE_DEREF,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_CALL_FUNCTION_VAR,
04a680
+    &&TARGET_CALL_FUNCTION_KW,
04a680
+    &&TARGET_CALL_FUNCTION_VAR_KW,
04a680
+    &&TARGET_SETUP_WITH,
04a680
+    &&_unknown_opcode,
04a680
+    &&TARGET_EXTENDED_ARG,
04a680
+    &&TARGET_SET_ADD,
04a680
+    &&TARGET_MAP_ADD,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode,
04a680
+    &&_unknown_opcode
04a680
+};
04a680
\ No newline at end of file
04a680
diff --git a/configure b/configure
04a680
index 6a47e1a..60a3335 100755
04a680
--- a/configure
04a680
+++ b/configure
04a680
@@ -810,6 +810,7 @@ with_libm
04a680
 with_libc
04a680
 enable_big_digits
04a680
 enable_unicode
04a680
+with_computed_gotos
04a680
 '
04a680
       ac_precious_vars='build_alias
04a680
 host_alias
04a680
@@ -1488,6 +1489,9 @@ Optional Packages:
04a680
   --with-fpectl           enable SIGFPE catching
04a680
   --with-libm=STRING      math library
04a680
   --with-libc=STRING      C library
04a680
+  --with(out)-computed-gotos
04a680
+                          Use computed gotos in evaluation loop (enabled by
04a680
+                          default on supported compilers)
04a680
 
04a680
 Some influential environment variables:
04a680
   CC          C compiler command
04a680
@@ -14608,6 +14612,83 @@ for dir in $SRCDIRS; do
04a680
         mkdir $dir
04a680
     fi
04a680
 done
04a680
+
04a680
+ BEGIN_COMPUTED_GOTO
04a680
+# Check for --with-computed-gotos
04a680
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-computed-gotos" >&5
04a680
+$as_echo_n "checking for --with-computed-gotos... " >&6; }
04a680
+
04a680
+# Check whether --with-computed-gotos was given.
04a680
+if test "${with_computed_gotos+set}" = set; then :
04a680
+  withval=$with_computed_gotos;
04a680
+if test "$withval" = yes
04a680
+then
04a680
+
04a680
+$as_echo "#define USE_COMPUTED_GOTOS 1" >>confdefs.h
04a680
+
04a680
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
04a680
+$as_echo "yes" >&6; }
04a680
+fi
04a680
+if test "$withval" = no
04a680
+then
04a680
+
04a680
+$as_echo "#define USE_COMPUTED_GOTOS 0" >>confdefs.h
04a680
+
04a680
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
04a680
+$as_echo "no" >&6; }
04a680
+fi
04a680
+
04a680
+else
04a680
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no value specified" >&5
04a680
+$as_echo "no value specified" >&6; }
04a680
+fi
04a680
+
04a680
+
04a680
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports computed gotos" >&5
04a680
+$as_echo_n "checking whether $CC supports computed gotos... " >&6; }
04a680
+if ${ac_cv_computed_gotos+:} false; then :
04a680
+  $as_echo_n "(cached) " >&6
04a680
+else
04a680
+  if test "$cross_compiling" = yes; then :
04a680
+  if test "${with_computed_gotos+set}" = set; then
04a680
+   ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
04a680
+ else
04a680
+   ac_cv_computed_gotos=no
04a680
+ fi
04a680
+else
04a680
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
04a680
+/* end confdefs.h.  */
04a680
+int main(int argc, char **argv)
04a680
+{
04a680
+    static void *targets[1] = { &&LABEL1 };
04a680
+    goto LABEL2;
04a680
+LABEL1:
04a680
+    return 0;
04a680
+LABEL2:
04a680
+    goto *targets[0];
04a680
+    return 1;
04a680
+}
04a680
+_ACEOF
04a680
+if ac_fn_c_try_run "$LINENO"; then :
04a680
+  ac_cv_computed_gotos=yes
04a680
+else
04a680
+  ac_cv_computed_gotos=no
04a680
+fi
04a680
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
04a680
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
04a680
+fi
04a680
+
04a680
+fi
04a680
+
04a680
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_computed_gotos" >&5
04a680
+$as_echo "$ac_cv_computed_gotos" >&6; }
04a680
+case "$ac_cv_computed_gotos" in yes*)
04a680
+
04a680
+$as_echo "#define HAVE_COMPUTED_GOTOS 1" >>confdefs.h
04a680
+
04a680
+esac
04a680
+# END_COMPUTED_GOTO
04a680
+
04a680
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
04a680
 $as_echo "done" >&6; }
04a680
 
04a680
diff --git a/configure.ac b/configure.ac
04a680
index 48eccdd..74bb514 100644
04a680
--- a/configure.ac
04a680
+++ b/configure.ac
04a680
@@ -4561,6 +4561,57 @@ for dir in $SRCDIRS; do
04a680
         mkdir $dir
04a680
     fi
04a680
 done
04a680
+
04a680
+# BEGIN_COMPUTED_GOTO
04a680
+# Check for --with-computed-gotos
04a680
+AC_MSG_CHECKING(for --with-computed-gotos)
04a680
+AC_ARG_WITH(computed-gotos,
04a680
+            AS_HELP_STRING([--with(out)-computed-gotos],
04a680
+                           [Use computed gotos in evaluation loop (enabled by default on supported compilers)]),
04a680
+[
04a680
+if test "$withval" = yes
04a680
+then
04a680
+  AC_DEFINE(USE_COMPUTED_GOTOS, 1,
04a680
+  [Define if you want to use computed gotos in ceval.c.])
04a680
+  AC_MSG_RESULT(yes)
04a680
+fi
04a680
+if test "$withval" = no
04a680
+then
04a680
+  AC_DEFINE(USE_COMPUTED_GOTOS, 0,
04a680
+  [Define if you want to use computed gotos in ceval.c.])
04a680
+  AC_MSG_RESULT(no)
04a680
+fi
04a680
+],
04a680
+[AC_MSG_RESULT(no value specified)])
04a680
+
04a680
+AC_MSG_CHECKING(whether $CC supports computed gotos)
04a680
+AC_CACHE_VAL(ac_cv_computed_gotos,
04a680
+AC_RUN_IFELSE([AC_LANG_SOURCE([[[
04a680
+int main(int argc, char **argv)
04a680
+{
04a680
+    static void *targets[1] = { &&LABEL1 };
04a680
+    goto LABEL2;
04a680
+LABEL1:
04a680
+    return 0;
04a680
+LABEL2:
04a680
+    goto *targets[0];
04a680
+    return 1;
04a680
+}
04a680
+]]])],
04a680
+[ac_cv_computed_gotos=yes],
04a680
+[ac_cv_computed_gotos=no],
04a680
+[if test "${with_computed_gotos+set}" = set; then
04a680
+   ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
04a680
+ else
04a680
+   ac_cv_computed_gotos=no
04a680
+ fi]))
04a680
+AC_MSG_RESULT($ac_cv_computed_gotos)
04a680
+case "$ac_cv_computed_gotos" in yes*)
04a680
+  AC_DEFINE(HAVE_COMPUTED_GOTOS, 1,
04a680
+  [Define if the C compiler supports computed gotos.])
04a680
+esac
04a680
+# END_COMPUTED_GOTO
04a680
+
04a680
 AC_MSG_RESULT(done)
04a680
 
04a680
 # generate output files
04a680
diff --git a/pyconfig.h.in b/pyconfig.h.in
04a680
index eace285..ac85729 100644
04a680
--- a/pyconfig.h.in
04a680
+++ b/pyconfig.h.in
04a680
@@ -121,6 +121,9 @@
04a680
 /* Define to 1 if you have the `clock' function. */
04a680
 #undef HAVE_CLOCK
04a680
 
04a680
+/* Define if the C compiler supports computed gotos. */
04a680
+#undef HAVE_COMPUTED_GOTOS
04a680
+
04a680
 /* Define to 1 if you have the `confstr' function. */
04a680
 #undef HAVE_CONFSTR
04a680
 
04a680
@@ -1060,6 +1063,9 @@
04a680
 /* Define to 1 if your <sys/time.h> declares `struct tm'. */
04a680
 #undef TM_IN_SYS_TIME
04a680
 
04a680
+/* Define if you want to use computed gotos in ceval.c. */
04a680
+#undef USE_COMPUTED_GOTOS
04a680
+
04a680
 /* Enable extensions on AIX 3, Interix.  */
04a680
 #ifndef _ALL_SOURCE
04a680
 # undef _ALL_SOURCE
04a680
-- 
04a680
2.5.5
04a680