[pypy-svn] r37369 - in pypy/dist/pypy/jit/timeshifter: . test
pedronis at codespeak.net
pedronis at codespeak.net
Fri Jan 26 03:12:34 CET 2007
Author: pedronis
Date: Fri Jan 26 03:12:33 2007
New Revision: 37369
Modified:
pypy/dist/pypy/jit/timeshifter/rcontainer.py
pypy/dist/pypy/jit/timeshifter/rtimeshift.py
pypy/dist/pypy/jit/timeshifter/rvirtualizable.py
pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py
Log:
the simple setting test works again. most of the logic was already there in the previous checkins.
we simply record enough information in the shapemask to do proper reloading of the vars from the virtualizable
when back from the residual call.
Modified: pypy/dist/pypy/jit/timeshifter/rcontainer.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rcontainer.py (original)
+++ pypy/dist/pypy/jit/timeshifter/rcontainer.py Fri Jan 26 03:12:33 2007
@@ -643,17 +643,14 @@
gv_ptr = builder.genop_call(typedesc.vrti_read_forced_token,
typedesc.gv_vrti_read_forced_ptr,
[gv_vable_rti, gv_bitkey])
- self.content_boxes = None
- self.ownbox.genvar = gv_ptr
- self.ownbox.content = None
+ memo.forced.append((self, gv_ptr))
for box in boxes:
if not box.genvar:
assert isinstance(box, rvalue.PtrRedBox)
content = box.content
assert isinstance(content, VirtualStruct) # xxx for now
- content.reshape(jitstate, shapemask, memo)
-
+ content.reshape(jitstate, shapemask, memo)
class VirtualizableStruct(VirtualStruct):
@@ -795,14 +792,30 @@
gv_vable_rti = builder.genop_getfield(rti_token, gv_outside)
memo.gv_vable_rti = gv_vable_rti
boxes = self.content_boxes
+ nvirtual = 0
for _, i in typedesc.redirected_fielddescs:
box = boxes[i]
if not box.genvar:
+ nvirtual += 1
assert isinstance(box, rvalue.PtrRedBox)
content = box.content
assert isinstance(content, VirtualStruct) # xxx for now
content.reshape(jitstate, shapemask, memo)
+ bitmask = 1 << memo.bitcount
+ memo.bitcount += 1
+ memo.bitcount += nvirtual
+ if shapemask&bitmask:
+ vmask = bitmask
+ for fielddesc, i in typedesc.redirected_fielddescs:
+ box = boxes[i]
+ if not box.genvar:
+ vmask = vmask<<1
+ if not (shapemask&vmask):
+ continue
+ boxes[i] = fielddesc.generate_get(jitstate, gv_outside)
+
+
# patching VirtualStructCls
StructTypeDesc.VirtualStructCls = VirtualStruct
VirtualizableStructTypeDesc.VirtualStructCls = VirtualizableStruct
Modified: pypy/dist/pypy/jit/timeshifter/rtimeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rtimeshift.py (original)
+++ pypy/dist/pypy/jit/timeshifter/rtimeshift.py Fri Jan 26 03:12:33 2007
@@ -946,11 +946,17 @@
if virtualizables and shapemask:
memo = rvalue.make_vinfo_memo()
memo.bitcount = 0
+ memo.forced = []
memo.gv_vable_rti = None
for virtualizable_box in virtualizables:
content = virtualizable_box.content
assert isinstance(content, rcontainer.VirtualizableStruct)
content.reshape(self, shapemask, memo)
+
+ for vstruct, gv_ptr in memo.forced:
+ vstruct.content_boxes = None
+ vstruct.ownbox.genvar = gv_ptr
+ vstruct.ownbox.content = None
def freeze(self, memo):
result = FrozenJITState()
Modified: pypy/dist/pypy/jit/timeshifter/rvirtualizable.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rvirtualizable.py (original)
+++ pypy/dist/pypy/jit/timeshifter/rvirtualizable.py Fri Jan 26 03:12:33 2007
@@ -1,8 +1,10 @@
-from pypy.rpython.lltypesystem import lltype, llmemory
+from pypy.rpython.lltypesystem import lltype, llmemory, lloperation
from pypy.rpython.annlowlevel import cast_base_ptr_to_instance
from pypy.rpython.annlowlevel import cast_instance_to_base_ptr
from pypy.rlib.unroll import unrolling_iterable
+debug_print = lloperation.llop.debug_print
+
def define_touch_update(TOPPTR, fielddescs, access_touched):
fielddescs = unrolling_iterable(fielddescs)
@@ -12,6 +14,7 @@
vable_rti = cast_base_ptr_to_instance(VirtualizableRTI, vable_rti)
vable_rti.touch(struc.vable_base)
+ #debug_print(lltype.Void, "TOUCH UPDATE")
j = 0
for fielddesc, _ in fielddescs:
if fielddesc.canbevirtual and fielddesc.gcref:
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 Fri Jan 26 03:12:33 2007
@@ -696,7 +696,7 @@
assert res == 42
def test_setting_in_residual_call(self):
- py.test.skip('Tempararily out of service')
+
def g(xy):
x = xy_get_x(xy)
y = xy_get_y(xy)
More information about the Pypy-commit
mailing list