[pypy-svn] r36389 - in pypy/dist/pypy/jit/timeshifter: . test
pedronis at codespeak.net
pedronis at codespeak.net
Tue Jan 9 19:21:08 CET 2007
Author: pedronis
Date: Tue Jan 9 19:21:06 2007
New Revision: 36389
Modified:
pypy/dist/pypy/jit/timeshifter/rcontainer.py
pypy/dist/pypy/jit/timeshifter/rvalue.py
pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py
Log:
(arre, pedronis)
intermediate check-in with wip test about virtualized struct allocated in the timeshifted code and escaping back to
the outside world.
Modified: pypy/dist/pypy/jit/timeshifter/rcontainer.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rcontainer.py (original)
+++ pypy/dist/pypy/jit/timeshifter/rcontainer.py Tue Jan 9 19:21:06 2007
@@ -340,9 +340,15 @@
def force_runtime_container(self, builder):
assert 0
- def getgenvar(self):
- assert self.typedesc is not None
- return self.content_boxes[-1].genvar
+ def getgenvar(self, builder):
+ typedesc = self.typedesc
+ assert typedesc is not None
+ gv_outside = self.content_boxes[-1].genvar
+ if gv_outside is typedesc.gv_defl_outside:
+ gv_outside = builder.genop_malloc_fixedsize(typedesc.alloctoken)
+ self.content_boxes[-1].genvar = gv_outside
+ # xxx jitstate please
+ return gv_outside
def store_back(self, builder):
fielddescs = self.typedesc.fielddescs
Modified: pypy/dist/pypy/jit/timeshifter/rvalue.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rvalue.py (original)
+++ pypy/dist/pypy/jit/timeshifter/rvalue.py Tue Jan 9 19:21:06 2007
@@ -275,7 +275,7 @@
content = self.content
from pypy.jit.timeshifter import rcontainer
if isinstance(content, rcontainer.VirtualizableStruct):
- return content.getgenvar()
+ return content.getgenvar(builder)
assert isinstance(content, rcontainer.VirtualContainer)
content.force_runtime_container(builder)
assert self.genvar
Modified: pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py (original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py Tue Jan 9 19:21:06 2007
@@ -214,3 +214,31 @@
res = self.timeshift_from_portal(main, f, [20, 22], policy=P_NOVIRTUAL)
assert res == 42
self.check_insns(getfield=0)
+
+ def test_simple_explicit_construct_escape(self):
+ py.test.skip("in-progress")
+
+ def f(x, y):
+ xy = lltype.malloc(XY)
+ xy.access = lltype.nullptr(XY_ACCESS)
+ xy.x = x
+ xy.y = y
+ xy_access = xy.access
+ if xy_access:
+ x = xy_access.get_x(xy)
+ else:
+ x = xy.x
+ xy_access = xy.access
+ if xy_access:
+ y = xy_access.get_y(xy)
+ else:
+ y = xy.y
+ return xy
+
+ def main(x, y):
+ xy = f(x, y)
+ return xy.x+xy.y
+
+ res = self.timeshift_from_portal(main, f, [20, 22], policy=P_NOVIRTUAL)
+ assert res == 42
+ self.check_insns(getfield=0)
More information about the Pypy-commit
mailing list