Пример #1
0
def dreturn(frame):
    value = frame.stack.pop()
    logger.debug("To be returned {0}".format(value))
    jassert_double(value)
    frame.ret = value
    frame.has_result = True
    frame.pc = len(frame.code) + 1
Пример #2
0
def dadd(frame):
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_double(value1)
    jassert_double(value2)
    result = value1[1] + value2[1]
    frame.stack.append(("double", result))
Пример #3
0
def op_0x63(frame):  # dadd
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_double(value1)
    jassert_double(value2)
    result = value1[1] + value2[1]
    frame.stack.append(("double", result))
Пример #4
0
def dmul(frame):
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_double(value1)
    jassert_double(value2)
    result = value1[1] * value2[1]
    frame.stack.append(("double", result))
Пример #5
0
def op_0x6f(frame):  # ddiv
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_double(value1)
    jassert_double(value2)
    if value2[1] == 0:
        frame.stack.append(("double", float("inf")))
        return
    result = value1[1] / value2[1]
    frame.stack.append(("double", result))
Пример #6
0
def ddiv(frame):
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_double(value1)
    jassert_double(value2)
    if value2[1] == 0:
        frame.stack.append(("double", float("inf")))
        return
    result = value1[1] / value2[1]
    frame.stack.append(("double", result))
Пример #7
0
def op_0x98(frame):  # dcmpl
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_double(value1)
    jassert_double(value2)
    if value1[1] > value2[1]:
        frame.stack.append(1)
    elif value1 == value2:
        frame.stack.append(0)
    else:
        frame.stack.append(-1)
Пример #8
0
def dcmpl(frame):
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_double(value1)
    jassert_double(value2)
    if value1[1] > value2[1]:
        frame.stack.append(1)
    elif value1 == value2:
        frame.stack.append(0)
    else:
        frame.stack.append(-1)
Пример #9
0
def d2i(frame):
    value = frame.stack.pop()
    jassert_double(value)
    if value[1] is None:
        frame.stack.append(0)
    else:
        if value[1] < -2147483648:  # -1 * math.pow(2, 31)
            result = -2147483648
        elif value[1] > 2147483647:  # math.pow(2, 31) - 1
            result = 2147483647
        else:
            result = int(value[1])
        jassert_int(result)
        frame.stack.append(result)
Пример #10
0
def d2l(frame):
    value = frame.stack.pop()
    jassert_double(value)
    if value[1] is None:
        frame.stack.append(("long", 0))
    else:
        min_value = long(-1 * math.pow(2, 63))
        max_value = long(math.pow(2, 63) - 1)
        if value[1] < min_value:
            result = min_value
        elif value[1] > max_value:
            result = max_value
        else:
            result = long(value[1])
        jassert_long(("long", result))
        frame.stack.append(("long", result))
Пример #11
0
def dastore(frame):
    value = frame.stack.pop()
    index = frame.stack.pop()
    ref = frame.stack.pop()
    jassert_double(value)
    jassert_int(index)
    if ref is None:
        frame.vm.raise_exception(frame, "java/lang/NullPointerException")
        return
    jassert_ref(ref)
    array = frame.vm.heap[ref[1]]
    jassert_array(array)
    values = array.values
    if index < 0 or index >= len(values):
        frame.vm.raise_exception(frame,
                                 "java/lang/ArrayIndexOutOfBoundsException")
        return
    values[index] = value
Пример #12
0
def dastore(frame):
    value = frame.stack.pop()
    index = frame.stack.pop()
    ref = frame.stack.pop()
    jassert_double(value)
    jassert_int(index)
    if ref is None:
        frame.vm.raise_exception(frame, "java/lang/NullPointerException")
        return
    jassert_ref(ref)
    array = frame.vm.heap[ref[1]]
    jassert_array(array)
    values = array.values
    if index < 0 or index >= len(values):
        frame.vm.raise_exception(frame,
                                 "java/lang/ArrayIndexOutOfBoundsException")
        return
    values[index] = value
Пример #13
0
def op_0x26(frame):  # dload_0
    value = frame.args[0]
    jassert_double(value)
    frame.stack.append(value)
Пример #14
0
def op_0x18(frame):  # dload
    index = ord(frame.code[frame.pc])
    frame.pc += 1
    value = frame.args[index]
    jassert_double(value)
    frame.stack.append(value)
Пример #15
0
def d2f(frame):
    value = frame.stack.pop()
    jassert_double(value)
    frame.stack.append(("float", value[1]))
Пример #16
0
def op_0x76(frame):  # fneg
    value = frame.stack.pop()
    jassert_double(value)
    result = value[1] * -1
    frame.stack.append(("float", result))
Пример #17
0
def op_0x29(frame):  # dload_3
    value = frame.args[3]
    jassert_double(value)
    frame.stack.append(value)
Пример #18
0
def dneg(frame):
    value = frame.stack.pop()
    jassert_double(value)
    result = value[1] * -1
    frame.stack.append(("double", result))
Пример #19
0
def op_0x49(frame):  # dstore_2
    value = frame.stack.pop()
    jassert_double(value)
    frame.args[2] = value
Пример #20
0
def op_0x47(frame):  # dstore_0
    value = frame.stack.pop()
    jassert_double(value)
    frame.args[0] = value
Пример #21
0
def op_0x90(frame):  # d2f
    value = frame.stack.pop()
    jassert_double(value)
    frame.stack.append(("float", value[1]))
Пример #22
0
def op_0x27(frame):  # dload_1
    value = frame.args[1]
    jassert_double(value)
    frame.stack.append(value)
Пример #23
0
def dstore(frame):
    index = ord(frame.code[frame.pc])
    frame.pc += 1
    value = frame.stack.pop()
    jassert_double(value)
    frame.args[index] = value
Пример #24
0
def op_0x28(frame):  # dload_2
    value = frame.args[2]
    jassert_double(value)
    frame.stack.append(value)
Пример #25
0
def dstore_3(frame):
    value = frame.stack.pop()
    jassert_double(value)
    frame.args[3] = value
Пример #26
0
def op_0x39(frame):  # dstore
    index = ord(frame.code[frame.pc])
    frame.pc += 1
    value = frame.stack.pop()
    jassert_double(value)
    frame.args[index] = value
Пример #27
0
def op_0x77(frame):  # dneg
    value = frame.stack.pop()
    jassert_double(value)
    result = value[1] * -1
    frame.stack.append(("double", result))
Пример #28
0
def op_0x48(frame):  # dstore_1
    value = frame.stack.pop()
    jassert_double(value)
    frame.args[1] = value
Пример #29
0
def dload(frame):
    index = ord(frame.code[frame.pc])
    frame.pc += 1
    value = frame.args[index]
    jassert_double(value)
    frame.stack.append(value)
Пример #30
0
def op_0x4a(frame):  # dstore_3
    value = frame.stack.pop()
    jassert_double(value)
    frame.args[3] = value
Пример #31
0
def dload_3(frame):
    value = frame.args[3]
    jassert_double(value)
    frame.stack.append(value)