Beispiel #1
0
    def possibly_check_for_boehm(self):
        if self.config.translation.gc == "boehm":
            from pypy.rpython.tool.rffi_platform import check_boehm

            if not check_boehm(self.translator.platform):
                i = 'Boehm GC not installed.  Try e.g. "translate.py --gc=hybrid"'
                raise Exception(i)
Beispiel #2
0
 def setup_class(cls):
     import py
     if cls.gcpolicy in (None, "ref"):
         import py
         py.test.skip(
             "stackless + refcounting doesn't work any more for now")
     elif cls.gcpolicy == "boehm":
         from pypy.rpython.tool.rffi_platform import check_boehm
         if not check_boehm():
             py.test.skip("Boehm GC not present")
    def setup_class(cls):
        import py

        if cls.gcpolicy in (None, "ref"):
            import py

            py.test.skip("stackless + refcounting doesn't work any more for now")
        elif cls.gcpolicy == "boehm":
            from pypy.rpython.tool.rffi_platform import check_boehm

            if not check_boehm():
                py.test.skip("Boehm GC not present")
Beispiel #4
0
    def compilation_info(self):
        eci = BasicGcPolicy.compilation_info(self)

        from pypy.rpython.tool.rffi_platform import check_boehm
        eci = eci.merge(check_boehm())

        pre_include_bits = []
        if sys.platform == "linux2":
            pre_include_bits += ["#define _REENTRANT 1",
                                 "#define GC_LINUX_THREADS 1"]
        if sys.platform != "win32":
            # GC_REDIRECT_TO_LOCAL is not supported on Win32 by gc6.8
            pre_include_bits += ["#define GC_REDIRECT_TO_LOCAL 1"]

        eci = eci.merge(ExternalCompilationInfo(
            pre_include_bits=pre_include_bits,
            post_include_bits=['#define USING_BOEHM_GC'],
            ))

        return eci
Beispiel #5
0
    def __init__(self, gcdescr, translator):
        GcLLDescription.__init__(self, gcdescr, translator)
        # grab a pointer to the Boehm 'malloc' function
        from pypy.rpython.tool import rffi_platform
        compilation_info = rffi_platform.check_boehm()

        # Versions 6.x of libgc needs to use GC_local_malloc().
        # Versions 7.x of libgc removed this function; GC_malloc() has
        # the same behavior if libgc was compiled with
        # THREAD_LOCAL_ALLOC.
        class CConfig:
            _compilation_info_ = compilation_info
            HAS_LOCAL_MALLOC = rffi_platform.Has("GC_local_malloc")

        config = rffi_platform.configure(CConfig)
        if config['HAS_LOCAL_MALLOC']:
            GC_MALLOC = "GC_local_malloc"
        else:
            GC_MALLOC = "GC_malloc"

        malloc_fn_ptr = rffi.llexternal(
            GC_MALLOC,
            [lltype.Signed],  # size_t, but good enough
            llmemory.GCREF,
            compilation_info=compilation_info,
            sandboxsafe=True,
            _nowrapper=True)
        self.funcptr_for_new = malloc_fn_ptr

        # on some platform GC_init is required before any other
        # GC_* functions, call it here for the benefit of tests
        # XXX move this to tests
        init_fn_ptr = rffi.llexternal("GC_init", [],
                                      lltype.Void,
                                      compilation_info=compilation_info,
                                      sandboxsafe=True,
                                      _nowrapper=True)

        init_fn_ptr()
Beispiel #6
0
    def compilation_info(self):
        eci = BasicGcPolicy.compilation_info(self)

        from pypy.rpython.tool.rffi_platform import check_boehm
        eci = eci.merge(check_boehm())

        pre_include_bits = []
        if sys.platform == "linux2":
            pre_include_bits += [
                "#define _REENTRANT 1", "#define GC_LINUX_THREADS 1"
            ]
        if sys.platform != "win32":
            # GC_REDIRECT_TO_LOCAL is not supported on Win32 by gc6.8
            pre_include_bits += ["#define GC_REDIRECT_TO_LOCAL 1"]

        eci = eci.merge(
            ExternalCompilationInfo(
                pre_include_bits=pre_include_bits,
                post_include_bits=['#define USING_BOEHM_GC'],
            ))

        return eci
Beispiel #7
0
    def __init__(self, gcdescr, translator):
        GcLLDescription.__init__(self, gcdescr, translator)
        # grab a pointer to the Boehm 'malloc' function
        from pypy.rpython.tool import rffi_platform
        compilation_info = rffi_platform.check_boehm()

        # Versions 6.x of libgc needs to use GC_local_malloc().
        # Versions 7.x of libgc removed this function; GC_malloc() has
        # the same behavior if libgc was compiled with
        # THREAD_LOCAL_ALLOC.
        class CConfig:
            _compilation_info_ = compilation_info
            HAS_LOCAL_MALLOC = rffi_platform.Has("GC_local_malloc")
        config = rffi_platform.configure(CConfig)
        if config['HAS_LOCAL_MALLOC']:
            GC_MALLOC = "GC_local_malloc"
        else:
            GC_MALLOC = "GC_malloc"

        malloc_fn_ptr = rffi.llexternal(GC_MALLOC,
                                        [lltype.Signed], # size_t, but good enough
                                        llmemory.GCREF,
                                        compilation_info=compilation_info,
                                        sandboxsafe=True,
                                        _nowrapper=True)
        self.funcptr_for_new = malloc_fn_ptr

        # on some platform GC_init is required before any other
        # GC_* functions, call it here for the benefit of tests
        # XXX move this to tests
        init_fn_ptr = rffi.llexternal("GC_init",
                                      [], lltype.Void,
                                      compilation_info=compilation_info,
                                      sandboxsafe=True,
                                      _nowrapper=True)

        init_fn_ptr()
Beispiel #8
0
def setup_module(mod):
    if not check_boehm():
        py.test.skip("Boehm GC not present")
Beispiel #9
0
 def possibly_check_for_boehm(self):
     if self.config.translation.gc == "boehm":
         from pypy.rpython.tool.rffi_platform import check_boehm
         if not check_boehm(self.translator.platform):
             i = 'Boehm GC not installed.  Try e.g. "translate.py --gc=hybrid"'
             raise Exception(i)
Beispiel #10
0
def setup_module(mod):
    if not check_boehm():
        py.test.skip("Boehm GC not present")