An interpreted, interactive, object-oriented programming language
CentOS Sources
2017-08-01 71084d584ff953f5463757ec6536406320560b4d
commit | author | age
04a680 1 From 66818f47df1e37b105fd42d6cbaa756c4d72393c Mon Sep 17 00:00:00 2001
CS 2 From: Charalampos Stratakis <cstratak@redhat.com>
3 Date: Wed, 30 Mar 2016 15:54:29 +0200
4 Subject: [PATCH] Computed Goto dispatch for Python2
5
6 ---
7  Include/opcode.h            |   9 +
8  Makefile.pre.in             |  15 +
9  Python/ceval.c              | 770 +++++++++++++++++++++++++++++++-------------
10  Python/makeopcodetargets.py |  45 +++
11  Python/opcode_targets.h     | 258 +++++++++++++++
12  configure                   |  81 +++++
13  configure.ac                |  51 +++
14  pyconfig.h.in               |   6 +
15  8 files changed, 1005 insertions(+), 230 deletions(-)
16
17 diff --git a/Include/opcode.h b/Include/opcode.h
18 index 9764109..9ed5487 100644
19 --- a/Include/opcode.h
20 +++ b/Include/opcode.h
21 @@ -37,12 +37,21 @@ extern "C" {
22  
23  #define SLICE        30
24  /* Also uses 31-33 */
25 +#define SLICE_1        31
26 +#define SLICE_2        32
27 +#define SLICE_3        33
28  
29  #define STORE_SLICE    40
30  /* Also uses 41-43 */
31 +#define STORE_SLICE_1    41
32 +#define STORE_SLICE_2    42
33 +#define STORE_SLICE_3    43
34  
35  #define DELETE_SLICE    50
36  /* Also uses 51-53 */
37 +#define DELETE_SLICE_1    51
38 +#define DELETE_SLICE_2    52
39 +#define DELETE_SLICE_3    53
40  
41  #define STORE_MAP    54
42  #define INPLACE_ADD    55
43 diff --git a/Makefile.pre.in b/Makefile.pre.in
44 index 4ee61f6..611f63a 100644
45 --- a/Makefile.pre.in
46 +++ b/Makefile.pre.in
47 @@ -299,6 +299,16 @@ ASDLGEN=    $(srcdir)/Parser/asdl_c.py
48  
49  ##########################################################################
50  # Python
51 +
52 +OPCODETARGETS_H= \
53 +               $(srcdir)/Python/opcode_targets.h
54 +
55 +OPCODETARGETGEN= \
56 +               $(srcdir)/Python/makeopcodetargets.py
57 +
58 +OPCODETARGETGEN_FILES= \
59 +               $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
60 +
61  PYTHON_OBJS=    \
62          Python/_warnings.o \
63          Python/Python-ast.o \
64 @@ -648,6 +658,11 @@ Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
65  Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
66                  $(STRINGLIB_HEADERS)
67  
68 +$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
69 +       $(OPCODETARGETGEN) $(OPCODETARGETS_H)
70 +
71 +Python/ceval.o: $(OPCODETARGETS_H)
72 +
73  Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
74                  $(STRINGLIB_HEADERS)
75  
76 diff --git a/Python/ceval.c b/Python/ceval.c
77 index 8c6f8d7..67d1576 100644
78 --- a/Python/ceval.c
79 +++ b/Python/ceval.c
80 @@ -757,6 +757,99 @@ PyEval_EvalFrame(PyFrameObject *f) {
81  PyObject *
82  PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
83  {
84 +#ifdef DYNAMIC_EXECUTION_PROFILE
85 +  #undef USE_COMPUTED_GOTOS
86 +#endif
87 +#ifdef HAVE_COMPUTED_GOTOS
88 +    #ifndef USE_COMPUTED_GOTOS
89 +    #define USE_COMPUTED_GOTOS 1
90 +    #endif
91 +#else
92 +    #if defined(USE_COMPUTED_GOTOS) && USE_COMPUTED_GOTOS
93 +    #error "Computed gotos are not supported on this compiler."
94 +    #endif
95 +    #undef USE_COMPUTED_GOTOS
96 +    #define USE_COMPUTED_GOTOS 0
97 +#endif
98 +#if USE_COMPUTED_GOTOS
99 +/* Import the static jump table */
100 +#include "opcode_targets.h"
101 +
102 +  /* This macro is used when several opcodes defer to the same implementation
103 +    (e.g. SETUP_LOOP, SETUP_FINALLY) */
104 +#define TARGET_WITH_IMPL(op, impl) \
105 +               TARGET_##op: \
106 +               opcode = op; \
107 +               oparg = NEXTARG(); \
108 +               case op: \
109 +               goto impl; \
110 +
111 +#define TARGET_WITH_IMPL_NOARG(op, impl) \
112 +               TARGET_##op: \
113 +               opcode = op; \
114 +               case op: \
115 +               goto impl; \
116 +
117 +#define TARGET_NOARG(op) \
118 +               TARGET_##op: \
119 +               opcode = op; \
120 +               case op: \
121 +
122 +#define TARGET(op) \
123 +               TARGET_##op: \
124 +               opcode = op; \
125 +               oparg = NEXTARG(); \
126 +               case op:\
127 +
128 +#define DISPATCH() \
129 +               { \
130 +       int _tick = _Py_Ticker - 1; \
131 +       _Py_Ticker = _tick; \
132 +       if (_tick >= 0) { \
133 +               FAST_DISPATCH(); \
134 +       } \
135 +       continue; \
136 +               }
137 +
138 +#ifdef LLTRACE
139 +#define FAST_DISPATCH() \
140 +               { \
141 +       if (!lltrace && !_Py_TracingPossible) { \
142 +               f->f_lasti = INSTR_OFFSET(); \
143 +               goto *opcode_targets[*next_instr++]; \
144 +       } \
145 +       goto fast_next_opcode; \
146 +               }
147 +#else
148 +#define FAST_DISPATCH() { \
149 +               if (!_Py_TracingPossible) { \
150 +                       f->f_lasti = INSTR_OFFSET(); \
151 +                       goto *opcode_targets[*next_instr++]; \
152 +               } \
153 +               goto fast_next_opcode;\
154 +}
155 +#endif
156 +
157 +#else
158 +#define TARGET(op) \
159 +               case op:
160 +#define TARGET_WITH_IMPL(op, impl) \
161 +               /* silence compiler warnings about `impl` unused */ \
162 +               if (0) goto impl;
163 +               case op:\
164 +
165 +#define TARGET_NOARG(op) \
166 +               case op:\
167 +
168 +#define TARGET_WITH_IMPL_NOARG(op, impl) \
169 +               if (0) goto impl; \
170 +               case op:\
171 +
172 +#define DISPATCH() continue
173 +#define FAST_DISPATCH() goto fast_next_opcode
174 +#endif
175 +
176 +
177  #ifdef DXPAIRS
178      int lastopcode = 0;
179  #endif
180 @@ -874,14 +967,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
181      counter updates for both opcodes.
182  */
183  
184 -#ifdef DYNAMIC_EXECUTION_PROFILE
185 +// Next opcode prediction is also enabled for Computed Gotos as well.
186 +#if defined(DYNAMIC_EXECUTION_PROFILE) || USE_COMPUTED_GOTOS
187  #define PREDICT(op)             if (0) goto PRED_##op
188 +#define PREDICTED(op)           PRED_##op:
189 +#define PREDICTED_WITH_ARG(op)  PRED_##op:
190  #else
191  #define PREDICT(op)             if (*next_instr == op) goto PRED_##op
192 -#endif
193 -
194  #define PREDICTED(op)           PRED_##op: next_instr++
195  #define PREDICTED_WITH_ARG(op)  PRED_##op: oparg = PEEKARG(); next_instr += 3
196 +#endif
197 +
198  
199  /* Stack manipulation macros */
200  
201 @@ -1179,55 +1275,71 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
202  
203          /* case STOP_CODE: this is an error! */
204  
205 -        case NOP:
206 -            goto fast_next_opcode;
207 +        TARGET_NOARG(NOP)
208 +       {
209 +               FAST_DISPATCH();
210 +       }
211 +        TARGET(LOAD_FAST)
212 +        {
213  
214 -        case LOAD_FAST:
215              x = GETLOCAL(oparg);
216              if (x != NULL) {
217                  Py_INCREF(x);
218                  PUSH(x);
219 -                goto fast_next_opcode;
220 +                FAST_DISPATCH();
221              }
222              format_exc_check_arg(PyExc_UnboundLocalError,
223                  UNBOUNDLOCAL_ERROR_MSG,
224                  PyTuple_GetItem(co->co_varnames, oparg));
225              break;
226  
227 -        case LOAD_CONST:
228 +        }
229 +
230 +        TARGET(LOAD_CONST)
231 +        {
232              x = GETITEM(consts, oparg);
233              Py_INCREF(x);
234              PUSH(x);
235 -            goto fast_next_opcode;
236 +            FAST_DISPATCH();
237 +        }
238  
239          PREDICTED_WITH_ARG(STORE_FAST);
240 -        case STORE_FAST:
241 +        TARGET(STORE_FAST)
242 +        {
243              v = POP();
244              SETLOCAL(oparg, v);
245 -            goto fast_next_opcode;
246 +            FAST_DISPATCH();
247 +        }
248  
249 -        case POP_TOP:
250 +        TARGET_NOARG(POP_TOP)
251 +        {
252              v = POP();
253              Py_DECREF(v);
254 -            goto fast_next_opcode;
255 +            FAST_DISPATCH();
256 +        }
257  
258 -        case ROT_TWO:
259 +        TARGET_NOARG(ROT_TWO)
260 +        {
261              v = TOP();
262              w = SECOND();
263              SET_TOP(w);
264              SET_SECOND(v);
265 -            goto fast_next_opcode;
266 +            FAST_DISPATCH();
267 +        }
268  
269 -        case ROT_THREE:
270 +        TARGET_NOARG(ROT_THREE)
271 +        {
272              v = TOP();
273              w = SECOND();
274              x = THIRD();
275              SET_TOP(w);
276              SET_SECOND(x);
277              SET_THIRD(v);
278 -            goto fast_next_opcode;
279 +            FAST_DISPATCH();
280 +        }
281  
282 -        case ROT_FOUR:
283 +        TARGET_NOARG(ROT_FOUR)
284 +        {
285              u = TOP();
286              v = SECOND();
287              w = THIRD();
288 @@ -1236,15 +1348,19 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
289              SET_SECOND(w);
290              SET_THIRD(x);
291              SET_FOURTH(u);
292 -            goto fast_next_opcode;
293 +            FAST_DISPATCH();
294 +        }
295  
296 -        case DUP_TOP:
297 +        TARGET_NOARG(DUP_TOP)
298 +        {
299              v = TOP();
300              Py_INCREF(v);
301              PUSH(v);
302 -            goto fast_next_opcode;
303 +            FAST_DISPATCH();
304 +        }
305  
306 -        case DUP_TOPX:
307 +        TARGET(DUP_TOPX)
308 +        {
309              if (oparg == 2) {
310                  x = TOP();
311                  Py_INCREF(x);
312 @@ -1253,7 +1369,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
313                  STACKADJ(2);
314                  SET_TOP(x);
315                  SET_SECOND(w);
316 -                goto fast_next_opcode;
317 +                FAST_DISPATCH();
318              } else if (oparg == 3) {
319                  x = TOP();
320                  Py_INCREF(x);
321 @@ -1265,84 +1381,100 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
322                  SET_TOP(x);
323                  SET_SECOND(w);
324                  SET_THIRD(v);
325 -                goto fast_next_opcode;
326 +                FAST_DISPATCH();
327              }
328              Py_FatalError("invalid argument to DUP_TOPX"
329                            " (bytecode corruption?)");
330              /* Never returns, so don't bother to set why. */
331              break;
332 +        }
333  
334 -        case UNARY_POSITIVE:
335 +        TARGET_NOARG(UNARY_POSITIVE)
336 +        {
337              v = TOP();
338              x = PyNumber_Positive(v);
339              Py_DECREF(v);
340              SET_TOP(x);
341 -            if (x != NULL) continue;
342 +            if (x != NULL) DISPATCH();
343              break;
344 +        }
345  
346 -        case UNARY_NEGATIVE:
347 +        TARGET_NOARG( UNARY_NEGATIVE)
348 +        {
349              v = TOP();
350              x = PyNumber_Negative(v);
351              Py_DECREF(v);
352              SET_TOP(x);
353 -            if (x != NULL) continue;
354 +            if (x != NULL) DISPATCH();
355              break;
356 +        }
357  
358 -        case UNARY_NOT:
359 +        TARGET_NOARG(UNARY_NOT)
360 +        {
361              v = TOP();
362              err = PyObject_IsTrue(v);
363              Py_DECREF(v);
364              if (err == 0) {
365                  Py_INCREF(Py_True);
366                  SET_TOP(Py_True);
367 -                continue;
368 +                DISPATCH();
369              }
370              else if (err > 0) {
371                  Py_INCREF(Py_False);
372                  SET_TOP(Py_False);
373                  err = 0;
374 -                continue;
375 +                DISPATCH();
376              }
377              STACKADJ(-1);
378              break;
379 +        }
380  
381 -        case UNARY_CONVERT:
382 +        TARGET_NOARG(UNARY_CONVERT)
383 +        {
384              v = TOP();
385              x = PyObject_Repr(v);
386              Py_DECREF(v);
387              SET_TOP(x);
388 -            if (x != NULL) continue;
389 +            if (x != NULL) DISPATCH();
390              break;
391 +        }
392  
393 -        case UNARY_INVERT:
394 +        TARGET_NOARG(UNARY_INVERT)
395 +        {
396              v = TOP();
397              x = PyNumber_Invert(v);
398              Py_DECREF(v);
399              SET_TOP(x);
400 -            if (x != NULL) continue;
401 +            if (x != NULL) DISPATCH();
402              break;
403 +        }
404  
405 -        case BINARY_POWER:
406 +        TARGET_NOARG(BINARY_POWER)
407 +        {
408              w = POP();
409              v = TOP();
410              x = PyNumber_Power(v, w, Py_None);
411              Py_DECREF(v);
412              Py_DECREF(w);
413              SET_TOP(x);
414 -            if (x != NULL) continue;
415 +            if (x != NULL) DISPATCH();
416              break;
417 +        }
418  
419 -        case BINARY_MULTIPLY:
420 +        TARGET_NOARG(BINARY_MULTIPLY)
421 +        {
422              w = POP();
423              v = TOP();
424              x = PyNumber_Multiply(v, w);
425              Py_DECREF(v);
426              Py_DECREF(w);
427              SET_TOP(x);
428 -            if (x != NULL) continue;
429 +            if(x != NULL) DISPATCH();
430              break;
431 +        }
432  
433 -        case BINARY_DIVIDE:
434 +        TARGET_NOARG(BINARY_DIVIDE)
435 +        {
436              if (!_Py_QnewFlag) {
437                  w = POP();
438                  v = TOP();
439 @@ -1350,32 +1482,37 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
440                  Py_DECREF(v);
441                  Py_DECREF(w);
442                  SET_TOP(x);
443 -                if (x != NULL) continue;
444 +                if (x != NULL) DISPATCH();
445                  break;
446              }
447 -            /* -Qnew is in effect:  fall through to
448 -               BINARY_TRUE_DIVIDE */
449 -        case BINARY_TRUE_DIVIDE:
450 +        }
451 +        /* -Qnew is in effect:  fall through to BINARY_TRUE_DIVIDE */
452 +        TARGET_NOARG(BINARY_TRUE_DIVIDE)
453 +        {
454              w = POP();
455              v = TOP();
456              x = PyNumber_TrueDivide(v, w);
457              Py_DECREF(v);
458              Py_DECREF(w);
459              SET_TOP(x);
460 -            if (x != NULL) continue;
461 +            if (x != NULL) DISPATCH();
462              break;
463 +        }
464  
465 -        case BINARY_FLOOR_DIVIDE:
466 +        TARGET_NOARG(BINARY_FLOOR_DIVIDE)
467 +        {
468              w = POP();
469              v = TOP();
470              x = PyNumber_FloorDivide(v, w);
471              Py_DECREF(v);
472              Py_DECREF(w);
473              SET_TOP(x);
474 -            if (x != NULL) continue;
475 +            if (x != NULL) DISPATCH();
476              break;
477 +        }
478  
479 -        case BINARY_MODULO:
480 +        TARGET_NOARG(BINARY_MODULO)
481 +        {
482              w = POP();
483              v = TOP();
484              if (PyString_CheckExact(v))
485 @@ -1385,10 +1522,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
486              Py_DECREF(v);
487              Py_DECREF(w);
488              SET_TOP(x);
489 -            if (x != NULL) continue;
490 +            if (x != NULL) DISPATCH();
491              break;
492 +        }
493  
494 -        case BINARY_ADD:
495 +        TARGET_NOARG(BINARY_ADD)
496 +        {
497              w = POP();
498              v = TOP();
499              if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
500 @@ -1417,10 +1556,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
501            skip_decref_vx:
502              Py_DECREF(w);
503              SET_TOP(x);
504 -            if (x != NULL) continue;
505 +            if (x != NULL) DISPATCH();
506              break;
507 +        }
508  
509 -        case BINARY_SUBTRACT:
510 +        TARGET_NOARG(BINARY_SUBTRACT)
511 +        {
512              w = POP();
513              v = TOP();
514              if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
515 @@ -1442,10 +1583,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
516              Py_DECREF(v);
517              Py_DECREF(w);
518              SET_TOP(x);
519 -            if (x != NULL) continue;
520 +            if (x != NULL) DISPATCH();
521              break;
522 +        }
523  
524 -        case BINARY_SUBSCR:
525 +        TARGET_NOARG(BINARY_SUBSCR)
526 +        {
527              w = POP();
528              v = TOP();
529              if (PyList_CheckExact(v) && PyInt_CheckExact(w)) {
530 @@ -1466,102 +1609,122 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
531              Py_DECREF(v);
532              Py_DECREF(w);
533              SET_TOP(x);
534 -            if (x != NULL) continue;
535 +            if (x != NULL) DISPATCH();
536              break;
537 +        }
538  
539 -        case BINARY_LSHIFT:
540 +        TARGET_NOARG(BINARY_LSHIFT)
541 +        {
542              w = POP();
543              v = TOP();
544              x = PyNumber_Lshift(v, w);
545              Py_DECREF(v);
546              Py_DECREF(w);
547              SET_TOP(x);
548 -            if (x != NULL) continue;
549 +            if (x != NULL) DISPATCH();
550              break;
551 +        }
552  
553 -        case BINARY_RSHIFT:
554 +        TARGET_NOARG(BINARY_RSHIFT)
555 +        {
556              w = POP();
557              v = TOP();
558              x = PyNumber_Rshift(v, w);
559              Py_DECREF(v);
560              Py_DECREF(w);
561              SET_TOP(x);
562 -            if (x != NULL) continue;
563 +            if (x != NULL) DISPATCH();
564              break;
565 +        }
566  
567 -        case BINARY_AND:
568 +        TARGET_NOARG(BINARY_AND)
569 +        {
570              w = POP();
571              v = TOP();
572              x = PyNumber_And(v, w);
573              Py_DECREF(v);
574              Py_DECREF(w);
575              SET_TOP(x);
576 -            if (x != NULL) continue;
577 +            if (x != NULL) DISPATCH();
578              break;
579 +        }
580  
581 -        case BINARY_XOR:
582 +        TARGET_NOARG(BINARY_XOR)
583 +        {
584              w = POP();
585              v = TOP();
586              x = PyNumber_Xor(v, w);
587              Py_DECREF(v);
588              Py_DECREF(w);
589              SET_TOP(x);
590 -            if (x != NULL) continue;
591 +            if (x != NULL) DISPATCH();
592              break;
593 +        }
594  
595 -        case BINARY_OR:
596 +        TARGET_NOARG(BINARY_OR)
597 +        {
598              w = POP();
599              v = TOP();
600              x = PyNumber_Or(v, w);
601              Py_DECREF(v);
602              Py_DECREF(w);
603              SET_TOP(x);
604 -            if (x != NULL) continue;
605 +            if (x != NULL) DISPATCH();
606              break;
607 +        }
608  
609 -        case LIST_APPEND:
610 +        TARGET(LIST_APPEND)
611 +        {
612              w = POP();
613              v = PEEK(oparg);
614              err = PyList_Append(v, w);
615              Py_DECREF(w);
616              if (err == 0) {
617                  PREDICT(JUMP_ABSOLUTE);
618 -                continue;
619 +                DISPATCH();
620              }
621              break;
622 +        }
623  
624 -        case SET_ADD:
625 +        TARGET(SET_ADD)
626 +        {
627              w = POP();
628              v = stack_pointer[-oparg];
629              err = PySet_Add(v, w);
630              Py_DECREF(w);
631              if (err == 0) {
632                  PREDICT(JUMP_ABSOLUTE);
633 -                continue;
634 +                DISPATCH();
635              }
636              break;
637 +        }
638  
639 -        case INPLACE_POWER:
640 +        TARGET_NOARG(INPLACE_POWER)
641 +        {
642              w = POP();
643              v = TOP();
644              x = PyNumber_InPlacePower(v, w, Py_None);
645              Py_DECREF(v);
646              Py_DECREF(w);
647              SET_TOP(x);
648 -            if (x != NULL) continue;
649 +            if (x != NULL) DISPATCH();
650              break;
651 +        }
652  
653 -        case INPLACE_MULTIPLY:
654 +        TARGET_NOARG(INPLACE_MULTIPLY)
655 +        {
656              w = POP();
657              v = TOP();
658              x = PyNumber_InPlaceMultiply(v, w);
659              Py_DECREF(v);
660              Py_DECREF(w);
661              SET_TOP(x);
662 -            if (x != NULL) continue;
663 +            if (x != NULL) DISPATCH();
664              break;
665 +        }
666  
667 -        case INPLACE_DIVIDE:
668 +        TARGET_NOARG(INPLACE_DIVIDE)
669 +        {
670              if (!_Py_QnewFlag) {
671                  w = POP();
672                  v = TOP();
673 @@ -1569,42 +1732,50 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
674                  Py_DECREF(v);
675                  Py_DECREF(w);
676                  SET_TOP(x);
677 -                if (x != NULL) continue;
678 +                if (x != NULL) DISPATCH();
679                  break;
680              }
681 +        }
682              /* -Qnew is in effect:  fall through to
683                 INPLACE_TRUE_DIVIDE */
684 -        case INPLACE_TRUE_DIVIDE:
685 +        TARGET_NOARG(INPLACE_TRUE_DIVIDE)
686 +        {
687              w = POP();
688              v = TOP();
689              x = PyNumber_InPlaceTrueDivide(v, w);
690              Py_DECREF(v);
691              Py_DECREF(w);
692              SET_TOP(x);
693 -            if (x != NULL) continue;
694 +            if (x != NULL) DISPATCH();
695              break;
696 +        }
697  
698 -        case INPLACE_FLOOR_DIVIDE:
699 +        TARGET_NOARG(INPLACE_FLOOR_DIVIDE)
700 +        {
701              w = POP();
702              v = TOP();
703              x = PyNumber_InPlaceFloorDivide(v, w);
704              Py_DECREF(v);
705              Py_DECREF(w);
706              SET_TOP(x);
707 -            if (x != NULL) continue;
708 +            if (x != NULL) DISPATCH();
709              break;
710 +        }
711  
712 -        case INPLACE_MODULO:
713 +        TARGET_NOARG(INPLACE_MODULO)
714 +        {
715              w = POP();
716              v = TOP();
717              x = PyNumber_InPlaceRemainder(v, w);
718              Py_DECREF(v);
719              Py_DECREF(w);
720              SET_TOP(x);
721 -            if (x != NULL) continue;
722 +            if (x != NULL) DISPATCH();
723              break;
724 +        }
725  
726 -        case INPLACE_ADD:
727 +        TARGET_NOARG(INPLACE_ADD)
728 +        {
729              w = POP();
730              v = TOP();
731              if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
732 @@ -1631,10 +1802,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
733            skip_decref_v:
734              Py_DECREF(w);
735              SET_TOP(x);
736 -            if (x != NULL) continue;
737 +            if (x != NULL) DISPATCH();
738              break;
739 +        }
740  
741 -        case INPLACE_SUBTRACT:
742 +        TARGET_NOARG(INPLACE_SUBTRACT)
743 +        {
744              w = POP();
745              v = TOP();
746              if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) {
747 @@ -1654,63 +1827,78 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
748              Py_DECREF(v);
749              Py_DECREF(w);
750              SET_TOP(x);
751 -            if (x != NULL) continue;
752 +            if (x != NULL) DISPATCH();
753              break;
754 +        }
755  
756 -        case INPLACE_LSHIFT:
757 +        TARGET_NOARG(INPLACE_LSHIFT)
758 +        {
759              w = POP();
760              v = TOP();
761              x = PyNumber_InPlaceLshift(v, w);
762              Py_DECREF(v);
763              Py_DECREF(w);
764              SET_TOP(x);
765 -            if (x != NULL) continue;
766 +            if (x != NULL) DISPATCH();
767              break;
768 +        }
769  
770 -        case INPLACE_RSHIFT:
771 +        TARGET_NOARG(INPLACE_RSHIFT)
772 +        {
773              w = POP();
774              v = TOP();
775              x = PyNumber_InPlaceRshift(v, w);
776              Py_DECREF(v);
777              Py_DECREF(w);
778              SET_TOP(x);
779 -            if (x != NULL) continue;
780 +            if (x != NULL) DISPATCH();
781              break;
782 +        }
783  
784 -        case INPLACE_AND:
785 +        TARGET_NOARG(INPLACE_AND)
786 +        {
787              w = POP();
788              v = TOP();
789              x = PyNumber_InPlaceAnd(v, w);
790              Py_DECREF(v);
791              Py_DECREF(w);
792              SET_TOP(x);
793 -            if (x != NULL) continue;
794 +            if (x != NULL) DISPATCH();
795              break;
796 +        }
797  
798 -        case INPLACE_XOR:
799 +        TARGET_NOARG(INPLACE_XOR)
800 +        {
801              w = POP();
802              v = TOP();
803              x = PyNumber_InPlaceXor(v, w);
804              Py_DECREF(v);
805              Py_DECREF(w);
806              SET_TOP(x);
807 -            if (x != NULL) continue;
808 +            if (x != NULL) DISPATCH();
809              break;
810 +        }
811  
812 -        case INPLACE_OR:
813 +        TARGET_NOARG(INPLACE_OR)
814 +        {
815              w = POP();
816              v = TOP();
817              x = PyNumber_InPlaceOr(v, w);
818              Py_DECREF(v);
819              Py_DECREF(w);
820              SET_TOP(x);
821 -            if (x != NULL) continue;
822 +            if (x != NULL) DISPATCH();
823              break;
824 +        }
825 +
826  
827 -        case SLICE+0:
828 -        case SLICE+1:
829 -        case SLICE+2:
830 -        case SLICE+3:
831 +
832 +        TARGET_WITH_IMPL_NOARG(SLICE, _slice)
833 +        TARGET_WITH_IMPL_NOARG(SLICE_1, _slice)
834 +        TARGET_WITH_IMPL_NOARG(SLICE_2, _slice)
835 +        TARGET_WITH_IMPL_NOARG(SLICE_3, _slice)
836 +        _slice:
837 +        {
838              if ((opcode-SLICE) & 2)
839                  w = POP();
840              else
841 @@ -1725,13 +1913,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
842              Py_XDECREF(v);
843              Py_XDECREF(w);
844              SET_TOP(x);
845 -            if (x != NULL) continue;
846 +            if (x != NULL) DISPATCH();
847              break;
848 +               }
849 +
850  
851 -        case STORE_SLICE+0:
852 -        case STORE_SLICE+1:
853 -        case STORE_SLICE+2:
854 -        case STORE_SLICE+3:
855 +        TARGET_WITH_IMPL_NOARG(STORE_SLICE, _store_slice)
856 +        TARGET_WITH_IMPL_NOARG(STORE_SLICE_1, _store_slice)
857 +        TARGET_WITH_IMPL_NOARG(STORE_SLICE_2, _store_slice)
858 +        TARGET_WITH_IMPL_NOARG(STORE_SLICE_3, _store_slice)
859 +        _store_slice:
860 +        {
861              if ((opcode-STORE_SLICE) & 2)
862                  w = POP();
863              else
864 @@ -1747,13 +1939,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
865              Py_DECREF(u);
866              Py_XDECREF(v);
867              Py_XDECREF(w);
868 -            if (err == 0) continue;
869 +            if (err == 0) DISPATCH();
870              break;
871 +               }
872 +
873  
874 -        case DELETE_SLICE+0:
875 -        case DELETE_SLICE+1:
876 -        case DELETE_SLICE+2:
877 -        case DELETE_SLICE+3:
878 +        TARGET_WITH_IMPL_NOARG(DELETE_SLICE, _delete_slice)
879 +        TARGET_WITH_IMPL_NOARG(DELETE_SLICE_1, _delete_slice)
880 +        TARGET_WITH_IMPL_NOARG(DELETE_SLICE_2, _delete_slice)
881 +        TARGET_WITH_IMPL_NOARG(DELETE_SLICE_3, _delete_slice)
882 +        _delete_slice:
883 +        {
884              if ((opcode-DELETE_SLICE) & 2)
885                  w = POP();
886              else
887 @@ -1768,10 +1964,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
888              Py_DECREF(u);
889              Py_XDECREF(v);
890              Py_XDECREF(w);
891 -            if (err == 0) continue;
892 +            if (err == 0) DISPATCH();
893              break;
894 +        }
895  
896 -        case STORE_SUBSCR:
897 +        TARGET_NOARG(STORE_SUBSCR)
898 +        {
899              w = TOP();
900              v = SECOND();
901              u = THIRD();
902 @@ -1781,10 +1979,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
903              Py_DECREF(u);
904              Py_DECREF(v);
905              Py_DECREF(w);
906 -            if (err == 0) continue;
907 +            if (err == 0) DISPATCH();
908              break;
909 +        }
910  
911 -        case DELETE_SUBSCR:
912 +        TARGET_NOARG(DELETE_SUBSCR)
913 +        {
914              w = TOP();
915              v = SECOND();
916              STACKADJ(-2);
917 @@ -1792,10 +1992,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
918              err = PyObject_DelItem(v, w);
919              Py_DECREF(v);
920              Py_DECREF(w);
921 -            if (err == 0) continue;
922 +            if (err == 0) DISPATCH();
923              break;
924 +        }
925  
926 -        case PRINT_EXPR:
927 +        TARGET_NOARG(PRINT_EXPR)
928 +        {
929              v = POP();
930              w = PySys_GetObject("displayhook");
931              if (w == NULL) {
932 @@ -1818,12 +2020,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
933              Py_DECREF(v);
934              Py_XDECREF(x);
935              break;
936 +        }
937  
938 -        case PRINT_ITEM_TO:
939 +        TARGET_NOARG(PRINT_ITEM_TO)
940 +        {
941              w = stream = POP();
942              /* fall through to PRINT_ITEM */
943 +        }
944  
945 -        case PRINT_ITEM:
946 +        TARGET_NOARG(PRINT_ITEM)
947 +        {
948              v = POP();
949              if (stream == NULL || stream == Py_None) {
950                  w = PySys_GetObject("stdout");
951 @@ -1869,16 +2075,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
952              Py_DECREF(v);
953              Py_XDECREF(stream);
954              stream = NULL;
955 -            if (err == 0)
956 -                continue;
957 +            if (err == 0) DISPATCH();
958              break;
959 +        }
960  
961 -        case PRINT_NEWLINE_TO:
962 +        TARGET_NOARG(PRINT_NEWLINE_TO)
963 +        {
964              w = stream = POP();
965              /* fall through to PRINT_NEWLINE */
966 +        }
967  
968 -        case PRINT_NEWLINE:
969 -            if (stream == NULL || stream == Py_None) {
970 +        TARGET_NOARG(PRINT_NEWLINE)
971 +        {
972 +            if (stream == NULL || stream == Py_None)
973 +            {
974                  w = PySys_GetObject("stdout");
975                  if (w == NULL) {
976                      PyErr_SetString(PyExc_RuntimeError,
977 @@ -1899,11 +2109,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
978              stream = NULL;
979              break;
980  
981 -
982 +        }
983  #ifdef CASE_TOO_BIG
984          default: switch (opcode) {
985  #endif
986 -        case RAISE_VARARGS:
987 +
988 +        TARGET(RAISE_VARARGS)
989 +        {
990              u = v = w = NULL;
991              switch (oparg) {
992              case 3:
993 @@ -1924,28 +2136,37 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
994                  break;
995              }
996              break;
997 +        }
998  
999 -        case LOAD_LOCALS:
1000 -            if ((x = f->f_locals) != NULL) {
1001 +        TARGET_NOARG(LOAD_LOCALS)
1002 +        {
1003 +            if ((x = f->f_locals) != NULL)
1004 +            {
1005                  Py_INCREF(x);
1006                  PUSH(x);
1007 -                continue;
1008 +                DISPATCH();
1009              }
1010              PyErr_SetString(PyExc_SystemError, "no locals");
1011              break;
1012 +        }
1013  
1014 -        case RETURN_VALUE:
1015 +        TARGET_NOARG(RETURN_VALUE)
1016 +        {
1017              retval = POP();
1018              why = WHY_RETURN;
1019              goto fast_block_end;
1020 +        }
1021  
1022 -        case YIELD_VALUE:
1023 +        TARGET_NOARG(YIELD_VALUE)
1024 +        {
1025              retval = POP();
1026              f->f_stacktop = stack_pointer;
1027              why = WHY_YIELD;
1028              goto fast_yield;
1029 +        }
1030  
1031 -        case EXEC_STMT:
1032 +        TARGET_NOARG(EXEC_STMT)
1033 +        {
1034              w = TOP();
1035              v = SECOND();
1036              u = THIRD();
1037 @@ -1957,8 +2178,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1038              Py_DECREF(v);
1039              Py_DECREF(w);
1040              break;
1041 +        }
1042  
1043 -        case POP_BLOCK:
1044 +        TARGET_NOARG(POP_BLOCK)
1045 +        {
1046              {
1047                  PyTryBlock *b = PyFrame_BlockPop(f);
1048                  while (STACK_LEVEL() > b->b_level) {
1049 @@ -1966,10 +2189,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1050                      Py_DECREF(v);
1051                  }
1052              }
1053 -            continue;
1054 +            DISPATCH();
1055 +        }
1056  
1057          PREDICTED(END_FINALLY);
1058 -        case END_FINALLY:
1059 +        TARGET_NOARG(END_FINALLY)
1060 +        {
1061              v = POP();
1062              if (PyInt_Check(v)) {
1063                  why = (enum why_code) PyInt_AS_LONG(v);
1064 @@ -1993,8 +2218,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1065              }
1066              Py_DECREF(v);
1067              break;
1068 +        }
1069  
1070 -        case BUILD_CLASS:
1071 +        TARGET_NOARG(BUILD_CLASS)
1072 +        {
1073              u = TOP();
1074              v = SECOND();
1075              w = THIRD();
1076 @@ -2005,8 +2232,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1077              Py_DECREF(v);
1078              Py_DECREF(w);
1079              break;
1080 +        }
1081  
1082 -        case STORE_NAME:
1083 +        TARGET(STORE_NAME)
1084 +        {
1085              w = GETITEM(names, oparg);
1086              v = POP();
1087              if ((x = f->f_locals) != NULL) {
1088 @@ -2015,15 +2244,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1089                  else
1090                      err = PyObject_SetItem(x, w, v);
1091                  Py_DECREF(v);
1092 -                if (err == 0) continue;
1093 +                if (err == 0) DISPATCH();
1094                  break;
1095              }
1096              PyErr_Format(PyExc_SystemError,
1097                           "no locals found when storing %s",
1098                           PyObject_REPR(w));
1099              break;
1100 +        }
1101  
1102 -        case DELETE_NAME:
1103 +        TARGET(DELETE_NAME)
1104 +        {
1105              w = GETITEM(names, oparg);
1106              if ((x = f->f_locals) != NULL) {
1107                  if ((err = PyObject_DelItem(x, w)) != 0)
1108 @@ -2036,9 +2267,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1109                           "no locals when deleting %s",
1110                           PyObject_REPR(w));
1111              break;
1112 +        }
1113  
1114          PREDICTED_WITH_ARG(UNPACK_SEQUENCE);
1115 -        case UNPACK_SEQUENCE:
1116 +        TARGET(UNPACK_SEQUENCE)
1117 +        {
1118              v = POP();
1119              if (PyTuple_CheckExact(v) &&
1120                  PyTuple_GET_SIZE(v) == oparg) {
1121 @@ -2050,7 +2283,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1122                      PUSH(w);
1123                  }
1124                  Py_DECREF(v);
1125 -                continue;
1126 +                DISPATCH();
1127              } else if (PyList_CheckExact(v) &&
1128                         PyList_GET_SIZE(v) == oparg) {
1129                  PyObject **items = \
1130 @@ -2069,8 +2302,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1131              }
1132              Py_DECREF(v);
1133              break;
1134 +        }
1135  
1136 -        case STORE_ATTR:
1137 +        TARGET(STORE_ATTR)
1138 +        {
1139              w = GETITEM(names, oparg);
1140              v = TOP();
1141              u = SECOND();
1142 @@ -2078,33 +2313,41 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1143              err = PyObject_SetAttr(v, w, u); /* v.w = u */
1144              Py_DECREF(v);
1145              Py_DECREF(u);
1146 -            if (err == 0) continue;
1147 +            if (err == 0) DISPATCH();
1148              break;
1149 +        }
1150  
1151 -        case DELETE_ATTR:
1152 +        TARGET(DELETE_ATTR)
1153 +        {
1154              w = GETITEM(names, oparg);
1155              v = POP();
1156              err = PyObject_SetAttr(v, w, (PyObject *)NULL);
1157                                              /* del v.w */
1158              Py_DECREF(v);
1159              break;
1160 +        }
1161  
1162 -        case STORE_GLOBAL:
1163 +        TARGET(STORE_GLOBAL)
1164 +        {
1165              w = GETITEM(names, oparg);
1166              v = POP();
1167              err = PyDict_SetItem(f->f_globals, w, v);
1168              Py_DECREF(v);
1169 -            if (err == 0) continue;
1170 +            if (err == 0) DISPATCH();
1171              break;
1172 +        }
1173  
1174 -        case DELETE_GLOBAL:
1175 +        TARGET(DELETE_GLOBAL)
1176 +        {
1177              w = GETITEM(names, oparg);
1178              if ((err = PyDict_DelItem(f->f_globals, w)) != 0)
1179                  format_exc_check_arg(
1180                      PyExc_NameError, GLOBAL_NAME_ERROR_MSG, w);
1181              break;
1182 +        }
1183  
1184 -        case LOAD_NAME:
1185 +        TARGET(LOAD_NAME)
1186 +        {
1187              w = GETITEM(names, oparg);
1188              if ((v = f->f_locals) == NULL) {
1189                  PyErr_Format(PyExc_SystemError,
1190 @@ -2140,9 +2383,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1191                  Py_INCREF(x);
1192              }
1193              PUSH(x);
1194 -            continue;
1195 +            DISPATCH();
1196 +        }
1197  
1198 -        case LOAD_GLOBAL:
1199 +        TARGET(LOAD_GLOBAL)
1200 +        {
1201              w = GETITEM(names, oparg);
1202              if (PyString_CheckExact(w)) {
1203                  /* Inline the PyDict_GetItem() calls.
1204 @@ -2162,7 +2407,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1205                      if (x != NULL) {
1206                          Py_INCREF(x);
1207                          PUSH(x);
1208 -                        continue;
1209 +                        DISPATCH();
1210                      }
1211                      d = (PyDictObject *)(f->f_builtins);
1212                      e = d->ma_lookup(d, w, hash);
1213 @@ -2174,7 +2419,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1214                      if (x != NULL) {
1215                          Py_INCREF(x);
1216                          PUSH(x);
1217 -                        continue;
1218 +                        DISPATCH();
1219                      }
1220                      goto load_global_error;
1221                  }
1222 @@ -2193,13 +2438,15 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1223              }
1224              Py_INCREF(x);
1225              PUSH(x);
1226 -            continue;
1227 +            DISPATCH();
1228 +        }
1229  
1230 -        case DELETE_FAST:
1231 +        TARGET(DELETE_FAST)
1232 +        {
1233              x = GETLOCAL(oparg);
1234              if (x != NULL) {
1235                  SETLOCAL(oparg, NULL);
1236 -                continue;
1237 +                DISPATCH();
1238              }
1239              format_exc_check_arg(
1240                  PyExc_UnboundLocalError,
1241 @@ -2207,20 +2454,24 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1242                  PyTuple_GetItem(co->co_varnames, oparg)
1243                  );
1244              break;
1245 +        }
1246  
1247 -        case LOAD_CLOSURE:
1248 +        TARGET(LOAD_CLOSURE)
1249 +        {
1250              x = freevars[oparg];
1251              Py_INCREF(x);
1252              PUSH(x);
1253 -            if (x != NULL) continue;
1254 +            if (x != NULL) DISPATCH();
1255              break;
1256 +        }
1257  
1258 -        case LOAD_DEREF:
1259 +        TARGET(LOAD_DEREF)
1260 +        {
1261              x = freevars[oparg];
1262              w = PyCell_Get(x);
1263              if (w != NULL) {
1264                  PUSH(w);
1265 -                continue;
1266 +                DISPATCH();
1267              }
1268              err = -1;
1269              /* Don't stomp existing exception */
1270 @@ -2240,15 +2491,19 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1271                                       UNBOUNDFREE_ERROR_MSG, v);
1272              }
1273              break;
1274 +        }
1275  
1276 -        case STORE_DEREF:
1277 +        TARGET(STORE_DEREF)
1278 +        {
1279              w = POP();
1280              x = freevars[oparg];
1281              PyCell_Set(x, w);
1282              Py_DECREF(w);
1283 -            continue;
1284 +            DISPATCH();
1285 +        }
1286  
1287 -        case BUILD_TUPLE:
1288 +        TARGET(BUILD_TUPLE)
1289 +        {
1290              x = PyTuple_New(oparg);
1291              if (x != NULL) {
1292                  for (; --oparg >= 0;) {
1293 @@ -2256,11 +2511,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1294                      PyTuple_SET_ITEM(x, oparg, w);
1295                  }
1296                  PUSH(x);
1297 -                continue;
1298 +                DISPATCH();
1299              }
1300              break;
1301 +        }
1302  
1303 -        case BUILD_LIST:
1304 +        TARGET(BUILD_LIST)
1305 +        {
1306              x =  PyList_New(oparg);
1307              if (x != NULL) {
1308                  for (; --oparg >= 0;) {
1309 @@ -2268,11 +2525,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1310                      PyList_SET_ITEM(x, oparg, w);
1311                  }
1312                  PUSH(x);
1313 -                continue;
1314 +                DISPATCH();
1315              }
1316              break;
1317 +        }
1318  
1319 -        case BUILD_SET:
1320 +        TARGET(BUILD_SET)
1321 +        {
1322              x = PySet_New(NULL);
1323              if (x != NULL) {
1324                  for (; --oparg >= 0;) {
1325 @@ -2286,18 +2545,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1326                      break;
1327                  }
1328                  PUSH(x);
1329 -                continue;
1330 +                DISPATCH();
1331              }
1332              break;
1333 +        }
1334  
1335 -
1336 -        case BUILD_MAP:
1337 +        TARGET(BUILD_MAP)
1338 +        {
1339              x = _PyDict_NewPresized((Py_ssize_t)oparg);
1340              PUSH(x);
1341 -            if (x != NULL) continue;
1342 +            if (x != NULL) DISPATCH();
1343              break;
1344 +        }
1345  
1346 -        case STORE_MAP:
1347 +        TARGET_NOARG(STORE_MAP)
1348 +        {
1349              w = TOP();     /* key */
1350              u = SECOND();  /* value */
1351              v = THIRD();   /* dict */
1352 @@ -2306,10 +2568,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1353              err = PyDict_SetItem(v, w, u);  /* v[w] = u */
1354              Py_DECREF(u);
1355              Py_DECREF(w);
1356 -            if (err == 0) continue;
1357 +            if (err == 0) DISPATCH();
1358              break;
1359 +        }
1360  
1361 -        case MAP_ADD:
1362 +        TARGET(MAP_ADD)
1363 +        {
1364              w = TOP();     /* key */
1365              u = SECOND();  /* value */
1366              STACKADJ(-2);
1367 @@ -2320,20 +2584,24 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1368              Py_DECREF(w);
1369              if (err == 0) {
1370                  PREDICT(JUMP_ABSOLUTE);
1371 -                continue;
1372 +                DISPATCH();
1373              }
1374              break;
1375 +        }
1376  
1377 -        case LOAD_ATTR:
1378 +        TARGET(LOAD_ATTR)
1379 +        {
1380              w = GETITEM(names, oparg);
1381              v = TOP();
1382              x = PyObject_GetAttr(v, w);
1383              Py_DECREF(v);
1384              SET_TOP(x);
1385 -            if (x != NULL) continue;
1386 +            if (x != NULL) DISPATCH();
1387              break;
1388 +        }
1389  
1390 -        case COMPARE_OP:
1391 +        TARGET(COMPARE_OP)
1392 +        {
1393              w = POP();
1394              v = TOP();
1395              if (PyInt_CheckExact(w) && PyInt_CheckExact(v)) {
1396 @@ -2366,9 +2634,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1397              if (x == NULL) break;
1398              PREDICT(POP_JUMP_IF_FALSE);
1399              PREDICT(POP_JUMP_IF_TRUE);
1400 -            continue;
1401 +            DISPATCH();
1402 +        }
1403  
1404 -        case IMPORT_NAME:
1405 +        TARGET(IMPORT_NAME)
1406 +        {
1407              w = GETITEM(names, oparg);
1408              x = PyDict_GetItemString(f->f_builtins, "__import__");
1409              if (x == NULL) {
1410 @@ -2409,10 +2679,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1411              READ_TIMESTAMP(intr1);
1412              Py_DECREF(w);
1413              SET_TOP(x);
1414 -            if (x != NULL) continue;
1415 +            if (x != NULL) DISPATCH();
1416              break;
1417 +        }
1418  
1419 -        case IMPORT_STAR:
1420 +        TARGET_NOARG(IMPORT_STAR)
1421 +        {
1422              v = POP();
1423              PyFrame_FastToLocals(f);
1424              if ((x = f->f_locals) == NULL) {
1425 @@ -2425,34 +2697,40 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1426              READ_TIMESTAMP(intr1);
1427              PyFrame_LocalsToFast(f, 0);
1428              Py_DECREF(v);
1429 -            if (err == 0) continue;
1430 +            if (err == 0) DISPATCH();
1431              break;
1432 +        }
1433  
1434 -        case IMPORT_FROM:
1435 +        TARGET(IMPORT_FROM)
1436 +        {
1437              w = GETITEM(names, oparg);
1438              v = TOP();
1439              READ_TIMESTAMP(intr0);
1440              x = import_from(v, w);
1441              READ_TIMESTAMP(intr1);
1442              PUSH(x);
1443 -            if (x != NULL) continue;
1444 +            if (x != NULL) DISPATCH();
1445              break;
1446 +        }
1447  
1448 -        case JUMP_FORWARD:
1449 +        TARGET(JUMP_FORWARD)
1450 +        {
1451              JUMPBY(oparg);
1452 -            goto fast_next_opcode;
1453 +            FAST_DISPATCH();
1454 +        }
1455  
1456          PREDICTED_WITH_ARG(POP_JUMP_IF_FALSE);
1457 -        case POP_JUMP_IF_FALSE:
1458 +        TARGET(POP_JUMP_IF_FALSE)
1459 +        {
1460              w = POP();
1461              if (w == Py_True) {
1462                  Py_DECREF(w);
1463 -                goto fast_next_opcode;
1464 +                FAST_DISPATCH();
1465              }
1466              if (w == Py_False) {
1467                  Py_DECREF(w);
1468                  JUMPTO(oparg);
1469 -                goto fast_next_opcode;
1470 +                FAST_DISPATCH();
1471              }
1472              err = PyObject_IsTrue(w);
1473              Py_DECREF(w);
1474 @@ -2462,19 +2740,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1475                  JUMPTO(oparg);
1476              else
1477                  break;
1478 -            continue;
1479 -
1480 +            DISPATCH();
1481 +        }
1482          PREDICTED_WITH_ARG(POP_JUMP_IF_TRUE);
1483 -        case POP_JUMP_IF_TRUE:
1484 +        TARGET(POP_JUMP_IF_TRUE)
1485 +        {
1486              w = POP();
1487              if (w == Py_False) {
1488                  Py_DECREF(w);
1489 -                goto fast_next_opcode;
1490 +                FAST_DISPATCH();
1491              }
1492              if (w == Py_True) {
1493                  Py_DECREF(w);
1494                  JUMPTO(oparg);
1495 -                goto fast_next_opcode;
1496 +                FAST_DISPATCH();
1497              }
1498              err = PyObject_IsTrue(w);
1499              Py_DECREF(w);
1500 @@ -2486,18 +2765,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1501                  ;
1502              else
1503                  break;
1504 -            continue;
1505 +            DISPATCH();
1506 +        }
1507  
1508 -        case JUMP_IF_FALSE_OR_POP:
1509 +        TARGET(JUMP_IF_FALSE_OR_POP)
1510 +        {
1511              w = TOP();
1512              if (w == Py_True) {
1513                  STACKADJ(-1);
1514                  Py_DECREF(w);
1515 -                goto fast_next_opcode;
1516 +                FAST_DISPATCH();
1517              }
1518              if (w == Py_False) {
1519                  JUMPTO(oparg);
1520 -                goto fast_next_opcode;
1521 +                FAST_DISPATCH();
1522              }
1523              err = PyObject_IsTrue(w);
1524              if (err > 0) {
1525 @@ -2509,18 +2790,20 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1526                  JUMPTO(oparg);
1527              else
1528                  break;
1529 -            continue;
1530 +            DISPATCH();
1531 +        }
1532  
1533 -        case JUMP_IF_TRUE_OR_POP:
1534 +        TARGET(JUMP_IF_TRUE_OR_POP)
1535 +        {
1536              w = TOP();
1537              if (w == Py_False) {
1538                  STACKADJ(-1);
1539                  Py_DECREF(w);
1540 -                goto fast_next_opcode;
1541 +                FAST_DISPATCH();
1542              }
1543              if (w == Py_True) {
1544                  JUMPTO(oparg);
1545 -                goto fast_next_opcode;
1546 +                FAST_DISPATCH();
1547              }
1548              err = PyObject_IsTrue(w);
1549              if (err > 0) {
1550 @@ -2533,10 +2816,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1551              }
1552              else
1553                  break;
1554 -            continue;
1555 +            DISPATCH();
1556 +        }
1557  
1558          PREDICTED_WITH_ARG(JUMP_ABSOLUTE);
1559 -        case JUMP_ABSOLUTE:
1560 +        TARGET(JUMP_ABSOLUTE)
1561 +        {
1562              JUMPTO(oparg);
1563  #if FAST_LOOPS
1564              /* Enabling this path speeds-up all while and for-loops by bypassing
1565 @@ -2548,10 +2833,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1566              */
1567              goto fast_next_opcode;
1568  #else
1569 -            continue;
1570 +            DISPATCH();
1571  #endif
1572 +        }
1573  
1574 -        case GET_ITER:
1575 +        TARGET_NOARG(GET_ITER)
1576 +        {
1577              /* before: [obj]; after [getiter(obj)] */
1578              v = TOP();
1579              x = PyObject_GetIter(v);
1580 @@ -2559,13 +2846,15 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1581              if (x != NULL) {
1582                  SET_TOP(x);
1583                  PREDICT(FOR_ITER);
1584 -                continue;
1585 +                DISPATCH();
1586              }
1587              STACKADJ(-1);
1588              break;
1589 +        }
1590  
1591          PREDICTED_WITH_ARG(FOR_ITER);
1592 -        case FOR_ITER:
1593 +        TARGET(FOR_ITER)
1594 +        {
1595              /* before: [iter]; after: [iter, iter()] *or* [] */
1596              v = TOP();
1597              x = (*v->ob_type->tp_iternext)(v);
1598 @@ -2573,7 +2862,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1599                  PUSH(x);
1600                  PREDICT(STORE_FAST);
1601                  PREDICT(UNPACK_SEQUENCE);
1602 -                continue;
1603 +                DISPATCH();
1604              }
1605              if (PyErr_Occurred()) {
1606                  if (!PyErr_ExceptionMatches(
1607 @@ -2585,13 +2874,17 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1608              x = v = POP();
1609              Py_DECREF(v);
1610              JUMPBY(oparg);
1611 -            continue;
1612 +            DISPATCH();
1613 +        }
1614  
1615 -        case BREAK_LOOP:
1616 +        TARGET_NOARG(BREAK_LOOP)
1617 +        {
1618              why = WHY_BREAK;
1619              goto fast_block_end;
1620 +        }
1621  
1622 -        case CONTINUE_LOOP:
1623 +        TARGET(CONTINUE_LOOP)
1624 +        {
1625              retval = PyInt_FromLong(oparg);
1626              if (!retval) {
1627                  x = NULL;
1628 @@ -2599,10 +2892,13 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1629              }
1630              why = WHY_CONTINUE;
1631              goto fast_block_end;
1632 +        }
1633  
1634 -        case SETUP_LOOP:
1635 -        case SETUP_EXCEPT:
1636 -        case SETUP_FINALLY:
1637 +        TARGET_WITH_IMPL(SETUP_LOOP, _setup_finally)
1638 +        TARGET_WITH_IMPL(SETUP_EXCEPT, _setup_finally)
1639 +        TARGET(SETUP_FINALLY)
1640 +        _setup_finally:
1641 +        {
1642              /* NOTE: If you add any new block-setup opcodes that
1643                 are not try/except/finally handlers, you may need
1644                 to update the PyGen_NeedsFinalizing() function.
1645 @@ -2610,9 +2906,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1646  
1647              PyFrame_BlockSetup(f, opcode, INSTR_OFFSET() + oparg,
1648                                 STACK_LEVEL());
1649 -            continue;
1650 +            DISPATCH();
1651 +        }
1652  
1653 -        case SETUP_WITH:
1654 +
1655 +        TARGET(SETUP_WITH)
1656 +        {
1657          {
1658              static PyObject *exit, *enter;
1659              w = TOP();
1660 @@ -2638,10 +2937,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1661                                 STACK_LEVEL());
1662  
1663              PUSH(x);
1664 -            continue;
1665 +            DISPATCH();
1666 +          }
1667          }
1668  
1669 -        case WITH_CLEANUP:
1670 +        TARGET_NOARG(WITH_CLEANUP)
1671          {
1672              /* At the top of the stack are 1-3 values indicating
1673                 how/why we entered the finally clause:
1674 @@ -2729,7 +3029,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1675              break;
1676          }
1677  
1678 -        case CALL_FUNCTION:
1679 +        TARGET(CALL_FUNCTION)
1680          {
1681              PyObject **sp;
1682              PCALL(PCALL_ALL);
1683 @@ -2741,14 +3041,14 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1684  #endif
1685              stack_pointer = sp;
1686              PUSH(x);
1687 -            if (x != NULL)
1688 -                continue;
1689 +            if (x != NULL) DISPATCH();
1690              break;
1691          }
1692  
1693 -        case CALL_FUNCTION_VAR:
1694 -        case CALL_FUNCTION_KW:
1695 -        case CALL_FUNCTION_VAR_KW:
1696 +        TARGET_WITH_IMPL(CALL_FUNCTION_VAR, _call_function_var_kw)
1697 +        TARGET_WITH_IMPL(CALL_FUNCTION_KW, _call_function_var_kw)
1698 +        TARGET(CALL_FUNCTION_VAR_KW)
1699 +        _call_function_var_kw:
1700          {
1701              int na = oparg & 0xff;
1702              int nk = (oparg>>8) & 0xff;
1703 @@ -2786,12 +3086,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1704                  Py_DECREF(w);
1705              }
1706              PUSH(x);
1707 -            if (x != NULL)
1708 -                continue;
1709 +            if (x != NULL) DISPATCH();
1710              break;
1711          }
1712  
1713 -        case MAKE_FUNCTION:
1714 +        TARGET(MAKE_FUNCTION)
1715 +        {
1716              v = POP(); /* code object */
1717              x = PyFunction_New(v, f->f_globals);
1718              Py_DECREF(v);
1719 @@ -2812,8 +3112,9 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1720              }
1721              PUSH(x);
1722              break;
1723 +        }
1724  
1725 -        case MAKE_CLOSURE:
1726 +        TARGET(MAKE_CLOSURE)
1727          {
1728              v = POP(); /* code object */
1729              x = PyFunction_New(v, f->f_globals);
1730 @@ -2848,7 +3149,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1731              break;
1732          }
1733  
1734 -        case BUILD_SLICE:
1735 +        TARGET(BUILD_SLICE)
1736 +        {
1737              if (oparg == 3)
1738                  w = POP();
1739              else
1740 @@ -2860,14 +3162,22 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
1741              Py_DECREF(v);
1742              Py_XDECREF(w);
1743              SET_TOP(x);
1744 -            if (x != NULL) continue;
1745 +            if (x != NULL) DISPATCH();
1746              break;
1747 +        }
1748  
1749 -        case EXTENDED_ARG:
1750 +        TARGET(EXTENDED_ARG)
1751 +        {
1752              opcode = NEXTOP();
1753              oparg = oparg<<16 | NEXTARG();
1754              goto dispatch_opcode;
1755  
1756 +        }
1757 +
1758 +
1759 +#if USE_COMPUTED_GOTOS
1760 +        _unknown_opcode:
1761 +#endif
1762          default:
1763              fprintf(stderr,
1764                  "XXX lineno: %d, opcode: %d\n",
1765 diff --git a/Python/makeopcodetargets.py b/Python/makeopcodetargets.py
1766 index e69de29..703e5f2 100644
1767 --- a/Python/makeopcodetargets.py
1768 +++ b/Python/makeopcodetargets.py
1769 @@ -0,0 +1,45 @@
1770 +#! /usr/bin/env python
1771 +"""Generate C code for the jump table of the threaded code interpreter
1772 +(for compilers supporting computed gotos or "labels-as-values", such as gcc).
1773 +"""
1774 +
1775 +# This code should stay compatible with Python 2.3, at least while
1776 +# some of the buildbots have Python 2.3 as their system Python.
1777 +
1778 +import imp
1779 +import os
1780 +
1781 +
1782 +def find_module(modname):
1783 +    """Finds and returns a module in the local dist/checkout.
1784 +    """
1785 +    modpath = os.path.join(
1786 +        os.path.dirname(os.path.dirname(__file__)), "Lib")
1787 +    return imp.load_module(modname, *imp.find_module(modname, [modpath]))
1788 +
1789 +def write_contents(f):
1790 +    """Write C code contents to the target file object.
1791 +    """
1792 +    opcode = find_module("opcode")
1793 +    targets = ['_unknown_opcode'] * 256
1794 +    for opname, op in opcode.opmap.items():
1795 +        if opname == "STOP_CODE":
1796 +            continue
1797 +        targets[op] = "TARGET_%s" % opname.replace("+0", " ").replace("+", "_")
1798 +    f.write("static void *opcode_targets[256] = {\n")
1799 +    f.write(",\n".join(["    &&%s" % s for s in targets]))
1800 +    f.write("\n};\n")
1801 +
1802 +
1803 +if __name__ == "__main__":
1804 +    import sys
1805 +    assert len(sys.argv) < 3, "Too many arguments"
1806 +    if len(sys.argv) == 2:
1807 +        target = sys.argv[1]
1808 +    else:
1809 +        target = "Python/opcode_targets.h"
1810 +    f = open(target, "w")
1811 +    try:
1812 +        write_contents(f)
1813 +    finally:
1814 +        f.close()
1815 \ No newline at end of file
1816 diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h
1817 index e69de29..2203566 100644
1818 --- a/Python/opcode_targets.h
1819 +++ b/Python/opcode_targets.h
1820 @@ -0,0 +1,258 @@
1821 +static void *opcode_targets[256] = {
1822 +    &&_unknown_opcode,
1823 +    &&TARGET_POP_TOP,
1824 +    &&TARGET_ROT_TWO,
1825 +    &&TARGET_ROT_THREE,
1826 +    &&TARGET_DUP_TOP,
1827 +    &&TARGET_ROT_FOUR,
1828 +    &&_unknown_opcode,
1829 +    &&_unknown_opcode,
1830 +    &&_unknown_opcode,
1831 +    &&TARGET_NOP,
1832 +    &&TARGET_UNARY_POSITIVE,
1833 +    &&TARGET_UNARY_NEGATIVE,
1834 +    &&TARGET_UNARY_NOT,
1835 +    &&TARGET_UNARY_CONVERT,
1836 +    &&_unknown_opcode,
1837 +    &&TARGET_UNARY_INVERT,
1838 +    &&_unknown_opcode,
1839 +    &&_unknown_opcode,
1840 +    &&_unknown_opcode,
1841 +    &&TARGET_BINARY_POWER,
1842 +    &&TARGET_BINARY_MULTIPLY,
1843 +    &&TARGET_BINARY_DIVIDE,
1844 +    &&TARGET_BINARY_MODULO,
1845 +    &&TARGET_BINARY_ADD,
1846 +    &&TARGET_BINARY_SUBTRACT,
1847 +    &&TARGET_BINARY_SUBSCR,
1848 +    &&TARGET_BINARY_FLOOR_DIVIDE,
1849 +    &&TARGET_BINARY_TRUE_DIVIDE,
1850 +    &&TARGET_INPLACE_FLOOR_DIVIDE,
1851 +    &&TARGET_INPLACE_TRUE_DIVIDE,
1852 +    &&TARGET_SLICE ,
1853 +    &&TARGET_SLICE_1,
1854 +    &&TARGET_SLICE_2,
1855 +    &&TARGET_SLICE_3,
1856 +    &&_unknown_opcode,
1857 +    &&_unknown_opcode,
1858 +    &&_unknown_opcode,
1859 +    &&_unknown_opcode,
1860 +    &&_unknown_opcode,
1861 +    &&_unknown_opcode,
1862 +    &&TARGET_STORE_SLICE ,
1863 +    &&TARGET_STORE_SLICE_1,
1864 +    &&TARGET_STORE_SLICE_2,
1865 +    &&TARGET_STORE_SLICE_3,
1866 +    &&_unknown_opcode,
1867 +    &&_unknown_opcode,
1868 +    &&_unknown_opcode,
1869 +    &&_unknown_opcode,
1870 +    &&_unknown_opcode,
1871 +    &&_unknown_opcode,
1872 +    &&TARGET_DELETE_SLICE ,
1873 +    &&TARGET_DELETE_SLICE_1,
1874 +    &&TARGET_DELETE_SLICE_2,
1875 +    &&TARGET_DELETE_SLICE_3,
1876 +    &&TARGET_STORE_MAP,
1877 +    &&TARGET_INPLACE_ADD,
1878 +    &&TARGET_INPLACE_SUBTRACT,
1879 +    &&TARGET_INPLACE_MULTIPLY,
1880 +    &&TARGET_INPLACE_DIVIDE,
1881 +    &&TARGET_INPLACE_MODULO,
1882 +    &&TARGET_STORE_SUBSCR,
1883 +    &&TARGET_DELETE_SUBSCR,
1884 +    &&TARGET_BINARY_LSHIFT,
1885 +    &&TARGET_BINARY_RSHIFT,
1886 +    &&TARGET_BINARY_AND,
1887 +    &&TARGET_BINARY_XOR,
1888 +    &&TARGET_BINARY_OR,
1889 +    &&TARGET_INPLACE_POWER,
1890 +    &&TARGET_GET_ITER,
1891 +    &&_unknown_opcode,
1892 +    &&TARGET_PRINT_EXPR,
1893 +    &&TARGET_PRINT_ITEM,
1894 +    &&TARGET_PRINT_NEWLINE,
1895 +    &&TARGET_PRINT_ITEM_TO,
1896 +    &&TARGET_PRINT_NEWLINE_TO,
1897 +    &&TARGET_INPLACE_LSHIFT,
1898 +    &&TARGET_INPLACE_RSHIFT,
1899 +    &&TARGET_INPLACE_AND,
1900 +    &&TARGET_INPLACE_XOR,
1901 +    &&TARGET_INPLACE_OR,
1902 +    &&TARGET_BREAK_LOOP,
1903 +    &&TARGET_WITH_CLEANUP,
1904 +    &&TARGET_LOAD_LOCALS,
1905 +    &&TARGET_RETURN_VALUE,
1906 +    &&TARGET_IMPORT_STAR,
1907 +    &&TARGET_EXEC_STMT,
1908 +    &&TARGET_YIELD_VALUE,
1909 +    &&TARGET_POP_BLOCK,
1910 +    &&TARGET_END_FINALLY,
1911 +    &&TARGET_BUILD_CLASS,
1912 +    &&TARGET_STORE_NAME,
1913 +    &&TARGET_DELETE_NAME,
1914 +    &&TARGET_UNPACK_SEQUENCE,
1915 +    &&TARGET_FOR_ITER,
1916 +    &&TARGET_LIST_APPEND,
1917 +    &&TARGET_STORE_ATTR,
1918 +    &&TARGET_DELETE_ATTR,
1919 +    &&TARGET_STORE_GLOBAL,
1920 +    &&TARGET_DELETE_GLOBAL,
1921 +    &&TARGET_DUP_TOPX,
1922 +    &&TARGET_LOAD_CONST,
1923 +    &&TARGET_LOAD_NAME,
1924 +    &&TARGET_BUILD_TUPLE,
1925 +    &&TARGET_BUILD_LIST,
1926 +    &&TARGET_BUILD_SET,
1927 +    &&TARGET_BUILD_MAP,
1928 +    &&TARGET_LOAD_ATTR,
1929 +    &&TARGET_COMPARE_OP,
1930 +    &&TARGET_IMPORT_NAME,
1931 +    &&TARGET_IMPORT_FROM,
1932 +    &&TARGET_JUMP_FORWARD,
1933 +    &&TARGET_JUMP_IF_FALSE_OR_POP,
1934 +    &&TARGET_JUMP_IF_TRUE_OR_POP,
1935 +    &&TARGET_JUMP_ABSOLUTE,
1936 +    &&TARGET_POP_JUMP_IF_FALSE,
1937 +    &&TARGET_POP_JUMP_IF_TRUE,
1938 +    &&TARGET_LOAD_GLOBAL,
1939 +    &&_unknown_opcode,
1940 +    &&_unknown_opcode,
1941 +    &&TARGET_CONTINUE_LOOP,
1942 +    &&TARGET_SETUP_LOOP,
1943 +    &&TARGET_SETUP_EXCEPT,
1944 +    &&TARGET_SETUP_FINALLY,
1945 +    &&_unknown_opcode,
1946 +    &&TARGET_LOAD_FAST,
1947 +    &&TARGET_STORE_FAST,
1948 +    &&TARGET_DELETE_FAST,
1949 +    &&_unknown_opcode,
1950 +    &&_unknown_opcode,
1951 +    &&_unknown_opcode,
1952 +    &&TARGET_RAISE_VARARGS,
1953 +    &&TARGET_CALL_FUNCTION,
1954 +    &&TARGET_MAKE_FUNCTION,
1955 +    &&TARGET_BUILD_SLICE,
1956 +    &&TARGET_MAKE_CLOSURE,
1957 +    &&TARGET_LOAD_CLOSURE,
1958 +    &&TARGET_LOAD_DEREF,
1959 +    &&TARGET_STORE_DEREF,
1960 +    &&_unknown_opcode,
1961 +    &&_unknown_opcode,
1962 +    &&TARGET_CALL_FUNCTION_VAR,
1963 +    &&TARGET_CALL_FUNCTION_KW,
1964 +    &&TARGET_CALL_FUNCTION_VAR_KW,
1965 +    &&TARGET_SETUP_WITH,
1966 +    &&_unknown_opcode,
1967 +    &&TARGET_EXTENDED_ARG,
1968 +    &&TARGET_SET_ADD,
1969 +    &&TARGET_MAP_ADD,
1970 +    &&_unknown_opcode,
1971 +    &&_unknown_opcode,
1972 +    &&_unknown_opcode,
1973 +    &&_unknown_opcode,
1974 +    &&_unknown_opcode,
1975 +    &&_unknown_opcode,
1976 +    &&_unknown_opcode,
1977 +    &&_unknown_opcode,
1978 +    &&_unknown_opcode,
1979 +    &&_unknown_opcode,
1980 +    &&_unknown_opcode,
1981 +    &&_unknown_opcode,
1982 +    &&_unknown_opcode,
1983 +    &&_unknown_opcode,
1984 +    &&_unknown_opcode,
1985 +    &&_unknown_opcode,
1986 +    &&_unknown_opcode,
1987 +    &&_unknown_opcode,
1988 +    &&_unknown_opcode,
1989 +    &&_unknown_opcode,
1990 +    &&_unknown_opcode,
1991 +    &&_unknown_opcode,
1992 +    &&_unknown_opcode,
1993 +    &&_unknown_opcode,
1994 +    &&_unknown_opcode,
1995 +    &&_unknown_opcode,
1996 +    &&_unknown_opcode,
1997 +    &&_unknown_opcode,
1998 +    &&_unknown_opcode,
1999 +    &&_unknown_opcode,
2000 +    &&_unknown_opcode,
2001 +    &&_unknown_opcode,
2002 +    &&_unknown_opcode,
2003 +    &&_unknown_opcode,
2004 +    &&_unknown_opcode,
2005 +    &&_unknown_opcode,
2006 +    &&_unknown_opcode,
2007 +    &&_unknown_opcode,
2008 +    &&_unknown_opcode,
2009 +    &&_unknown_opcode,
2010 +    &&_unknown_opcode,
2011 +    &&_unknown_opcode,
2012 +    &&_unknown_opcode,
2013 +    &&_unknown_opcode,
2014 +    &&_unknown_opcode,
2015 +    &&_unknown_opcode,
2016 +    &&_unknown_opcode,
2017 +    &&_unknown_opcode,
2018 +    &&_unknown_opcode,
2019 +    &&_unknown_opcode,
2020 +    &&_unknown_opcode,
2021 +    &&_unknown_opcode,
2022 +    &&_unknown_opcode,
2023 +    &&_unknown_opcode,
2024 +    &&_unknown_opcode,
2025 +    &&_unknown_opcode,
2026 +    &&_unknown_opcode,
2027 +    &&_unknown_opcode,
2028 +    &&_unknown_opcode,
2029 +    &&_unknown_opcode,
2030 +    &&_unknown_opcode,
2031 +    &&_unknown_opcode,
2032 +    &&_unknown_opcode,
2033 +    &&_unknown_opcode,
2034 +    &&_unknown_opcode,
2035 +    &&_unknown_opcode,
2036 +    &&_unknown_opcode,
2037 +    &&_unknown_opcode,
2038 +    &&_unknown_opcode,
2039 +    &&_unknown_opcode,
2040 +    &&_unknown_opcode,
2041 +    &&_unknown_opcode,
2042 +    &&_unknown_opcode,
2043 +    &&_unknown_opcode,
2044 +    &&_unknown_opcode,
2045 +    &&_unknown_opcode,
2046 +    &&_unknown_opcode,
2047 +    &&_unknown_opcode,
2048 +    &&_unknown_opcode,
2049 +    &&_unknown_opcode,
2050 +    &&_unknown_opcode,
2051 +    &&_unknown_opcode,
2052 +    &&_unknown_opcode,
2053 +    &&_unknown_opcode,
2054 +    &&_unknown_opcode,
2055 +    &&_unknown_opcode,
2056 +    &&_unknown_opcode,
2057 +    &&_unknown_opcode,
2058 +    &&_unknown_opcode,
2059 +    &&_unknown_opcode,
2060 +    &&_unknown_opcode,
2061 +    &&_unknown_opcode,
2062 +    &&_unknown_opcode,
2063 +    &&_unknown_opcode,
2064 +    &&_unknown_opcode,
2065 +    &&_unknown_opcode,
2066 +    &&_unknown_opcode,
2067 +    &&_unknown_opcode,
2068 +    &&_unknown_opcode,
2069 +    &&_unknown_opcode,
2070 +    &&_unknown_opcode,
2071 +    &&_unknown_opcode,
2072 +    &&_unknown_opcode,
2073 +    &&_unknown_opcode,
2074 +    &&_unknown_opcode,
2075 +    &&_unknown_opcode,
2076 +    &&_unknown_opcode,
2077 +    &&_unknown_opcode
2078 +};
2079 \ No newline at end of file
2080 diff --git a/configure b/configure
2081 index 6a47e1a..60a3335 100755
2082 --- a/configure
2083 +++ b/configure
2084 @@ -810,6 +810,7 @@ with_libm
2085  with_libc
2086  enable_big_digits
2087  enable_unicode
2088 +with_computed_gotos
2089  '
2090        ac_precious_vars='build_alias
2091  host_alias
2092 @@ -1488,6 +1489,9 @@ Optional Packages:
2093    --with-fpectl           enable SIGFPE catching
2094    --with-libm=STRING      math library
2095    --with-libc=STRING      C library
2096 +  --with(out)-computed-gotos
2097 +                          Use computed gotos in evaluation loop (enabled by
2098 +                          default on supported compilers)
2099  
2100  Some influential environment variables:
2101    CC          C compiler command
2102 @@ -14608,6 +14612,83 @@ for dir in $SRCDIRS; do
2103          mkdir $dir
2104      fi
2105  done
2106 +
2107 + BEGIN_COMPUTED_GOTO
2108 +# Check for --with-computed-gotos
2109 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-computed-gotos" >&5
2110 +$as_echo_n "checking for --with-computed-gotos... " >&6; }
2111 +
2112 +# Check whether --with-computed-gotos was given.
2113 +if test "${with_computed_gotos+set}" = set; then :
2114 +  withval=$with_computed_gotos;
2115 +if test "$withval" = yes
2116 +then
2117 +
2118 +$as_echo "#define USE_COMPUTED_GOTOS 1" >>confdefs.h
2119 +
2120 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
2121 +$as_echo "yes" >&6; }
2122 +fi
2123 +if test "$withval" = no
2124 +then
2125 +
2126 +$as_echo "#define USE_COMPUTED_GOTOS 0" >>confdefs.h
2127 +
2128 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2129 +$as_echo "no" >&6; }
2130 +fi
2131 +
2132 +else
2133 +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no value specified" >&5
2134 +$as_echo "no value specified" >&6; }
2135 +fi
2136 +
2137 +
2138 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports computed gotos" >&5
2139 +$as_echo_n "checking whether $CC supports computed gotos... " >&6; }
2140 +if ${ac_cv_computed_gotos+:} false; then :
2141 +  $as_echo_n "(cached) " >&6
2142 +else
2143 +  if test "$cross_compiling" = yes; then :
2144 +  if test "${with_computed_gotos+set}" = set; then
2145 +   ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
2146 + else
2147 +   ac_cv_computed_gotos=no
2148 + fi
2149 +else
2150 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2151 +/* end confdefs.h.  */
2152 +int main(int argc, char **argv)
2153 +{
2154 +    static void *targets[1] = { &&LABEL1 };
2155 +    goto LABEL2;
2156 +LABEL1:
2157 +    return 0;
2158 +LABEL2:
2159 +    goto *targets[0];
2160 +    return 1;
2161 +}
2162 +_ACEOF
2163 +if ac_fn_c_try_run "$LINENO"; then :
2164 +  ac_cv_computed_gotos=yes
2165 +else
2166 +  ac_cv_computed_gotos=no
2167 +fi
2168 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
2169 +  conftest.$ac_objext conftest.beam conftest.$ac_ext
2170 +fi
2171 +
2172 +fi
2173 +
2174 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_computed_gotos" >&5
2175 +$as_echo "$ac_cv_computed_gotos" >&6; }
2176 +case "$ac_cv_computed_gotos" in yes*)
2177 +
2178 +$as_echo "#define HAVE_COMPUTED_GOTOS 1" >>confdefs.h
2179 +
2180 +esac
2181 +# END_COMPUTED_GOTO
2182 +
2183  { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
2184  $as_echo "done" >&6; }
2185  
2186 diff --git a/configure.ac b/configure.ac
2187 index 48eccdd..74bb514 100644
2188 --- a/configure.ac
2189 +++ b/configure.ac
2190 @@ -4561,6 +4561,57 @@ for dir in $SRCDIRS; do
2191          mkdir $dir
2192      fi
2193  done
2194 +
2195 +# BEGIN_COMPUTED_GOTO
2196 +# Check for --with-computed-gotos
2197 +AC_MSG_CHECKING(for --with-computed-gotos)
2198 +AC_ARG_WITH(computed-gotos,
2199 +            AS_HELP_STRING([--with(out)-computed-gotos],
2200 +                           [Use computed gotos in evaluation loop (enabled by default on supported compilers)]),
2201 +[
2202 +if test "$withval" = yes
2203 +then
2204 +  AC_DEFINE(USE_COMPUTED_GOTOS, 1,
2205 +  [Define if you want to use computed gotos in ceval.c.])
2206 +  AC_MSG_RESULT(yes)
2207 +fi
2208 +if test "$withval" = no
2209 +then
2210 +  AC_DEFINE(USE_COMPUTED_GOTOS, 0,
2211 +  [Define if you want to use computed gotos in ceval.c.])
2212 +  AC_MSG_RESULT(no)
2213 +fi
2214 +],
2215 +[AC_MSG_RESULT(no value specified)])
2216 +
2217 +AC_MSG_CHECKING(whether $CC supports computed gotos)
2218 +AC_CACHE_VAL(ac_cv_computed_gotos,
2219 +AC_RUN_IFELSE([AC_LANG_SOURCE([[[
2220 +int main(int argc, char **argv)
2221 +{
2222 +    static void *targets[1] = { &&LABEL1 };
2223 +    goto LABEL2;
2224 +LABEL1:
2225 +    return 0;
2226 +LABEL2:
2227 +    goto *targets[0];
2228 +    return 1;
2229 +}
2230 +]]])],
2231 +[ac_cv_computed_gotos=yes],
2232 +[ac_cv_computed_gotos=no],
2233 +[if test "${with_computed_gotos+set}" = set; then
2234 +   ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos"
2235 + else
2236 +   ac_cv_computed_gotos=no
2237 + fi]))
2238 +AC_MSG_RESULT($ac_cv_computed_gotos)
2239 +case "$ac_cv_computed_gotos" in yes*)
2240 +  AC_DEFINE(HAVE_COMPUTED_GOTOS, 1,
2241 +  [Define if the C compiler supports computed gotos.])
2242 +esac
2243 +# END_COMPUTED_GOTO
2244 +
2245  AC_MSG_RESULT(done)
2246  
2247  # generate output files
2248 diff --git a/pyconfig.h.in b/pyconfig.h.in
2249 index eace285..ac85729 100644
2250 --- a/pyconfig.h.in
2251 +++ b/pyconfig.h.in
2252 @@ -121,6 +121,9 @@
2253  /* Define to 1 if you have the `clock' function. */
2254  #undef HAVE_CLOCK
2255  
2256 +/* Define if the C compiler supports computed gotos. */
2257 +#undef HAVE_COMPUTED_GOTOS
2258 +
2259  /* Define to 1 if you have the `confstr' function. */
2260  #undef HAVE_CONFSTR
2261  
2262 @@ -1060,6 +1063,9 @@
2263  /* Define to 1 if your <sys/time.h> declares `struct tm'. */
2264  #undef TM_IN_SYS_TIME
2265  
2266 +/* Define if you want to use computed gotos in ceval.c. */
2267 +#undef USE_COMPUTED_GOTOS
2268 +
2269  /* Enable extensions on AIX 3, Interix.  */
2270  #ifndef _ALL_SOURCE
2271  # undef _ALL_SOURCE
2272 -- 
2273 2.5.5
2274