[Python-checkins] python/dist/src/Python compile.c,2.335,2.336

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Tue Nov 2 05:20:12 CET 2004


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8045/Python

Modified Files:
	compile.c 
Log Message:
Maintain peepholer's cumlc invariant by updating the running total
everytime a LOAD_CONSTANT is encountered, created, or overwritten.

Added two tests to cover cases affected by the patch.



Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.335
retrieving revision 2.336
diff -u -d -r2.335 -r2.336
--- compile.c	1 Nov 2004 15:19:11 -0000	2.335
+++ compile.c	2 Nov 2004 04:20:09 -0000	2.336
@@ -586,6 +586,7 @@
 				if (PyList_GET_ITEM(consts, j) == Py_None) {
 					codestr[i] = LOAD_CONST;
 					SETARG(codestr, i, j);
+					cumlc = lastlc + 1;
 					break;
 				}
 			}
@@ -601,6 +602,7 @@
 			    !PyObject_IsTrue(PyList_GET_ITEM(consts, j)))
 				continue;
 			memset(codestr+i, NOP, 7);
+			cumlc = 0;
 			break;
 
 		/* Try to fold tuples of constants.
@@ -615,6 +617,8 @@
 			    codestr[h] == LOAD_CONST  && 
 			    ISBASICBLOCK(blocks, h, 3*(j+1))  &&
 			    tuple_of_constants(&codestr[h], j, consts)) {
+				assert(codestr[i] == LOAD_CONST);
+				cumlc = 1;
 				break;
 			}
 			/* Intentional fallthrough */



More information about the Python-checkins mailing list