[pypy-commit] pypy default: Issue #2438: Windows: the QueryPerformanceCounter() function is a stdcall
arigo
pypy.commits at gmail.com
Sun Nov 27 17:48:22 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r88686:558458473028
Date: 2016-11-27 23:47 +0100
http://bitbucket.org/pypy/pypy/changeset/558458473028/
Log: Issue #2438: Windows: the QueryPerformanceCounter() function is a
stdcall function with releasegil=False and no save_err. So
rffi.llexternal() would not create any wrapper, and the JIT would
directly call it. But it can't do that: wrong calling convention!
diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -205,11 +205,17 @@
else:
# if we don't have to invoke the GIL handling, we can just call
# the low-level function pointer carelessly
- if macro is None and save_err == RFFI_ERR_NONE:
+ # ...well, unless it's a macro, in which case we still have
+ # to hide it from the JIT...
+ need_wrapper = (macro is not None or save_err != RFFI_ERR_NONE)
+ # XXX ...and unless we're on Windows, because the calling convention
+ # is unknown so far and thus the JIT can't assume it knows it...
+ if sys.platform == 'win32':
+ need_wrapper = True
+ #
+ if not need_wrapper:
call_external_function = funcptr
else:
- # ...well, unless it's a macro, in which case we still have
- # to hide it from the JIT...
argnames = ', '.join(['a%d' % i for i in range(len(args))])
source = py.code.Source("""
def call_external_function(%(argnames)s):
More information about the pypy-commit
mailing list