[pypy-svn] r67312 - pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport

arigo at codespeak.net arigo at codespeak.net
Sat Aug 29 14:37:33 CEST 2009


Author: arigo
Date: Sat Aug 29 14:37:33 2009
New Revision: 67312

Modified:
   pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport/gc.py
   pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport/llmodel.py
Log:
do_newstr, do_strsetitem


Modified: pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport/gc.py
==============================================================================
--- pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport/gc.py	(original)
+++ pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport/gc.py	Sat Aug 29 14:37:33 2009
@@ -62,18 +62,18 @@
         rffi.cast(rffi.CArrayPtr(lltype.Signed), res)[ofs_length/WORD] = num_elem
         return res
 
-    def gc_malloc_str(self, num_elem, translate_support_code):
+    def gc_malloc_str(self, num_elem):
         basesize, itemsize, ofs_length = symbolic.get_array_token(rstr.STR,
-                                                      translate_support_code)
+                                                   self.translate_support_code)
         assert itemsize == 1
         size = basesize + num_elem
         res = self.funcptr_for_new(size)
         rffi.cast(rffi.CArrayPtr(lltype.Signed), res)[ofs_length/WORD] = num_elem
         return res
 
-    def gc_malloc_unicode(self, num_elem, translate_support_code):
+    def gc_malloc_unicode(self, num_elem):
         basesize, itemsize, ofs_length = symbolic.get_array_token(rstr.UNICODE,
-                                                      translate_support_code)
+                                                   self.translate_support_code)
         size = basesize + num_elem * itemsize
         res = self.funcptr_for_new(size)
         rffi.cast(rffi.CArrayPtr(lltype.Signed), res)[ofs_length/WORD] = num_elem

Modified: pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport/llmodel.py
==============================================================================
--- pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport/llmodel.py	(original)
+++ pypy/branch/pyjitpl5-llmodel/pypy/jit/backend/llsupport/llmodel.py	Sat Aug 29 14:37:33 2009
@@ -208,6 +208,33 @@
         res = self.gc_ll_descr.gc_malloc_array(arraydescr, num_elem)
         return BoxPtr(res)
 
+    def do_newstr(self, args, descr=None):
+        num_elem = args[0].getint()
+        res = self.gc_ll_descr.gc_malloc_str(num_elem)
+        return BoxPtr(res)
+
+    def do_newunicode(self, args, descr=None):
+        num_elem = args[0].getint()
+        res = self.gc_ll_descr.gc_malloc_unicode(num_elem)
+        return BoxPtr(res)
+
+    def do_strsetitem(self, args, descr=None):
+        basesize, itemsize, ofs_length = symbolic.get_array_token(rstr.STR,
+                                                self.translate_support_code)
+        index = args[1].getint()
+        v = args[2].getint()
+        a = args[0].getptr_base()
+        rffi.cast(rffi.CArrayPtr(lltype.Char), a)[index + basesize] = chr(v)
+
+    def do_unicodesetitem(self, args, descr=None):
+        basesize, itemsize, ofs_length = symbolic.get_array_token(rstr.UNICODE,
+                                                self.translate_support_code)
+        index = args[1].getint()
+        v = args[2].getint()
+        a = args[0].getptr_base()
+        basesize = basesize // itemsize
+        rffi.cast(rffi.CArrayPtr(lltype.UniChar), a)[index + basesize] = unichr(v)
+
 
 import pypy.jit.metainterp.executor
 pypy.jit.metainterp.executor.make_execute_list(AbstractLLCPU)



More information about the Pypy-commit mailing list