Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 28417:1a2fd109f6b6 legacy-trunk
Factored out test for absolute jumps.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 28 Mar 2003 12:05:00 +0000 |
| parents | 733729261c41 |
| children | 67d36f4dfea1 |
line wrap: on
line diff
--- a/Python/compile.c Thu Mar 27 17:25:10 2003 +0000 +++ b/Python/compile.c Fri Mar 28 12:05:00 2003 +0000 @@ -325,7 +325,8 @@ #define GETARG(arr, i) ((int)((arr[i+2]<<8) + arr[i+1])) #define UNCONDITIONAL_JUMP(op) (op==JUMP_ABSOLUTE || op==JUMP_FORWARD) -#define GETJUMPTGT(arr, i) (GETARG(arr,i) + (arr[i]==JUMP_ABSOLUTE ? 0 : i+3)) +#define ABSOLUTE_JUMP(op) (op==JUMP_ABSOLUTE || op==CONTINUE_LOOP) +#define GETJUMPTGT(arr, i) (GETARG(arr,i) + (ABSOLUTE_JUMP(arr[i]) ? 0 : i+3)) #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255 static PyObject * @@ -394,7 +395,7 @@ tgttgt = GETJUMPTGT(codestr, tgt); if (opcode == JUMP_FORWARD) /* JMP_ABS can go backwards */ opcode = JUMP_ABSOLUTE; - if (opcode != JUMP_ABSOLUTE && opcode != CONTINUE_LOOP) + if (!ABSOLUTE_JUMP(opcode)) tgttgt -= i + 3; /* Calc relative jump addr */ if (tgttgt < 0) /* No backward relative jumps */ continue;
