[pypy-commit] pypy unroll-if-alt: Builder.append_multiple_char can be unrolled if `times` is a Const. This causes a segfault, but it is in teh register allocator, so that needs to be debugged indepdently.

alex_gaynor noreply at buildbot.pypy.org
Sat Jul 30 02:08:07 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: unroll-if-alt
Changeset: r46099:0047db5c6851
Date: 2011-07-29 17:08 -0700
http://bitbucket.org/pypy/pypy/changeset/0047db5c6851/

Log:	Builder.append_multiple_char can be unrolled if `times` is a Const.
	This causes a segfault, but it is in teh register allocator, so that
	needs to be debugged indepdently.

diff --git a/pypy/rpython/lltypesystem/rbuilder.py b/pypy/rpython/lltypesystem/rbuilder.py
--- a/pypy/rpython/lltypesystem/rbuilder.py
+++ b/pypy/rpython/lltypesystem/rbuilder.py
@@ -1,4 +1,4 @@
-from pypy.rlib import rgc
+from pypy.rlib import rgc, jit
 from pypy.rlib.objectmodel import enforceargs
 from pypy.rlib.rarithmetic import ovfcheck
 from pypy.rpython.annlowlevel import llstr
@@ -92,6 +92,7 @@
         ll_builder.used = needed + used
 
     @staticmethod
+    @jit.unroll_if(lambda ll_builder, char, times: jit.isconstant(times) and times <= 4)
     def ll_append_multiple_char(ll_builder, char, times):
         used = ll_builder.used
         if times + used > ll_builder.allocated:


More information about the pypy-commit mailing list