[pypy-svn] r78034 - in pypy/branch/jitffi/pypy/jit/codewriter: . test

antocuni at codespeak.net antocuni at codespeak.net
Mon Oct 18 11:27:55 CEST 2010


Author: antocuni
Date: Mon Oct 18 11:27:54 2010
New Revision: 78034

Modified:
   pypy/branch/jitffi/pypy/jit/codewriter/effectinfo.py
   pypy/branch/jitffi/pypy/jit/codewriter/test/test_effectinfo.py
Log:
add a test to check that we don't have any duplicate in EffectInfo.OS_*. Also, move libffi stuff at the bottom


Modified: pypy/branch/jitffi/pypy/jit/codewriter/effectinfo.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/codewriter/effectinfo.py	(original)
+++ pypy/branch/jitffi/pypy/jit/codewriter/effectinfo.py	Mon Oct 18 11:27:54 2010
@@ -19,10 +19,7 @@
     OS_NONE                     = 0    # normal case, no oopspec
     OS_ARRAYCOPY                = 1    # "list.ll_arraycopy"
     OS_STR2UNICODE              = 2    # "str.str2unicode"
-    OS_LIBFFI_PREPARE           = 15
-    OS_LIBFFI_PUSH_ARG          = 16
-    OS_LIBFFI_CALL              = 17
-
+    #
     OS_STR_CONCAT               = 22   # "stroruni.concat"
     OS_STR_SLICE                = 23   # "stroruni.slice"
     OS_STR_EQUAL                = 24   # "stroruni.equal"
@@ -33,7 +30,7 @@
     OS_STREQ_NONNULL_CHAR       = 29   # s1 == char  (assert s1!=NULL)
     OS_STREQ_CHECKNULL_CHAR     = 30   # s1!=NULL and s1==char
     OS_STREQ_LENGTHOK           = 31   # s1 == s2    (assert len(s1)==len(s2))
-
+    #
     OS_UNI_CONCAT               = 42   #
     OS_UNI_SLICE                = 43   #
     OS_UNI_EQUAL                = 44   #
@@ -45,6 +42,10 @@
     OS_UNIEQ_CHECKNULL_CHAR     = 50   #   STR, in the same order)
     OS_UNIEQ_LENGTHOK           = 51   #
     _OS_offset_uni              = OS_UNI_CONCAT - OS_STR_CONCAT
+    #
+    OS_LIBFFI_PREPARE           = 60
+    OS_LIBFFI_PUSH_ARG          = 61
+    OS_LIBFFI_CALL              = 62
 
     def __new__(cls, readonly_descrs_fields,
                 write_descrs_fields, write_descrs_arrays,

Modified: pypy/branch/jitffi/pypy/jit/codewriter/test/test_effectinfo.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/codewriter/test/test_effectinfo.py	(original)
+++ pypy/branch/jitffi/pypy/jit/codewriter/test/test_effectinfo.py	Mon Oct 18 11:27:54 2010
@@ -1,7 +1,8 @@
 from pypy.rpython.lltypesystem.rclass import OBJECT
 from pypy.rpython.lltypesystem import lltype
 from pypy.rpython.ootypesystem import ootype
-from pypy.jit.codewriter.effectinfo import effectinfo_from_writeanalyze
+from pypy.jit.codewriter.effectinfo import effectinfo_from_writeanalyze,\
+    EffectInfo
 
 class FakeCPU:
     def fielddescrof(self, T, fieldname):
@@ -9,6 +10,14 @@
     def arraydescrof(self, A):
         return ('arraydescr', A)
 
+def test_no_oopspec_duplicate():
+    # check that all the various EffectInfo.OS_* have unique values
+    oopspecs = set()
+    for name, value in EffectInfo.__dict__.iteritems():
+        if name.startswith('OS_'):
+            assert value not in oopspecs
+            oopspecs.add(value)
+
 def test_include_read_field():
     S = lltype.GcStruct("S", ("a", lltype.Signed))
     effects = frozenset([("readstruct", lltype.Ptr(S), "a")])



More information about the Pypy-commit mailing list