Exemple #1
0
 def setup_class(cls):
     space = cls.space
     cls.w_iswin32 = space.wrap(sys.platform == 'win32')
     cls.w_libfoo_name = space.wrap(cls.prepare_c_example())
     cls.w_libc_name = space.wrap(get_libc_name())
     libm_name = get_libm_name(sys.platform)
     cls.w_libm_name = space.wrap(libm_name)
     libm = CDLL(libm_name)
     pow = libm.getpointer('pow', [], types.void)
     pow_addr = rffi.cast(rffi.LONG, pow.funcsym)
     cls._libm = libm  # otherwise it gets unloaded - argh!
     cls.w_pow_addr = space.wrap(pow_addr)
Exemple #2
0
 def setup_class(cls):
     space = cls.space
     cls.w_iswin32 = space.wrap(sys.platform == 'win32')
     cls.w_libfoo_name = space.wrap(cls.prepare_c_example())
     cls.w_libc_name = space.wrap(get_libc_name())
     libm_name = get_libm_name(sys.platform)
     cls.w_libm_name = space.wrap(libm_name)
     libm = CDLL(libm_name)
     pow = libm.getpointer('pow', [], types.void)
     pow_addr = rffi.cast(rffi.LONG, pow.funcsym)
     cls._libm = libm     # otherwise it gets unloaded - argh!
     cls.w_pow_addr = space.wrap(pow_addr)
Exemple #3
0
 def libffi_stuff(i, j):
     lib = CDLL(libm_name)
     func = lib.getpointer("fabs", [types.double], types.double)
     res = 0.0
     x = float(j)
     while i > 0:
         jitdriver2.jit_merge_point(i=i, res=res, func=func, x=x)
         promote(func)
         argchain = ArgChain()
         argchain.arg(x)
         res = func.call(argchain, rffi.DOUBLE)
         i -= 1
     return res
Exemple #4
0
 def libffi_stuff(i, j):
     lib = CDLL(libm_name)
     func = lib.getpointer('fabs', [types.double], types.double)
     res = 0.0
     x = float(j)
     v2 = Virt2(i)
     while v2.i > 0:
         jitdriver2.jit_merge_point(v2=v2, res=res, func=func, x=x)
         promote(func)
         argchain = ArgChain()
         argchain.arg(x)
         res = func.call(argchain, rffi.DOUBLE)
         v2.i -= 1
     return res