Example #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
Example #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
Example #3
0
 def descr_getarg(self, space, no):
     try:
         box = jit_hooks.resop_getarg(self.op, no)
     except IndexError:
         raise OperationError(space.w_IndexError,
                              space.wrap("Index out of range"))
     return WrappedBox(box)
Example #4
0
 def descr_getarg(self, space, no):
     try:
         box = jit_hooks.resop_getarg(self.op, no)
     except IndexError:
         raise OperationError(space.w_IndexError,
                              space.wrap("Index out of range"))
     return WrappedBox(box)