[pypy-commit] pypy stmgc-c4: stmcb_trace().
arigo
noreply at buildbot.pypy.org
Sat Jun 29 23:10:40 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c4
Changeset: r65110:c6848441ba04
Date: 2013-06-29 23:10 +0200
http://bitbucket.org/pypy/pypy/changeset/c6848441ba04/
Log: stmcb_trace().
diff --git a/rpython/memory/gc/stmgc.py b/rpython/memory/gc/stmgc.py
--- a/rpython/memory/gc/stmgc.py
+++ b/rpython/memory/gc/stmgc.py
@@ -21,6 +21,8 @@
HDR = rffi.COpaque('struct stm_object_s')
typeid_is_in_field = None
+ VISIT_FPTR = lltype.Ptr(lltype.FuncType([llmemory.Address], lltype.Void))
+
TRANSLATION_PARAMS = {}
def get_type_id(self, obj):
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
@@ -17,6 +17,16 @@
self.autoregister_ptrs.append(
getfn(pypy_stmcb_size, [annmodel.SomeAddress()],
annmodel.SomeInteger()))
+ #
+ def invokecallback(root, visit_fn):
+ visit_fn(root)
+ def pypy_stmcb_trace(obj, visit_fn):
+ gc.trace(obj, invokecallback, visit_fn)
+ pypy_stmcb_trace.c_name = "pypy_stmcb_trace"
+ self.autoregister_ptrs.append(
+ getfn(pypy_stmcb_trace, [annmodel.SomeAddress(),
+ annmodel.SomePtr(GCClass.VISIT_FPTR)],
+ annmodel.s_None))
def build_root_walker(self):
return StmRootWalker(self)
diff --git a/rpython/translator/stm/stmgcintf.py b/rpython/translator/stm/stmgcintf.py
--- a/rpython/translator/stm/stmgcintf.py
+++ b/rpython/translator/stm/stmgcintf.py
@@ -9,11 +9,16 @@
#include "src_stm/stmgc.h"
extern Signed pypy_stmcb_size(void*);
+extern void pypy_stmcb_trace(void*, void(*)(void*));
inline size_t stmcb_size(gcptr obj) {
return pypy_stmcb_size(obj);
}
+inline void stmcb_trace(gcptr obj, void visit(gcptr *)) {
+ pypy_stmcb_trace(obj, (void(*)(void*))visit);
+}
+
#include "src_stm/stmgc.c"
'''
More information about the pypy-commit
mailing list