[pypy-commit] pypy stackroot-speedup: Fix. "livevars" is the list returned from the previous push_roots,
arigo
noreply at buildbot.pypy.org
Sun Jan 29 19:57:00 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stackroot-speedup
Changeset: r51955:c4b086bfb967
Date: 2012-01-29 13:12 +0100
http://bitbucket.org/pypy/pypy/changeset/c4b086bfb967/
Log: Fix. "livevars" is the list returned from the previous push_roots,
so it already contains one extra item if insert_rec_marker is set.
diff --git a/pypy/rpython/memory/gctransform/framework.py b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -662,7 +662,7 @@
#
livevars = self.push_roots(hop, insert_rec_marker=rec)
self.default(hop)
- self.pop_roots(hop, livevars, insert_rec_marker=rec)
+ self.pop_roots(hop, livevars)
else:
self.default(hop)
if hop.spaceop.opname == "direct_call":
@@ -1248,21 +1248,20 @@
hop.genop("raw_store", [base_addr, c_type, c_k, v_adr])
return livevars
- def pop_roots(self, hop, livevars, insert_rec_marker=False):
+ def pop_roots(self, hop, livevars):
if self.decr_stack_ptr is None:
return
- length = len(livevars)
- if insert_rec_marker:
- length += 1
- if length == 0:
+ if not livevars:
return
- c_len = rmodel.inputconst(lltype.Signed, length)
+ c_len = rmodel.inputconst(lltype.Signed, len(livevars) )
base_addr = hop.genop("direct_call", [self.decr_stack_ptr, c_len ],
resulttype=llmemory.Address)
if self.gcdata.gc.moving_gc:
# for moving collectors, reload the roots into the local variables
c_type = rmodel.inputconst(lltype.Void, llmemory.Address)
for k,var in enumerate(livevars):
+ if isinstance(var, Constant): # "c_marker" only
+ continue
c_k = rmodel.inputconst(lltype.Signed, k)
v_newaddr = hop.genop("raw_load", [base_addr, c_type, c_k],
resulttype=llmemory.Address)
diff --git a/pypy/translator/c/test/test_newgc.py b/pypy/translator/c/test/test_newgc.py
--- a/pypy/translator/c/test/test_newgc.py
+++ b/pypy/translator/c/test/test_newgc.py
@@ -1193,7 +1193,8 @@
else:
return f_rec(n-1) + f_rec(n-2)
def fn():
- print f_rec(10)
+ n = f_rec(10)
+ assert n == 89
return 0
return fn
More information about the pypy-commit
mailing list