[pypy-svn] r24357 - in pypy/dist/pypy: rpython rpython/memory translator/c

mwh at codespeak.net mwh at codespeak.net
Tue Mar 14 12:56:10 CET 2006


Author: mwh
Date: Tue Mar 14 12:56:08 2006
New Revision: 24357

Modified:
   pypy/dist/pypy/rpython/memory/gctransform.py
   pypy/dist/pypy/rpython/rstr.py
   pypy/dist/pypy/translator/c/node.py
Log:
use a much much more explicit way to specialcase adding a byte to all strings
for the NULL.



Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py	Tue Mar 14 12:56:08 2006
@@ -9,7 +9,6 @@
 from pypy.rpython import rmodel, rptr, annlowlevel
 from pypy.rpython.memory import gc, lladdress
 from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
-from pypy.rpython.rstr import STR
 import sets, os
 
 EXCEPTION_RAISING_OPS = ['direct_call', 'indirect_call']
@@ -828,7 +827,7 @@
                         info["ofstovar"] = ofs1 + llmemory.itemoffsetof(ARRAY, 0)
                     else:
                         info["fixedsize"] = ofs1 + llmemory.sizeof(lltype.Signed)
-                    if TYPE is STR:
+                    if ARRAY._hints.get('isrpystring'):
                         info["fixedsize"] = llmemory.sizeof(TYPE, 1)
                 else:
                     ARRAY = TYPE

Modified: pypy/dist/pypy/rpython/rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/rstr.py	(original)
+++ pypy/dist/pypy/rpython/rstr.py	Tue Mar 14 12:56:08 2006
@@ -26,7 +26,8 @@
 #    }
 
 STR = GcStruct('rpy_string', ('hash',  Signed),
-                             ('chars', Array(Char, hints={'immutable': True})))
+                             ('chars', Array(Char, hints={'immutable': True,
+                                                          'isrpystring': True})))
 SIGNED_ARRAY = GcArray(Signed)
 
 

Modified: pypy/dist/pypy/translator/c/node.py
==============================================================================
--- pypy/dist/pypy/translator/c/node.py	(original)
+++ pypy/dist/pypy/translator/c/node.py	Tue Mar 14 12:56:08 2006
@@ -10,7 +10,6 @@
 from pypy.translator.c.support import cdecl, somelettersfrom, c_string_constant
 from pypy.translator.c.primitive import PrimitiveType, isinf
 from pypy.translator.c import extfunc
-from pypy.rpython.rstr import STR
 
 
 def needs_gcheader(T):
@@ -142,7 +141,7 @@
         original_varlength = varlength
         self.gcfields = []
         
-        if ARRAY is STR.chars:
+        if ARRAY._hints.get('isrpystring'):
             varlength += 1   # for the NUL char terminator at the end of the string
         self.varlength = varlength
         if original_varlength == 1:



More information about the Pypy-commit mailing list