[pypy-commit] pypy default: Issue #2438: Deprecate 'calling_conv', because it's too easy to get

arigo pypy.commits at gmail.com
Sun Nov 27 19:44:51 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r88689:cb398f434016
Date: 2016-11-28 00:52 +0100
http://bitbucket.org/pypy/pypy/changeset/cb398f434016/

Log:	Issue #2438: Deprecate 'calling_conv', because it's too easy to get
	wrong (e.g. in QueryPerformanceCounter) and it's usually not fatal
	expect in the JIT after a lot of assembly-level debugging in visual
	studio.

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
@@ -7,7 +7,7 @@
 from rpython.rtyper.lltypesystem.llmemory import itemoffsetof
 from rpython.rtyper.llannotation import lltype_to_annotation
 from rpython.tool.sourcetools import func_with_new_name
-from rpython.rlib.objectmodel import Symbolic
+from rpython.rlib.objectmodel import Symbolic, specialize
 from rpython.rlib.objectmodel import keepalive_until_here, enforceargs
 from rpython.rlib import rarithmetic, rgc
 from rpython.rtyper.extregistry import ExtRegistryEntry
@@ -96,6 +96,9 @@
                 we consider that the function is really short-running and
                 don't bother releasing the GIL.  An explicit True or False
                 overrides this logic.
+
+    calling_conv: deprecated, because it's hard to get it right 100% of the
+                  time.  Nowadays it is ignored except for tests.
     """
     if _callable is not None:
         assert callable(_callable)
@@ -314,10 +317,6 @@
     # for debugging, stick ll func ptr to that
     wrapper._ptr = funcptr
     wrapper = func_with_new_name(wrapper, name)
-
-    if calling_conv != "c":
-        wrapper = jit.dont_look_inside(wrapper)
-
     return wrapper
 
 
@@ -1291,13 +1290,23 @@
 
 # You would have to have a *huge* amount of data for this to block long enough
 # to be worth it to release the GIL.
-c_memcpy = llexternal("memcpy",
+_c_memcpy = llexternal("memcpy",
             [VOIDP, VOIDP, SIZE_T],
             lltype.Void,
-            releasegil=False
+            releasegil=False,
+            _nowrapper=True
         )
-c_memset = llexternal("memset",
+_c_memset = llexternal("memset",
             [VOIDP, lltype.Signed, SIZE_T],
             lltype.Void,
-            releasegil=False
+            releasegil=False,
+            _nowrapper=True
         )
+
+ at specialize.ll()
+def c_memcpy(dst, src, size):
+    _c_memcpy(cast(VOIDP, dst), cast(VOIDP, src), cast(SIZE_T, size))
+
+ at specialize.ll()
+def c_memset(s, c, n):
+    _c_memset(cast(VOIDP, s), cast(lltype.Signed, c), cast(SIZE_T, n))


More information about the pypy-commit mailing list