[pypy-commit] pypy stmgc-c7: Small attempt to speed-up tracing in the GC: force trace() to be inlined

arigo noreply at buildbot.pypy.org
Sat Feb 7 13:21:46 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r75752:f7205d08f1ba
Date: 2015-02-07 10:13 +0100
http://bitbucket.org/pypy/pypy/changeset/f7205d08f1ba/

Log:	Small attempt to speed-up tracing in the GC: force trace() to be
	inlined here.

diff --git a/rpython/memory/gc/base.py b/rpython/memory/gc/base.py
--- a/rpython/memory/gc/base.py
+++ b/rpython/memory/gc/base.py
@@ -1,5 +1,6 @@
 from rpython.rtyper.lltypesystem import lltype, llmemory, llarena, rffi
 from rpython.rtyper.lltypesystem.lloperation import llop
+from rpython.rlib.objectmodel import func_with_new_name
 from rpython.rlib.debug import ll_assert
 from rpython.memory.gcheader import GCHeaderBuilder
 from rpython.memory.support import DEFAULT_CHUNK_SIZE
@@ -217,6 +218,10 @@
             i += 1
     trace._annspecialcase_ = 'specialize:arg(2)'
 
+    tracei = func_with_new_name(trace, 'tracei')
+    tracei._annspecialcase_ = 'specialize:arg(2)'
+    tracei._always_inline_ = True
+
     def _trace_slow_path(self, obj, callback, arg):
         typeid = self.get_type_id(obj)
         if self.has_gcptr_in_varsize(typeid):
diff --git a/rpython/memory/gctransform/stmframework.py b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -55,7 +55,7 @@
                   annmodel.SomeInteger()))
         #
         def pypy_stmcb_trace(obj, visit_fn):
-            gc.trace(obj, invokecallback, visit_fn)
+            gc.tracei(obj, invokecallback, visit_fn)
         pypy_stmcb_trace.c_name = "pypy_stmcb_trace"
         self.autoregister_ptrs.append(
             getfn(pypy_stmcb_trace, [llannotation.SomeAddress(),


More information about the pypy-commit mailing list