summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-03-28 12:05:00 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-03-28 12:05:00 (GMT)
commit5b75c38cc98762d59593ea1ce1d4d02946d499b4 (patch)
treec2ce11fd96a80a72cfeb44e472b8c37c15a569d5 /Python/compile.c
parent6e5c1792d9aad22d0a8385432e2082b06adaaba4 (diff)
downloadcpython-5b75c38cc98762d59593ea1ce1d4d02946d499b4.zip
cpython-5b75c38cc98762d59593ea1ce1d4d02946d499b4.tar.gz
cpython-5b75c38cc98762d59593ea1ce1d4d02946d499b4.tar.bz2
Factored out test for absolute jumps.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 8c259c1..3786cd9 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -325,7 +325,8 @@ intern_strings(PyObject *tuple)
#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 @@ optimize_code(PyObject *code, PyObject* consts)
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;