[pypy-svn] pypy default: Move this hack into an official interface.

arigo commits-noreply at bitbucket.org
Sat Mar 26 17:05:32 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r42974:688735e962a3
Date: 2011-03-26 15:17 +0100
http://bitbucket.org/pypy/pypy/changeset/688735e962a3/

Log:	Move this hack into an official interface.

diff --git a/pypy/rpython/lltypesystem/rffi.py b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -305,6 +305,14 @@
 stackcounter = StackCounter()
 stackcounter._freeze_()
 
+def llexternal_use_eci(compilation_info):
+    """Return a dummy function that, if called in a RPython program,
+    adds the given ExternalCompilationInfo to it."""
+    eci = ExternalCompilationInfo(post_include_bits=['#define PYPY_NO_OP()'])
+    eci = eci.merge(compilation_info)
+    return llexternal('PYPY_NO_OP', [], lltype.Void,
+                      compilation_info=eci, sandboxsafe=True, _nowrapper=True)
+
 # ____________________________________________________________
 # Few helpers for keeping callback arguments alive
 # this makes passing opaque objects possible (they don't even pass

diff --git a/pypy/jit/backend/x86/support.py b/pypy/jit/backend/x86/support.py
--- a/pypy/jit/backend/x86/support.py
+++ b/pypy/jit/backend/x86/support.py
@@ -38,11 +38,7 @@
 if sys.platform == 'win32':
     ensure_sse2_floats = lambda : None
 else:
-    _sse2_eci = ExternalCompilationInfo(
+    ensure_sse2_floats = rffi.llexternal_use_eci(ExternalCompilationInfo(
         compile_extra = ['-msse2', '-mfpmath=sse',
                          '-DPYPY_CPU_HAS_STANDARD_PRECISION'],
-        separate_module_sources = ['void PYPY_NO_OP(void) {}'],
-        )
-    ensure_sse2_floats = rffi.llexternal('PYPY_NO_OP', [], lltype.Void,
-                                         compilation_info=_sse2_eci,
-                                         sandboxsafe=True)
+        ))


More information about the Pypy-commit mailing list