Commits

Maciej Fijalkowski committed d1e954a

break test zjit. This gives traces roughly how I would like them.

Comments (0)

Files changed (2)

pypy/module/micronumpy/interp_numarray.py

 
 
 numpy_driver = jit.JitDriver(greens = ['signature'],
-                             reds = ['result_size', 'i', 'self', 'result'])
+                             reds = ['result_size', 'i', 'counter', 'c',
+                                     'finish', 'self', 'result'])
 all_driver = jit.JitDriver(greens=['signature'], reds=['i', 'size', 'self', 'dtype'])
 any_driver = jit.JitDriver(greens=['signature'], reds=['i', 'size', 'self', 'dtype'])
 slice_driver = jit.JitDriver(greens=['signature'], reds=['i', 'j', 'step', 'stop', 'source', 'dest'])
         signature = self.signature
         result_size = self.find_size()
         result = SingleDimArray(result_size, self.find_dtype())
-        while i < result_size:
+        finish = result_size // 4
+        counter = 0
+        c = 0
+        while counter < finish:
             numpy_driver.jit_merge_point(signature=signature,
                                          result_size=result_size, i=i,
-                                         self=self, result=result)
+                                         self=self, result=result,
+                                         counter=counter, finish=finish, c=c)
             result.dtype.setitem(result.storage, i, self.eval(i))
             i += 1
+            c += 1
+            if c == 4:
+                counter += 1
+                c = 0
+                numpy_driver.can_enter_jit(signature=signature,
+                                           result_size=result_size, i=i,
+                                           self=self, result=result,
+                                           counter=counter, finish=finish, c=c)
+        # tail
+        while i < result_size:
+            result.dtype.setitem(result.storage, i, self.eval(i))
+            i += 1            
         return result
 
     def force_if_needed(self):

pypy/module/micronumpy/test/test_zjit.py

             v = interp_ufuncs.get(self.space).add.call(self.space, [ar, ar])
             return v.get_concrete().eval(3).val
 
-        result = self.meta_interp(f, [5], listops=True, backendopt=True)
+        result = self.meta_interp(f, [20], listops=True, backendopt=True)
         self.check_loops({'getarrayitem_raw': 2, 'float_add': 1,
                           'setarrayitem_raw': 1, 'int_add': 1,
                           'int_lt': 1, 'guard_true': 1, 'jump': 1})
-        assert result == f(5)
+        assert result == f(20)
 
     def test_floatadd(self):
         def f(i):