Commits

Maciej Fijalkowski  committed 126806e

add a jitdriver here

  • Participants
  • Parent commits 8c66911

Comments (0)

Files changed (1)

File pypy/module/micronumpy/interp_support.py

 from pypy.rpython.lltypesystem import lltype, rffi
 from pypy.module.micronumpy import interp_dtype
 from pypy.objspace.std.strutil import strip_spaces
-
+from pypy.rlib import jit
 
 FLOAT_SIZE = rffi.sizeof(lltype.Float)
 
             "string is smaller than requested size"))
         
     a = W_NDimArray(count, [count], dtype=dtype)
+    fromstring_loop(a, count, dtype, itemsize, s)
+    return space.wrap(a)
+
+fromstring_driver = jit.JitDriver(greens=[], reds=['a', 'count', 'dtype',
+                                                   'itemsize', 's'])
+
+def fromstring_loop(a, count, dtype, itemsize, s):
     for i in range(count):
+        fromstring_driver.jit_merge_point(a=a, count=count, dtype=dtype,
+                                          itemsize=itemsize, s=s)
         val = dtype.itemtype.runpack_str(s[i*itemsize:i*itemsize + itemsize])
         a.dtype.setitem(a.storage, i, val)
-        
-    return space.wrap(a)
 
 @unwrap_spec(s=str, count=int, sep=str)
 def fromstring(space, s, w_dtype=None, count=-1, sep=''):