Пример #1
0
def execute_nonspec(cpu, opnum, argboxes, descr=None):
    arity = resoperation.oparity[opnum]
    assert arity == -1 or len(argboxes) == arity
    if resoperation.opwithdescr[opnum]:
        check_descr(descr)
        if arity == -1:
            func = get_execute_funclist(cpu, -1)[opnum]
            return func(cpu, argboxes, descr)
        if arity == 0:
            func = get_execute_funclist(cpu, 1)[opnum]
            return func(cpu, descr)
        if arity == 1:
            func = get_execute_funclist(cpu, 2)[opnum]
            return func(cpu, argboxes[0], descr)
        if arity == 2:
            func = get_execute_funclist(cpu, 3)[opnum]
            return func(cpu, argboxes[0], argboxes[1], descr)
        if arity == 3:
            func = get_execute_funclist(cpu, 4)[opnum]
            return func(cpu, argboxes[0], argboxes[1], argboxes[2], descr)
    else:
        assert descr is None
        if arity == 1:
            func = get_execute_funclist(cpu, 1)[opnum]
            return func(cpu, argboxes[0])
        if arity == 2:
            func = get_execute_funclist(cpu, 2)[opnum]
            return func(cpu, argboxes[0], argboxes[1])
        if arity == 3:
            func = get_execute_funclist(cpu, 3)[opnum]
            return func(cpu, argboxes[0], argboxes[1], argboxes[2])
    raise NotImplementedError
Пример #2
0
def execute_nonspec(cpu, opnum, argboxes, descr=None):
    arity = resoperation.oparity[opnum]
    assert arity == -1 or len(argboxes) == arity
    if resoperation.opwithdescr[opnum]:
        check_descr(descr)
        if arity == -1:
            func = get_execute_funclist(cpu, -1)[opnum]
            return func(cpu, argboxes, descr)
        if arity == 0:
            func = get_execute_funclist(cpu, 1)[opnum]
            return func(cpu, descr)
        if arity == 1:
            func = get_execute_funclist(cpu, 2)[opnum]
            return func(cpu, argboxes[0], descr)
        if arity == 2:
            func = get_execute_funclist(cpu, 3)[opnum]
            return func(cpu, argboxes[0], argboxes[1], descr)
        if arity == 3:
            func = get_execute_funclist(cpu, 4)[opnum]
            return func(cpu, argboxes[0], argboxes[1], argboxes[2], descr)
    else:
        assert descr is None
        if arity == 1:
            func = get_execute_funclist(cpu, 1)[opnum]
            return func(cpu, argboxes[0])
        if arity == 2:
            func = get_execute_funclist(cpu, 2)[opnum]
            return func(cpu, argboxes[0], argboxes[1])
        if arity == 3:
            func = get_execute_funclist(cpu, 3)[opnum]
            return func(cpu, argboxes[0], argboxes[1], argboxes[2])
    raise NotImplementedError
Пример #3
0
def execute_nonspec(cpu, metainterp, opnum, argboxes, descr=None):
    arity = resoperation.oparity[opnum]
    assert arity == -1 or len(argboxes) == arity
    if resoperation.opwithdescr[opnum]:
        check_descr(descr)
        if arity == -1:
            func = get_execute_funclist(-1, True)[opnum]
            return func(cpu, metainterp, argboxes, descr)
        if arity == 0:
            func = get_execute_funclist(0, True)[opnum]
            return func(cpu, metainterp, descr)
        if arity == 1:
            func = get_execute_funclist(1, True)[opnum]
            return func(cpu, metainterp, argboxes[0], descr)
        if arity == 2:
            func = get_execute_funclist(2, True)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1], descr)
        if arity == 3:
            func = get_execute_funclist(3, True)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1], argboxes[2], descr)
    else:
        assert descr is None
        if arity == 1:
            func = get_execute_funclist(1, False)[opnum]
            return func(cpu, metainterp, argboxes[0])
        if arity == 2:
            func = get_execute_funclist(2, False)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1])
        if arity == 3:
            func = get_execute_funclist(3, False)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1], argboxes[2])
        if arity == 5:  # copystrcontent, copyunicodecontent
            func = get_execute_funclist(5, False)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1], argboxes[2], argboxes[3], argboxes[4])
    raise NotImplementedError
Пример #4
0
 def setdescr(self, descr):
     # for 'call', 'new', 'getfield_gc'...: the descr is a number provided
     # by the backend holding details about the type of the operation --
     # actually an instance of a class, typically Descr, that inherits
     # from AbstractDescr
     from pypy.jit.metainterp.history import check_descr
     check_descr(descr)
     self.descr = descr
Пример #5
0
 def setdescr(self, descr):
     # for 'call', 'new', 'getfield_gc'...: the descr is a number provided
     # by the backend holding details about the type of the operation --
     # actually an instance of a class, typically Descr, that inherits
     # from AbstractDescr
     from pypy.jit.metainterp.history import check_descr
     check_descr(descr)
     self.descr = descr
Пример #6
0
def do_getfield_raw(cpu, _, structbox, fielddescr):
    check_descr(fielddescr)
    struct = structbox.getint()
    if fielddescr.is_pointer_field():
        return BoxPtr(cpu.bh_getfield_raw_r(struct, fielddescr))
    elif fielddescr.is_float_field():
        return BoxFloat(cpu.bh_getfield_raw_f(struct, fielddescr))
    else:
        return BoxInt(cpu.bh_getfield_raw_i(struct, fielddescr))
