[pypy-svn] r70953 - pypy/branch/gc-huge-list/pypy/rpython/memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Thu Jan 28 15:45:31 CET 2010


Author: arigo
Date: Thu Jan 28 15:45:31 2010
New Revision: 70953

Modified:
   pypy/branch/gc-huge-list/pypy/rpython/memory/gctransform/framework.py
Log:
(arigo, fijal)
Finish to fix the gctransformer.


Modified: pypy/branch/gc-huge-list/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/gc-huge-list/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/branch/gc-huge-list/pypy/rpython/memory/gctransform/framework.py	Thu Jan 28 15:45:31 2010
@@ -927,7 +927,25 @@
                 v_offset = hop.genop('int_add', [c_itemsofs, v_1],
                                      resulttype = lltype.Signed)
             elif opname == 'setinteriorfield':
-                XXXX #fun fun fun
+                v_offset = None
+                for v_ofs in hop.spaceop.args[1:-1]:
+                    if v_ofs.concretetype is lltype.Void:    # 'fieldname'
+                        name = v_ofs.value
+                        v_nextofs = rmodel.inputconst(lltype.Signed,
+                                                      llmemory.offsetof(TP, name))
+                        TP = getattr(TP, name)
+                    else:  # array index
+                        c_itemsize = rmodel.inputconst(lltype.Signed,
+                                                       llmemory.sizeof(TP.OF))
+                        v_nextofs = hop.genop('int_mul', [v_ofs, c_itemsize],
+                                              resulttype = lltype.Signed)
+                        TP = TP.OF
+                    if v_offset is None:
+                        v_offset = v_nextofs
+                    else:
+                        v_offset = hop.genop('int_add', [v_offset, v_nextofs],
+                                             resulttype = lltype.Signed)
+                assert v_offset is not None
             else:
                 assert 0, "bad opname: %r" % (opname,)
             v_newvalue = hop.genop("cast_ptr_to_adr", [v_newvalue],



More information about the Pypy-commit mailing list