[pypy-svn] r41076 - in pypy/dist/pypy/jit/timeshifter: . test
pedronis at codespeak.net
pedronis at codespeak.net
Thu Mar 22 15:37:03 CET 2007
Author: pedronis
Date: Thu Mar 22 15:37:01 2007
New Revision: 41076
Modified:
pypy/dist/pypy/jit/timeshifter/hrtyper.py
pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
Log:
oops the passin along logic for void arguments to metacalls was,
tweak the test to check for this too
Modified: pypy/dist/pypy/jit/timeshifter/hrtyper.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/hrtyper.py (original)
+++ pypy/dist/pypy/jit/timeshifter/hrtyper.py Thu Mar 22 15:37:01 2007
@@ -684,21 +684,23 @@
# note that if the ts_metacall operation is pure and green, then
# we don't even get there because the original graph in which
# it is will just be green_call'ed by the caller.
- nb_args = hop.nb_args - 2
- def normalize(hs):
+ args_r = []
+ args_s = []
+ for hs in hop.args_s[2:]:
T = originalconcretetype(hs)
if T is lltype.Void:
- return lltype.Void
+ args_r.append(lltype.Void)
+ args_s.append(annmodel.s_None)
else:
- return self.getredrepr(T)
- args_r = [normalize(hs) for hs in hop.args_s[2:]]
+ args_r.append(self.getredrepr(T))
+ args_s.append(self.s_RedBox)
vlist = hop.inputargs(lltype.Void, lltype.Void, *args_r)
metadesccls = vlist[1].value
metadesc = metadesccls(self)
metafunc = metadesc.metafunc
v_jitstate = hop.llops.getjitstate()
return hop.llops.genmixlevelhelpercall(metafunc,
- [self.s_JITState] + [self.s_RedBox] * nb_args,
+ [self.s_JITState] + args_s,
[v_jitstate] + vlist[2:],
self.s_RedBox)
Modified: pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py (original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_timeshift.py Thu Mar 22 15:37:01 2007
@@ -1660,22 +1660,32 @@
def _freeze_(self):
return True
- def metafunc(self, jitstate, mbox):
+ def metafunc(self, jitstate, space, mbox):
from pypy.jit.timeshifter.rvalue import IntRedBox
builder = jitstate.curbuilder
gv_result = builder.genop1("int_neg", mbox.getgenvar(jitstate))
return IntRedBox(mbox.kind, gv_result)
- def g(m):
- return m * 10
+ class Fz(object):
+ x = 10
+
+ def _freeze_(self):
+ return True
+
+ def g(fz, m):
+ return m * fz.x
+
+ fz = Fz()
def f(n, m):
- x = g(n)
- y = g(m)
+ x = g(fz, n)
+ y = g(fz, m)
hint(y, concrete=True)
- return x + g(y)
+ return x + g(fz, y)
class MyPolicy(HintAnnotatorPolicy):
+ novirtualcontainer = True
+
def look_inside_graph(self, graph):
if graph.func is g:
return MetaG # replaces g with a meta-call to metafunc()
More information about the Pypy-commit
mailing list