Exemple #1
0
 def main():
     loop(1)
     op = jit_hooks.resop_new(
         rop.INT_ADD,
         [jit_hooks.boxint_new(3),
          jit_hooks.boxint_new(4)], jit_hooks.boxint_new(1))
     assert hlstr(jit_hooks.resop_getopname(op)) == 'int_add'
     assert jit_hooks.resop_getopnum(op) == rop.INT_ADD
     box = jit_hooks.resop_getarg(op, 0)
     assert jit_hooks.box_getint(box) == 3
     box2 = jit_hooks.box_clone(box)
     assert box2 != box
     assert jit_hooks.box_getint(box2) == 3
     assert not jit_hooks.box_isconst(box2)
     box3 = jit_hooks.box_constbox(box)
     assert jit_hooks.box_getint(box) == 3
     assert jit_hooks.box_isconst(box3)
     box4 = jit_hooks.box_nonconstbox(box)
     assert not jit_hooks.box_isconst(box4)
     box5 = jit_hooks.boxint_new(18)
     jit_hooks.resop_setarg(op, 0, box5)
     assert jit_hooks.resop_getarg(op, 0) == box5
     box6 = jit_hooks.resop_getresult(op)
     assert jit_hooks.box_getint(box6) == 1
     jit_hooks.resop_setresult(op, box5)
     assert jit_hooks.resop_getresult(op) == box5
Exemple #2
0
 def main():
     loop(1)
     op = jit_hooks.resop_new(rop.INT_ADD,
                              [jit_hooks.boxint_new(3),
                               jit_hooks.boxint_new(4)],
                              jit_hooks.boxint_new(1))
     assert hlstr(jit_hooks.resop_getopname(op)) == 'int_add'
     assert jit_hooks.resop_getopnum(op) == rop.INT_ADD
     box = jit_hooks.resop_getarg(op, 0)
     assert jit_hooks.box_getint(box) == 3
     box2 = jit_hooks.box_clone(box)
     assert box2 != box
     assert jit_hooks.box_getint(box2) == 3
     assert not jit_hooks.box_isconst(box2)
     box3 = jit_hooks.box_constbox(box)
     assert jit_hooks.box_getint(box) == 3
     assert jit_hooks.box_isconst(box3)
     box4 = jit_hooks.box_nonconstbox(box)
     assert not jit_hooks.box_isconst(box4)
     box5 = jit_hooks.boxint_new(18)
     jit_hooks.resop_setarg(op, 0, box5)
     assert jit_hooks.resop_getarg(op, 0) == box5
     box6 = jit_hooks.resop_getresult(op)
     assert jit_hooks.box_getint(box6) == 1
     jit_hooks.resop_setresult(op, box5)
     assert jit_hooks.resop_getresult(op) == box5
Exemple #3
0
 def main(i, j):
     op = resop_new(rop.INT_ADD, [boxint_new(3), boxint_new(5)],
                    boxint_new(8))
     return f(i) - f2(i+j, i, j) + resop_getopnum(op)
Exemple #4
0
def descr_new_box(space, w_tp, no):
    return WrappedBox(jit_hooks.boxint_new(no))