Author: Armin Rigo <ar...@tunes.org> Branch: improve-gc-tracing-hooks Changeset: r74033:3185de65abe8 Date: 2014-10-21 14:34 +0200 http://bitbucket.org/pypy/pypy/changeset/3185de65abe8/
Log: fix this test diff --git a/rpython/translator/c/test/test_newgc.py b/rpython/translator/c/test/test_newgc.py --- a/rpython/translator/c/test/test_newgc.py +++ b/rpython/translator/c/test/test_newgc.py @@ -443,19 +443,15 @@ def define_custom_trace(cls): from rpython.rtyper.annlowlevel import llhelper # - S = lltype.GcStruct('S', ('x', llmemory.Address), rtti=True) + S = lltype.GcStruct('S', ('x', llmemory.Address)) offset_of_x = llmemory.offsetof(S, 'x') - def customtrace(obj, prev): - if not prev: - return obj + offset_of_x - else: - return llmemory.NULL - CUSTOMTRACEFUNC = lltype.FuncType([llmemory.Address, llmemory.Address], - llmemory.Address) - customtraceptr = llhelper(lltype.Ptr(CUSTOMTRACEFUNC), customtrace) - lltype.attachRuntimeTypeInfo(S, customtraceptr=customtraceptr) + def customtrace(gc, obj, callback, arg): + if gc.is_valid_gc_object((obj + offset_of_x).address[0]): + callback(obj + offset_of_x, arg) + lambda_customtrace = lambda: customtrace # def setup(): + rgc.register_custom_trace_hook(S, lambda_customtrace) s = lltype.nullptr(S) for i in range(10000): t = lltype.malloc(S) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit