[pypy-svn] r77378 - in pypy/branch/jit-str/pypy/rpython: . lltypesystem

arigo at codespeak.net arigo at codespeak.net
Sun Sep 26 14:02:30 CEST 2010


Author: arigo
Date: Sun Sep 26 14:02:28 2010
New Revision: 77378

Modified:
   pypy/branch/jit-str/pypy/rpython/annlowlevel.py
   pypy/branch/jit-str/pypy/rpython/lltypesystem/rstr.py
Log:
Forgot these changes, necessary to link to the new code.


Modified: pypy/branch/jit-str/pypy/rpython/annlowlevel.py
==============================================================================
--- pypy/branch/jit-str/pypy/rpython/annlowlevel.py	(original)
+++ pypy/branch/jit-str/pypy/rpython/annlowlevel.py	Sun Sep 26 14:02:28 2010
@@ -397,6 +397,8 @@
     assert strtype in (str, unicode)
 
     def hlstr(ll_s):
+        if not ll_s:
+            return None
         if hasattr(ll_s, 'chars'):
             if strtype is str:
                 return ''.join(ll_s.chars)
@@ -423,9 +425,14 @@
 
     def llstr(s):
         from pypy.rpython.lltypesystem.rstr import mallocstr, mallocunicode
+        from pypy.rpython.lltypesystem.rstr import STR, UNICODE
         if strtype is str:
+            if s is None:
+                return lltype.nullptr(STR)
             ll_s = mallocstr(len(s))
         else:
+            if s is None:
+                return lltype.nullptr(UNICODE)
             ll_s = mallocunicode(len(s))
         for i, c in enumerate(s):
             ll_s.chars[i] = c

Modified: pypy/branch/jit-str/pypy/rpython/lltypesystem/rstr.py
==============================================================================
--- pypy/branch/jit-str/pypy/rpython/lltypesystem/rstr.py	(original)
+++ pypy/branch/jit-str/pypy/rpython/lltypesystem/rstr.py	Sun Sep 26 14:02:28 2010
@@ -318,6 +318,7 @@
     def ll_strfasthash(s):
         return s.hash     # assumes that the hash is already computed
 
+    @purefunction
     def ll_strconcat(s1, s2):
         len1 = len(s1.chars)
         len2 = len(s2.chars)
@@ -443,8 +444,8 @@
             if chars1[j] != chars2[j]:
                 return False
             j += 1
-
         return True
+    ll_streq.oopspec = 'stroruni.equal(s1, s2)'
 
     @purefunction
     def ll_startswith(s1, s2):
@@ -693,6 +694,7 @@
             i += 1
         return result
 
+    @purefunction
     def _ll_stringslice(s1, start, stop):
         newstr = s1.malloc(stop - start)
         assert start >= 0



More information about the Pypy-commit mailing list