Commits

Konstantin Lopuhin committed f609b3c

start recovering targetnumpy

  • Participants
  • Parent commits 3f01d4d
  • Branches targetnumpy

Comments (0)

Files changed (1)

pypy/goal/targetnumpystandalone.py

 
 """ Usage:
 
-./targetnumpystandalone-c <bytecode> array_size
+./targetnumpystandalone-c <bytecode>
 
 Will execute a give numpy bytecode. Arrays will be ranges (in float) modulo 10,
 constants would be consecutive starting from one.
 """
 
 import time
-from pypy.module.micronumpy.compile import numpy_compile
+from pypy.module.micronumpy.compile import numpy_compile, FakeSpace
 from rpython.jit.codewriter.policy import JitPolicy
 from rpython.rtyper.annlowlevel import hlstr
 
 def entry_point(argv):
-    if len(argv) != 3:
+    if len(argv) != 2:
         print __doc__
         return 1
-    try:
-        size = int(argv[2])
-    except ValueError:
-        print "INVALID LITERAL FOR INT:", argv[2]
-        print __doc__
-        return 3
     t0 = time.time()
-    main(argv[0], size)
-    print "bytecode:", argv[0], "size:", size
+    main(argv[1])
+    print "bytecode:", argv[1]
     print "took:", time.time() - t0
     return 0
 
-def main(bc, size):
+def main(bc):
     if not isinstance(bc, str):
         bc = hlstr(bc) # for tests
-    a = numpy_compile(bc, size)
-    a = a.compute()
+    a = numpy_compile(bc)
+    space = FakeSpace()
+    a.run(space)
 
 def target(*args):
     return entry_point, None
 
 def jitpolicy(driver):
     return JitPolicy()
+
+
+if __name__ == '__main__':
+    import sys
+    entry_point(sys.argv)
+