[pypy-svn] r54990 - in pypy/branch/hybrid-io/pypy/rpython/memory: . gc gc/test gctransform

arigo at codespeak.net arigo at codespeak.net
Tue May 20 13:10:45 CEST 2008


Author: arigo
Date: Tue May 20 13:10:44 2008
New Revision: 54990

Modified:
   pypy/branch/hybrid-io/pypy/rpython/memory/gc/base.py
   pypy/branch/hybrid-io/pypy/rpython/memory/gc/generation.py
   pypy/branch/hybrid-io/pypy/rpython/memory/gc/test/test_direct.py
   pypy/branch/hybrid-io/pypy/rpython/memory/gctransform/framework.py
   pypy/branch/hybrid-io/pypy/rpython/memory/gcwrapper.py
Log:
In-progress.  Remove the "oldvalue" argument to write_barrier().
It's not used and it's annoying for the realloc operation.


Modified: pypy/branch/hybrid-io/pypy/rpython/memory/gc/base.py
==============================================================================
--- pypy/branch/hybrid-io/pypy/rpython/memory/gc/base.py	(original)
+++ pypy/branch/hybrid-io/pypy/rpython/memory/gc/base.py	Tue May 20 13:10:44 2008
@@ -42,7 +42,7 @@
     def set_root_walker(self, root_walker):
         self.root_walker = root_walker
 
-    def write_barrier(self, oldvalue, newvalue, addr_struct):
+    def write_barrier(self, newvalue, addr_struct):
         pass
 
     def setup(self):

Modified: pypy/branch/hybrid-io/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/branch/hybrid-io/pypy/rpython/memory/gc/generation.py	(original)
+++ pypy/branch/hybrid-io/pypy/rpython/memory/gc/generation.py	Tue May 20 13:10:44 2008
@@ -408,7 +408,7 @@
                     continue    # no need to remember this weakref any longer
             self.objects_with_weakrefs.append(obj)
 
-    def write_barrier(self, oldvalue, newvalue, addr_struct):
+    def write_barrier(self, newvalue, addr_struct):
         if self.header(addr_struct).tid & GCFLAG_NO_YOUNG_PTRS:
             self.remember_young_pointer(addr_struct, newvalue)
 

Modified: pypy/branch/hybrid-io/pypy/rpython/memory/gc/test/test_direct.py
==============================================================================
--- pypy/branch/hybrid-io/pypy/rpython/memory/gc/test/test_direct.py	(original)
+++ pypy/branch/hybrid-io/pypy/rpython/memory/gc/test/test_direct.py	Tue May 20 13:10:44 2008
@@ -78,18 +78,16 @@
 
     def write(self, p, fieldname, newvalue):
         if self.gc.needs_write_barrier:
-            oldaddr = llmemory.cast_ptr_to_adr(getattr(p, fieldname))
             newaddr = llmemory.cast_ptr_to_adr(newvalue)
             addr_struct = llmemory.cast_ptr_to_adr(p)
-            self.gc.write_barrier(oldaddr, newaddr, addr_struct)
+            self.gc.write_barrier(newaddr, addr_struct)
         setattr(p, fieldname, newvalue)
 
     def writearray(self, p, index, newvalue):
         if self.gc.needs_write_barrier:
-            oldaddr = llmemory.cast_ptr_to_adr(p[index])
             newaddr = llmemory.cast_ptr_to_adr(newvalue)
             addr_struct = llmemory.cast_ptr_to_adr(p)
-            self.gc.write_barrier(oldaddr, newaddr, addr_struct)
+            self.gc.write_barrier(newaddr, addr_struct)
         p[index] = newvalue
 
     def malloc(self, TYPE, n=None):

Modified: pypy/branch/hybrid-io/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/hybrid-io/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/branch/hybrid-io/pypy/rpython/memory/gctransform/framework.py	Tue May 20 13:10:44 2008
@@ -318,7 +318,7 @@
 
         if GCClass.needs_write_barrier:
             self.write_barrier_ptr = getfn(GCClass.write_barrier.im_func,
-                                           [s_gc, annmodel.SomeAddress(),
+                                           [s_gc,
                                             annmodel.SomeAddress(),
                                             annmodel.SomeAddress()],
                                            annmodel.s_None,
@@ -536,6 +536,7 @@
                         c_itemsize, c_lengthofs, c_grow):
         vlist = [self.realloc_ptr, self.c_const_gc, v_ptr, v_newsize,
                  c_const_size, c_itemsize, c_lengthofs, c_grow]
+        # XXX don't really need push_roots in all cases
         livevars = self.push_roots(hop)
         v_result = hop.genop('direct_call', vlist,
                              resulttype=llmemory.GCREF)
@@ -672,18 +673,12 @@
             and v_struct.concretetype.TO._gckind == "gc"
             and hop.spaceop not in self.initializing_stores):
             self.write_barrier_calls += 1
-            v_oldvalue = hop.genop('g' + opname[1:],
-                                   hop.inputargs()[:-1],
-                                   resulttype=v_newvalue.concretetype)
-            v_oldvalue = hop.genop("cast_ptr_to_adr", [v_oldvalue],
-                                   resulttype = llmemory.Address)
             v_newvalue = hop.genop("cast_ptr_to_adr", [v_newvalue],
                                    resulttype = llmemory.Address)
             v_structaddr = hop.genop("cast_ptr_to_adr", [v_struct],
                                      resulttype = llmemory.Address)
             hop.genop("direct_call", [self.write_barrier_ptr,
                                       self.c_const_gc,
-                                      v_oldvalue,
                                       v_newvalue,
                                       v_structaddr])
         hop.rename('bare_' + opname)

Modified: pypy/branch/hybrid-io/pypy/rpython/memory/gcwrapper.py
==============================================================================
--- pypy/branch/hybrid-io/pypy/rpython/memory/gcwrapper.py	(original)
+++ pypy/branch/hybrid-io/pypy/rpython/memory/gcwrapper.py	Tue May 20 13:10:44 2008
@@ -95,9 +95,7 @@
     def setinterior(self, toplevelcontainer, inneraddr, INNERTYPE, newvalue):
         if (lltype.typeOf(toplevelcontainer).TO._gckind == 'gc' and
             isinstance(INNERTYPE, lltype.Ptr) and INNERTYPE.TO._gckind == 'gc'):
-            oldvalue = inneraddr.address[0]
-            self.gc.write_barrier(oldvalue,
-                                  llmemory.cast_ptr_to_adr(newvalue),
+            self.gc.write_barrier(llmemory.cast_ptr_to_adr(newvalue),
                                   llmemory.cast_ptr_to_adr(toplevelcontainer))
         llheap.setinterior(toplevelcontainer, inneraddr, INNERTYPE, newvalue)
 



More information about the Pypy-commit mailing list