Commits

Armin Rigo  committed 5c4cc25

Arrays of struct need a getlength() too.

  • Participants
  • Parent commits c40de2d

Comments (0)

Files changed (2)

File rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py

         """
         self.optimize_loop(ops, expected)
 
+    def test_virtual_array_of_struct_len(self):
+        ops = """
+        []
+        p0 = new_array(2, descr=complexarraydescr)
+        i0 = arraylen_gc(p0)
+        finish(i0)
+        """
+        expected = """
+        []
+        finish(2)
+        """
+        self.optimize_loop(ops, expected)
+
     def test_nonvirtual_1(self):
         ops = """
         [i]

File rpython/jit/metainterp/optimizeopt/virtualize.py

         self.arraydescr = arraydescr
         self._items = [{} for _ in xrange(size)]
 
+    def getlength(self):
+        return len(self._items)
+
     def getinteriorfield(self, index, ofs, default):
         return self._items[index].get(ofs, default)