コード例 #1
0
ファイル: test_tlr.py プロジェクト: Darriall/pypy
 def driver():
     bench = Benchmark()
     while 1:
         res = tlr.interpret(tlr.SQUARE, 1764)
         if bench.stop():
             break
     return res
コード例 #2
0
ファイル: targettlr.py プロジェクト: Darriall/pypy
def entry_point(args):
    """Main entry point of the stand-alone executable:
    takes a list of strings and returns the exit code.
    """
    # store args[0] in a place where the JIT log can find it (used by
    # viewcode.py to know the executable whose symbols it should display)
    highleveljitinfo.sys_executable = args[0]
    if len(args) < 3:
        print "Usage: %s filename x" % (args[0],)
        return 2
    filename = args[1]
    x = int(args[2])
    bytecode = load_bytecode(filename)
    res = interpret(bytecode, x)
    print res
    return 0
コード例 #3
0
def entry_point(args):
    """Main entry point of the stand-alone executable:
    takes a list of strings and returns the exit code.
    """
    # store args[0] in a place where the JIT log can find it (used by
    # viewcode.py to know the executable whose symbols it should display)
    highleveljitinfo.sys_executable = args[0]
    if len(args) < 3:
        print "Usage: %s filename x" % (args[0], )
        return 2
    filename = args[1]
    x = int(args[2])
    bytecode = load_bytecode(filename)
    res = interpret(bytecode, x)
    print res
    return 0
コード例 #4
0
ファイル: test_tlr.py プロジェクト: Darriall/pypy
 def test_square(self):
     assert tlr.interpret(tlr.SQUARE, 1) == 1
     assert tlr.interpret(tlr.SQUARE, 7) == 49
     assert tlr.interpret(tlr.SQUARE, 9) == 81
コード例 #5
0
 def main(n, a):
     code = codes[n]
     return interpret(code, a)