示例#1
0
def test_serialization():
    from rpython.jit.tl.tlopcode import serialize_program, decode_program
    pool = ConstantPool()
    bytecode = compile("""
        NEW foo,bar,meth=f
        SETATTR foobar
      f:
        RETURN
    """, pool)
    s = serialize_program(bytecode, pool)
    bytecode2, pool2 = decode_program(s)
    assert bytecode == bytecode2
    assert pool == pool2
示例#2
0
文件: targettlc.py 项目: charred/pypy
def load_bytecode(filename):
    from rpython.rlib.streamio import open_file_as_stream
    from rpython.jit.tl.tlopcode import decode_program
    f = open_file_as_stream(filename)
    return decode_program(f.readall())
示例#3
0
def load_bytecode(filename):
    from rpython.rlib.streamio import open_file_as_stream
    from rpython.jit.tl.tlopcode import decode_program
    f = open_file_as_stream(filename)
    return decode_program(f.readall())