[pypy-svn] r49842 - pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Sun Dec 16 16:34:25 CET 2007


Author: arigo
Date: Sun Dec 16 16:34:24 2007
New Revision: 49842

Modified:
   pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/framework.py
Log:
Avoid taking the address of element "-1" of the array - not sure how fakeaddresses handle that.
Instead, backwards iteration is done by having 'current' point not at the next element to
return, but just after it, as usual.


Modified: pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/framework.py	Sun Dec 16 16:34:24 2007
@@ -378,16 +378,16 @@
             def __init__(self, with_static=True):
                 self.stack_current = gcdata.root_stack_top
                 if with_static:
-                    self.static_current = gcdata.static_root_end - sizeofaddr
+                    self.static_current = gcdata.static_root_end
                 else:
-                    self.static_current = gcdata.static_root_nongcend - sizeofaddr
+                    self.static_current = gcdata.static_root_nongcend
 
             def pop(self):
                 while self.static_current != gcdata.static_root_start:
-                    result = self.static_current
                     self.static_current -= sizeofaddr
-                    if result.address[0].address[0] != llmemory.NULL:
-                        return result.address[0]
+                    result = self.static_current.address[0]
+                    if result.address[0] != llmemory.NULL:
+                        return result
                 while self.stack_current != gcdata.root_stack_base:
                     self.stack_current -= sizeofaddr
                     if self.stack_current.address[0] != llmemory.NULL:
@@ -451,7 +451,7 @@
                                                immortal=True)
         for i in range(len(addresses_of_static_ptrs)):
             ll_static_roots_inside[i] = addresses_of_static_ptrs[i]
-        ll_instance.inst_static_root_start = llmemory.cast_ptr_to_adr(ll_static_roots_inside) + llmemory.ArrayItemsOffset(lltype.Array(llmemory.Address)) + llmemory.sizeof(llmemory.Address) * (-1)
+        ll_instance.inst_static_root_start = llmemory.cast_ptr_to_adr(ll_static_roots_inside) + llmemory.ArrayItemsOffset(lltype.Array(llmemory.Address))
         ll_instance.inst_static_root_nongcend = ll_instance.inst_static_root_start + llmemory.sizeof(llmemory.Address) * len(self.layoutbuilder.addresses_of_static_ptrs_in_nongc)
         ll_instance.inst_static_root_end = ll_instance.inst_static_root_start + llmemory.sizeof(llmemory.Address) * len(addresses_of_static_ptrs)
 



More information about the Pypy-commit mailing list