[pypy-svn] r78039 - pypy/branch/jitffi/pypy/jit/backend/x86/test
antocuni at codespeak.net
antocuni at codespeak.net
Mon Oct 18 15:26:46 CEST 2010
Author: antocuni
Date: Mon Oct 18 15:26:45 2010
New Revision: 78039
Modified:
pypy/branch/jitffi/pypy/jit/backend/x86/test/test_zrpy_gc.py
Log:
a workaround for these failing tests, and a huge comment explaining it
Modified: pypy/branch/jitffi/pypy/jit/backend/x86/test/test_zrpy_gc.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/backend/x86/test/test_zrpy_gc.py (original)
+++ pypy/branch/jitffi/pypy/jit/backend/x86/test/test_zrpy_gc.py Mon Oct 18 15:26:45 2010
@@ -191,6 +191,32 @@
def run_orig(self, name, n, x):
self.main_allfuncs(name, n, x)
+ def define_libffi_workaround(cls):
+ # This is a workaround for a bug in database.py. It seems that the
+ # problem is triggered by optimizeopt/fficall.py, and in particular by
+ # the ``cast_base_ptr_to_instance(Func, llfunc)``: in these tests,
+ # that line is the only place where libffi.Func is referenced.
+ #
+ # The problem occurs because the gctransformer tries to annotate a
+ # low-level helper to call the __del__ of libffi.Func when it's too
+ # late.
+ #
+ # This workaround works by forcing the annotator (and all the rest of
+ # the toolchain) to see libffi.Func in a "proper" context, not just as
+ # the target of cast_base_ptr_to_instance. Note that the function
+ # below is *never* called by any actual test, it's just annotated.
+ #
+ from pypy.rlib.libffi import get_libc_name, CDLL, types, ArgChain
+ libc_name = get_libc_name()
+ def f(n, x, *args):
+ libc = CDLL(libc_name)
+ ptr = libc.getpointer('labs', [types.slong], types.slong)
+ chain = ArgChain()
+ chain.arg(n)
+ n = ptr.call(chain, lltype.Signed)
+ return (n, x) + args
+ return None, f, None
+
def define_compile_framework_1(cls):
# a moving GC. Supports malloc_varsize_nonmovable. Simple test, works
# without write_barriers and root stack enumeration.
More information about the Pypy-commit
mailing list