[pypy-svn] r73748 - in pypy/trunk/pypy/jit/tl: . test
fijal at codespeak.net
fijal at codespeak.net
Wed Apr 14 23:29:35 CEST 2010
Author: fijal
Date: Wed Apr 14 23:29:34 2010
New Revision: 73748
Modified:
pypy/trunk/pypy/jit/tl/test/test_tinyframe.py
pypy/trunk/pypy/jit/tl/tinyframe.py
Log:
IN-PROGRESS
Modified: pypy/trunk/pypy/jit/tl/test/test_tinyframe.py
==============================================================================
--- pypy/trunk/pypy/jit/tl/test/test_tinyframe.py (original)
+++ pypy/trunk/pypy/jit/tl/test/test_tinyframe.py Wed Apr 14 23:29:34 2010
@@ -44,13 +44,17 @@
assert ret.val == 100
def test_function(self):
- py.test.skip("not yet")
+ py.test.skip("in progress")
code = compile('''
func: # arg comes in r0
LOAD 1 => r1
ADD r0 r1 => r1
RETURN r1
main:
- LOAD_FUNCTION name
- CALL
+ LOAD_FUNCTION func => r0
+ LOAD 1 => r1
+ CALL r0 r1 => r2
+ RETURN r2
''')
+ ret = interpret(code)
+ assert ret.val == 1 + 1
Modified: pypy/trunk/pypy/jit/tl/tinyframe.py
==============================================================================
--- pypy/trunk/pypy/jit/tl/tinyframe.py (original)
+++ pypy/trunk/pypy/jit/tl/tinyframe.py Wed Apr 14 23:29:34 2010
@@ -8,10 +8,12 @@
# depending on argument types
# if r1 has a function f and r2 has a function g
# the result will be a function lambda arg : f(g(arg))
+ # this is also a way to achieve indirect call
INTROSPECT r1 => r2 # frame introspection - load a register with number
# pointed by r1 (must be int) to r2
PRINT r # print a register
-CALL r1 r2 # call a function in register one with argument in r2
+CALL r1 r2 => r3 # call a function in register one with argument in r2 and
+ # result in r3
LOAD_FUNCTION <name> => r # load a function named name into register r
LOAD <int constant> => r # load an integer constant into register r
RETURN r1
@@ -107,6 +109,8 @@
self.code += [JUMP_IF_ABOVE, self.rint(arg0.strip()),
self.rint(arg1.strip()), self.labels[label[1:]]]
+ #def compile_LOAD_FUNCTION(self,
+
def compile(strrepr):
parser = Parser()
return parser.compile(strrepr)
More information about the Pypy-commit
mailing list