[Python-checkins] python/dist/src/Python compile.c,2.324,2.325
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Wed Aug 25 19:19:40 CEST 2004
Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15834
Modified Files:
compile.c
Log Message:
Bypass peepholing of code with lineno tables having intervals >= 255.
Allows the lineno fixup code to remain simple and not have to deal with
multibyte codings.
* Add an assertion to that effect.
* Remove the XXX comment on the subject.
Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.324
retrieving revision 2.325
diff -u -d -r2.324 -r2.325
--- compile.c 25 Aug 2004 15:15:56 -0000 2.324
+++ compile.c 25 Aug 2004 17:19:38 -0000 2.325
@@ -435,6 +435,13 @@
unsigned int *blocks;
char *name;
+ /* Bypass optimization when the lineno table is too complex */
+ assert(PyString_Check(lineno_obj));
+ lineno = PyString_AS_STRING(lineno_obj);
+ tabsiz = PyString_GET_SIZE(lineno_obj);
+ if (memchr(lineno, 255, tabsiz) != NULL)
+ goto exitUnchanged;
+
if (!PyString_Check(code))
goto exitUnchanged;
@@ -614,15 +621,12 @@
}
/* Fixup linenotab */
- /* XXX make sure this handles intervals > 256 */
- assert(PyString_Check(lineno_obj));
- lineno = PyString_AS_STRING(lineno_obj);
- tabsiz = PyString_GET_SIZE(lineno_obj);
cum_orig_line = 0;
last_line = 0;
for (i=0 ; i < tabsiz ; i+=2) {
cum_orig_line += lineno[i];
new_line = addrmap[cum_orig_line];
+ assert (new_line - last_line < 255);
lineno[i] =((unsigned char)(new_line - last_line));
last_line = new_line;
}
More information about the Python-checkins
mailing list