[pypy-svn] r55344 - pypy/branch/oo-jit/pypy/jit/tl

antocuni at codespeak.net antocuni at codespeak.net
Wed May 28 14:10:20 CEST 2008


Author: antocuni
Date: Wed May 28 14:10:20 2008
New Revision: 55344

Added:
   pypy/branch/oo-jit/pypy/jit/tl/autopath.py
      - copied unchanged from r54313, pypy/branch/oo-jit/pypy/jit/codegen/i386/autopath.py
Modified:
   pypy/branch/oo-jit/pypy/jit/tl/tlr.py
Log:
add some comments, and a way to print the bytecode as expected by targettlr



Modified: pypy/branch/oo-jit/pypy/jit/tl/tlr.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/tl/tlr.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/tl/tlr.py	Wed May 28 14:10:20 2008
@@ -1,3 +1,4 @@
+import autopath
 from pypy.rlib.jit import hint, JitDriver
 
 
@@ -114,25 +115,34 @@
 
 SQUARE_LIST = [
     ALLOCATE,    3,
-    MOV_A_R,     0,   # counter
+    MOV_A_R,     0,   # i = a
     MOV_A_R,     1,   # copy of 'a'
+    
     SET_A,       0,
-    MOV_A_R,     2,   # accumulator for the result
+    MOV_A_R,     2,   # res = 0
+
     # 10:
     SET_A,       1,
     NEG_A,
-    ADD_R_TO_A,  0,
-    MOV_A_R,     0,
+    ADD_R_TO_A,  0,   
+    MOV_A_R,     0,   # i--
+    
     MOV_R_A,     2,
     ADD_R_TO_A,  1,
-    MOV_A_R,     2,
+    MOV_A_R,     2,   # res += a
+    
     MOV_R_A,     0,
-    JUMP_IF_A,  10,
+    JUMP_IF_A,  10,   # if i!=0: goto 10
 
     MOV_R_A,     2,
-    RETURN_A ]
+    RETURN_A          # return res
+    ]
 
 SQUARE = ''.join([chr(n) for n in SQUARE_LIST])
 
 if __name__ == '__main__':
-    print ','.join([str(n) for n in SQUARE_LIST])
+    import sys
+    if len(sys.argv) >= 2 and sys.argv[1] == 'assemble':
+        print SQUARE
+    else:
+        print ','.join([str(n) for n in SQUARE_LIST])



More information about the Pypy-commit mailing list