Пример #7
0
def do_getfield_raw(cpu, _, structbox, fielddescr):
    check_descr(fielddescr)
    struct = structbox.getint()
    if fielddescr.is_pointer_field():
        return BoxPtr(cpu.bh_getfield_raw_r(struct, fielddescr))
    elif fielddescr.is_float_field():
        return BoxFloat(cpu.bh_getfield_raw_f(struct, fielddescr))
    else:
        return BoxInt(cpu.bh_getfield_raw_i(struct, fielddescr))
Пример #8
0
def execute(cpu, opnum, descr, *argboxes):
    # only for opnums with a fixed arity
    if has_descr(opnum):
        check_descr(descr)
        argboxes = argboxes + (descr,)
    else:
        assert descr is None
    func = get_execute_function(cpu, opnum, len(argboxes))
    assert func is not None
    return func(cpu, *argboxes)
Пример #9
0
def execute(cpu, opnum, descr, *argboxes):
    # only for opnums with a fixed arity
    if has_descr(opnum):
        check_descr(descr)
        argboxes = argboxes + (descr, )
    else:
        assert descr is None
    func = get_execute_function(cpu, opnum, len(argboxes))
    assert func is not None
    return func(cpu, *argboxes)
Пример #10
0
def execute(cpu, metainterp, opnum, descr, *argboxes):
    # only for opnums with a fixed arity
    num_args = len(argboxes)
    withdescr = has_descr(opnum)
    if withdescr:
        check_descr(descr)
        argboxes = argboxes + (descr, )
    else:
        assert descr is None
    func = get_execute_function(opnum, num_args, withdescr)
    return func(cpu, metainterp, *argboxes)  # note that the 'argboxes' tuple
Пример #11
0
def execute(cpu, metainterp, opnum, descr, *argboxes):
    # only for opnums with a fixed arity
    num_args = len(argboxes)
    withdescr = has_descr(opnum)
    if withdescr:
        check_descr(descr)
        argboxes = argboxes + (descr,)
    else:
        assert descr is None
    func = get_execute_function(opnum, num_args, withdescr)
    return func(cpu, metainterp, *argboxes)  # note that the 'argboxes' tuple
Пример #12
0
def execute_nonspec(cpu, metainterp, opnum, argboxes, descr=None):
    arity = resoperation.oparity[opnum]
    assert arity == -1 or len(argboxes) == arity
    if resoperation.opwithdescr[opnum]:
        check_descr(descr)
        if arity == -1:
            func = get_execute_funclist(-1, True)[opnum]
            return func(cpu, metainterp, argboxes, descr)
        if arity == 0:
            func = get_execute_funclist(0, True)[opnum]
            return func(cpu, metainterp, descr)
        if arity == 1:
            func = get_execute_funclist(1, True)[opnum]
            return func(cpu, metainterp, argboxes[0], descr)
        if arity == 2:
            func = get_execute_funclist(2, True)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1], descr)
        if arity == 3:
            func = get_execute_funclist(3, True)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1], argboxes[2],
                        descr)
    else:
        assert descr is None
        if arity == 1:
            func = get_execute_funclist(1, False)[opnum]
            return func(cpu, metainterp, argboxes[0])
        if arity == 2:
            func = get_execute_funclist(2, False)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1])
        if arity == 3:
            func = get_execute_funclist(3, False)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1], argboxes[2])
        if arity == 5:  # copystrcontent, copyunicodecontent
            func = get_execute_funclist(5, False)[opnum]
            return func(cpu, metainterp, argboxes[0], argboxes[1], argboxes[2],
                        argboxes[3], argboxes[4])
    raise NotImplementedError
Пример #13
0
 def _check_descr(self, descr):
     if not we_are_translated() and getattr(descr, 'I_am_a_descr', False):
         return # needed for the mock case in oparser_model
     from pypy.jit.metainterp.history import check_descr
     check_descr(descr)
Пример #14
0
def execute_varargs(cpu, opnum, argboxes, descr):
    # only for opnums with a variable arity (calls, typically)
    check_descr(descr)
    func = get_execute_function(cpu, opnum, -1)
    assert func is not None
    return func(cpu, argboxes, descr)
Пример #15
0
def execute_varargs(cpu, metainterp, opnum, argboxes, descr):
    # only for opnums with a variable arity (calls, typically)
    check_descr(descr)
    func = get_execute_function(opnum, -1, True)
    return func(cpu, metainterp, argboxes, descr)
Пример #16
0
def execute_varargs(cpu, metainterp, opnum, argboxes, descr):
    # only for opnums with a variable arity (calls, typically)
    check_descr(descr)
    func = get_execute_function(opnum, -1, True)
    return func(cpu, metainterp, argboxes, descr)
Пример #17
0
 def _check_descr(self, descr):
     if not we_are_translated() and getattr(descr, 'I_am_a_descr', False):
         return  # needed for the mock case in oparser_model
     from pypy.jit.metainterp.history import check_descr
     check_descr(descr)
Пример #18
0
def execute_varargs(cpu, opnum, argboxes, descr):
    # only for opnums with a variable arity (calls, typically)
    check_descr(descr)
    func = get_execute_function(cpu, opnum, -1)
    assert func is not None
    return func(cpu, argboxes, descr)