Search in sources :

Example 51 with ObjectRef

use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.

the class IfAcmp method if_acmpeq.

public static void if_acmpeq(Frame frame) {
    ObjectRef value2 = frame.operandStack.popRef();
    ObjectRef value1 = frame.operandStack.popRef();
    boolean result = Objects.equals(value1, value2);
    if (result) {
        frame.jump();
    }
// Log.result(frame.getCurrentOpCode(), result, value1, "==", value2);
}
Also used : ObjectRef(io.nuls.contract.vm.ObjectRef)

Example 52 with ObjectRef

use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.

the class IfAcmp method if_acmpne.

public static void if_acmpne(Frame frame) {
    ObjectRef value2 = frame.operandStack.popRef();
    ObjectRef value1 = frame.operandStack.popRef();
    boolean result = !Objects.equals(value1, value2);
    if (result) {
        frame.jump();
    }
// Log.result(frame.getCurrentOpCode(), result, value1, "!=", value2);
}
Also used : ObjectRef(io.nuls.contract.vm.ObjectRef)

Example 53 with ObjectRef

use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.

the class Xastore method bastore.

public static void bastore(final Frame frame) {
    int i = frame.operandStack.popInt();
    int index = frame.operandStack.popInt();
    ObjectRef arrayRef = frame.operandStack.popRef();
    if (!frame.checkArray(arrayRef, index)) {
        return;
    }
    if (arrayRef.getVariableType().getComponentType().isBoolean()) {
        boolean value = i == 1 ? true : false;
        frame.heap.putArray(arrayRef, index, value);
    // Log.result(frame.getCurrentOpCode(), arrayRef, index, value);
    } else {
        byte value = (byte) i;
        frame.heap.putArray(arrayRef, index, value);
    // Log.result(frame.getCurrentOpCode(), arrayRef, index, value);
    }
}
Also used : ObjectRef(io.nuls.contract.vm.ObjectRef)

Example 54 with ObjectRef

use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.

the class Xastore method dastore.

public static void dastore(final Frame frame) {
    double value = frame.operandStack.popDouble();
    int index = frame.operandStack.popInt();
    ObjectRef arrayRef = frame.operandStack.popRef();
    if (!frame.checkArray(arrayRef, index)) {
        return;
    }
    frame.heap.putArray(arrayRef, index, value);
// Log.result(frame.getCurrentOpCode(), arrayRef, index, value);
}
Also used : ObjectRef(io.nuls.contract.vm.ObjectRef)

Example 55 with ObjectRef

use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.

the class Xastore method sastore.

public static void sastore(final Frame frame) {
    short value = frame.operandStack.popShort();
    int index = frame.operandStack.popInt();
    ObjectRef arrayRef = frame.operandStack.popRef();
    if (!frame.checkArray(arrayRef, index)) {
        return;
    }
    frame.heap.putArray(arrayRef, index, value);
// Log.result(frame.getCurrentOpCode(), arrayRef, index, value);
}
Also used : ObjectRef(io.nuls.contract.vm.ObjectRef)

Aggregations

ObjectRef (io.nuls.contract.vm.ObjectRef)74 Result (io.nuls.contract.vm.Result)35 VariableType (io.nuls.contract.vm.code.VariableType)18 MethodCode (io.nuls.contract.vm.code.MethodCode)6 ClassCode (io.nuls.contract.vm.code.ClassCode)5 MethodArgs (io.nuls.contract.vm.MethodArgs)3 MethodInsnNode (org.objectweb.asm.tree.MethodInsnNode)3 TypeInsnNode (org.objectweb.asm.tree.TypeInsnNode)3 Frame (io.nuls.contract.vm.Frame)2 FieldInsnNode (org.objectweb.asm.tree.FieldInsnNode)2 BiMap (com.google.common.collect.BiMap)1 BlockHeaderDto (io.nuls.contract.entity.BlockHeaderDto)1 VM (io.nuls.contract.vm.VM)1 ErrorException (io.nuls.contract.vm.exception.ErrorException)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 AccountState (org.ethereum.core.AccountState)1 DataWord (org.ethereum.vm.DataWord)1 Type (org.objectweb.asm.Type)1