[pypy-svn] r26270 - in pypy/dist/pypy/translator/cl: . test

sanxiyn at codespeak.net sanxiyn at codespeak.net
Mon Apr 24 17:03:51 CEST 2006


Author: sanxiyn
Date: Mon Apr 24 17:03:46 2006
New Revision: 26270

Modified:
   pypy/dist/pypy/translator/cl/clrepr.py
   pypy/dist/pypy/translator/cl/gencl.py
   pypy/dist/pypy/translator/cl/test/test_cltrans_oo.py
Log:
Implement ll_getitem_fast and enable the corresponding test


Modified: pypy/dist/pypy/translator/cl/clrepr.py
==============================================================================
--- pypy/dist/pypy/translator/cl/clrepr.py	(original)
+++ pypy/dist/pypy/translator/cl/clrepr.py	Mon Apr 24 17:03:46 2006
@@ -1,3 +1,5 @@
+import types
+
 from pypy.objspace.flow.model import Constant, Variable
 from pypy.rpython.ootypesystem.ootype import _static_meth
 
@@ -14,6 +16,9 @@
     return name.replace('_', '-')
 
 def repr_const(val):
+    if isinstance(val, types.FunctionType):
+        if val.func_name == 'dum_nocheck': # XXX
+            return "'dummy"
     if isinstance(val, _static_meth):
         return repr_fun_name(val._name) # XXX make sure function names are unique
     if isinstance(val, tuple):

Modified: pypy/dist/pypy/translator/cl/gencl.py
==============================================================================
--- pypy/dist/pypy/translator/cl/gencl.py	(original)
+++ pypy/dist/pypy/translator/cl/gencl.py	Mon Apr 24 17:03:46 2006
@@ -106,7 +106,8 @@
         return "(length %s)" % (self.obj,)
 
     def ll_getitem_fast(self, index):
-        pass
+        index = repr_arg(index)
+        return "(aref %s %s)" % (self.obj, index)
 
     def ll_setitem_fast(self, index, value):
         index = repr_arg(index)

Modified: pypy/dist/pypy/translator/cl/test/test_cltrans_oo.py
==============================================================================
--- pypy/dist/pypy/translator/cl/test/test_cltrans_oo.py	(original)
+++ pypy/dist/pypy/translator/cl/test/test_cltrans_oo.py	Mon Apr 24 17:03:46 2006
@@ -17,7 +17,7 @@
     cl_list_length_one = make_cl_func(list_length_one, [int])
     assert cl_list_length_one(0) == 1
 
-def dont_test_list_get():
+def test_list_get():
     def list_and_get(number):
         lst = [number]
         return lst[0]



More information about the Pypy-commit mailing list