[pypy-svn] r55064 - in pypy/dist/pypy/rpython: lltypesystem lltypesystem/test memory/gc

arigo at codespeak.net arigo at codespeak.net
Wed May 21 15:40:20 CEST 2008


Author: arigo
Date: Wed May 21 15:40:19 2008
New Revision: 55064

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rffi.py
   pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py
   pypy/dist/pypy/rpython/memory/gc/generation.py
Log:
Test and fix for a missing annenforceargs.
That's the proper fix for the NonConstant hack.


Modified: pypy/dist/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rffi.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rffi.py	Wed May 21 15:40:19 2008
@@ -456,6 +456,7 @@
         array[i] = s[i]
     array[len(s)] = '\x00'
     return array
+str2charp._annenforceargs_ = [str]
 
 def free_charp(cp):
     lltype.free(cp, flavor='raw')

Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py	Wed May 21 15:40:19 2008
@@ -674,3 +674,19 @@
 
     def test_hashdefine(self):
         py.test.skip("Macros cannot be called as llexternals by design, rffi does not have any special support for them")
+
+
+def test_enforced_args():
+    from pypy.annotation.model import s_None
+    from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
+    from pypy.translator.interactive import Translation
+    def f1():
+        str2charp("hello")
+    def f2():
+        str2charp("world")
+    t = Translation(f1, [])
+    t.rtype()
+    mixann = MixLevelHelperAnnotator(t.context.rtyper)
+    mixann.getgraph(f2, [], s_None)
+    mixann.finish()
+

Modified: pypy/dist/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gc/generation.py	(original)
+++ pypy/dist/pypy/rpython/memory/gc/generation.py	Wed May 21 15:40:19 2008
@@ -8,7 +8,6 @@
 from pypy.rlib.objectmodel import free_non_gc_object
 from pypy.rlib.debug import ll_assert
 from pypy.rpython.lltypesystem.lloperation import llop
-from pypy.rlib.nonconst import NonConstant
 
 # The following flag is never set on young objects, i.e. the ones living
 # in the nursery.  It is initially set on all prebuilt and old objects,
@@ -653,7 +652,7 @@
                 l2cache_p[0] = rffi.cast(rffi.LONGLONG, 0)
                 len_p[0] = rffi.cast(rffi.SIZE_T, size)
                 # XXX a hack for llhelper not being robust-enough
-                result = sysctlbyname(NonConstant("hw.l2cachesize"),
+                result = sysctlbyname("hw.l2cachesize",
                                       rffi.cast(rffi.VOIDP, l2cache_p),
                                       len_p,
                                       lltype.nullptr(rffi.VOIDP.TO), 



More information about the Pypy-commit mailing list