[pypy-commit] pypy faster-rstruct-2: implement support for gc_store_indexed also in llsupport: this fixes the tests for the x86 backend, and hopefully for the other backends as well

antocuni pypy.commits at gmail.com
Fri May 12 10:29:25 EDT 2017


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct-2
Changeset: r91266:88ae2f6e9df5
Date: 2017-05-12 16:25 +0200
http://bitbucket.org/pypy/pypy/changeset/88ae2f6e9df5/

Log:	implement support for gc_store_indexed also in llsupport: this fixes
	the tests for the x86 backend, and hopefully for the other backends
	as well

diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py
--- a/rpython/jit/backend/llsupport/llmodel.py
+++ b/rpython/jit/backend/llsupport/llmodel.py
@@ -754,6 +754,16 @@
         offset = base_ofs + scale * index
         return self.read_float_at_mem(addr, offset)
 
+    def bh_gc_store_indexed_i(self, addr, index, val, scale, base_ofs, bytes,
+                              descr):
+        offset = base_ofs + scale * index
+        self.write_int_at_mem(addr, offset, bytes, val)
+
+    def bh_gc_store_indexed_f(self, addr, index, val, scale, base_ofs, bytes,
+                              descr):
+        offset = base_ofs + scale * index
+        self.write_float_at_mem(addr, offset, val)
+
     def bh_new(self, sizedescr):
         return self.gc_ll_descr.gc_malloc(sizedescr)
 
diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py
--- a/rpython/jit/metainterp/executor.py
+++ b/rpython/jit/metainterp/executor.py
@@ -262,7 +262,7 @@
         raise AssertionError("cannot store GC pointers in gc_store_indexed for now")
     elif arraydescr.is_array_of_floats():
         floatval = valuebox.getfloat()
-        cpu.bh_gc_store_indexed_i(addr, index, floatval, scale, base_ofs, bytes,
+        cpu.bh_gc_store_indexed_f(addr, index, floatval, scale, base_ofs, bytes,
                                   arraydescr)
     else:
         intval = valuebox.getint()
diff --git a/rpython/jit/metainterp/test/test_llop.py b/rpython/jit/metainterp/test/test_llop.py
--- a/rpython/jit/metainterp/test/test_llop.py
+++ b/rpython/jit/metainterp/test/test_llop.py
@@ -33,7 +33,9 @@
         def f(value):
             lst = newlist_and_gc_store(TYPE, value)
             got = ''.join(lst)
-            assert got == expected
+            if got != expected:
+                # I'm not sure why, but if I use an assert, the test doesn't fail
+                raise ValueError('got != expected')
             return len(got)
         return self.interp_operations(f, [value], supports_singlefloats=True)
 


More information about the pypy-commit mailing list