Search in sources :

Example 46 with ObjectRef

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

the class Ifnonnull method ifnonnull.

public static void ifnonnull(final Frame frame) {
    ObjectRef value = frame.operandStack.popRef();
    boolean result = value != null;
    if (result) {
        frame.jump();
    }
// Log.result(frame.getCurrentOpCode(), result, value, "!=", null);
}
Also used : ObjectRef(io.nuls.contract.vm.ObjectRef)

Example 47 with ObjectRef

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

the class Arraylength method arraylength.

public static void arraylength(Frame frame) {
    ObjectRef arrayRef = frame.operandStack.popRef();
    if (arrayRef == null) {
        frame.throwNullPointerException();
        return;
    }
    int length = arrayRef.getDimensions()[0];
    frame.operandStack.pushInt(length);
// Log.result(frame.getCurrentOpCode(), length);
}
Also used : ObjectRef(io.nuls.contract.vm.ObjectRef)

Example 48 with ObjectRef

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

the class Xaload method saload.

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

Example 49 with ObjectRef

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

the class Xaload method laload.

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

Example 50 with ObjectRef

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

the class Xaload method iaload.

public static void iaload(final Frame frame) {
    int index = frame.operandStack.popInt();
    ObjectRef arrayRef = frame.operandStack.popRef();
    if (!frame.checkArray(arrayRef, index)) {
        return;
    }
    int value = (int) frame.heap.getArray(arrayRef, index);
    frame.operandStack.pushInt(value);
// Log.result(frame.getCurrentOpCode(), value, arrayRef, index);
}
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