[Python-checkins] r65156 - in python/branches/tlee-ast-optimize/Python: compile.c optimize.c
thomas.lee
python-checkins at python.org
Sun Jul 20 17:20:53 CEST 2008
Author: thomas.lee
Date: Sun Jul 20 17:20:53 2008
New Revision: 65156
Log:
Remove the d_lineno assertion. More discussion around this needed: assumptions about bytecode and sourcecode occuring in roughly the same order are invalid with the optimizer in play. Disable a bunch of optimizations to make the assertion pass.
Modified:
python/branches/tlee-ast-optimize/Python/compile.c
python/branches/tlee-ast-optimize/Python/optimize.c
Modified: python/branches/tlee-ast-optimize/Python/compile.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/compile.c (original)
+++ python/branches/tlee-ast-optimize/Python/compile.c Sun Jul 20 17:20:53 2008
@@ -3639,10 +3639,7 @@
d_lineno = i->i_lineno - a->a_lineno;
assert(d_bytecode >= 0);
- /* XXX: removing stuff after a Return node causes this to fail */
-#if 0
assert(d_lineno >= 0);
-#endif
if(d_bytecode == 0 && d_lineno == 0)
return 1;
Modified: python/branches/tlee-ast-optimize/Python/optimize.c
==============================================================================
--- python/branches/tlee-ast-optimize/Python/optimize.c (original)
+++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jul 20 17:20:53 2008
@@ -6,8 +6,6 @@
#include "node.h"
#include "ast.h"
-#define NEXTLINE(lineno) (lineno+1)
-
typedef struct _optimizer_block {
struct _optimizer_block* b_next; /* next block on the stack */
PySTEntryObject* b_ste; /* symtable entry */
@@ -378,7 +376,7 @@
if (retseq == NULL)
return NULL;
last = asdl_seq_GET(seq, asdl_seq_LEN(seq)-1);
- ret = Return(value, NEXTLINE(last->lineno), last->col_offset, arena);
+ ret = Return(value, last->lineno, last->col_offset, arena);
if (ret == NULL)
return NULL;
asdl_seq_SET(retseq, 0, ret);
@@ -404,9 +402,12 @@
_inject_compound_stmt_return(stmt_ty stmt, stmt_ty next, PyArena* arena)
{
expr_ty value = NULL;
+ /* XXX!! ! !ASDASDASD PAY ATTENTION HERE!!!! */
+ /* This breaks lnotab because the `value' expr has a bad lineno! D'oh! */
if (next != NULL)
value = next->v.Return.value;
+#if 0
/* if the else body is not present, there will be no jump anyway */
if (stmt->kind == If_kind && stmt->v.If.orelse != NULL) {
stmt_ty inner = asdl_seq_GET(stmt->v.If.body,
@@ -458,6 +459,7 @@
return 0;
}
}
+#endif
return 1;
}
More information about the Python-checkins
mailing list