use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.
the class Xaload method baload.
public static void baload(final Frame frame) {
int index = frame.operandStack.popInt();
ObjectRef arrayRef = frame.operandStack.popRef();
if (!frame.checkArray(arrayRef, index)) {
return;
}
Object result;
if (arrayRef.getVariableType().getComponentType().isBoolean()) {
boolean value = (boolean) frame.heap.getArray(arrayRef, index);
frame.operandStack.pushBoolean(value);
result = value;
} else {
byte value = (byte) frame.heap.getArray(arrayRef, index);
frame.operandStack.pushByte(value);
result = value;
}
// Log.result(frame.getCurrentOpCode(), result, arrayRef, index);
}
use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.
the class Xaload method faload.
public static void faload(final Frame frame) {
int index = frame.operandStack.popInt();
ObjectRef arrayRef = frame.operandStack.popRef();
if (!frame.checkArray(arrayRef, index)) {
return;
}
float value = (float) frame.heap.getArray(arrayRef, index);
frame.operandStack.pushFloat(value);
// Log.result(frame.getCurrentOpCode(), value, arrayRef, index);
}
use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.
the class Xaload method caload.
public static void caload(final Frame frame) {
int index = frame.operandStack.popInt();
ObjectRef arrayRef = frame.operandStack.popRef();
if (!frame.checkArray(arrayRef, index)) {
return;
}
char value = (char) frame.heap.getArray(arrayRef, index);
frame.operandStack.pushChar(value);
// Log.result(frame.getCurrentOpCode(), value, arrayRef, index);
}
use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.
the class New method new_.
public static void new_(Frame frame) {
String className = frame.typeInsnNode().desc;
ObjectRef objectRef = frame.heap.newObject(className);
frame.operandStack.pushRef(objectRef);
// Log.opcode(frame.getCurrentOpCode(), objectRef);
}
use of io.nuls.contract.vm.ObjectRef in project nuls by nuls-io.
the class Putfield method putfield.
public static void putfield(Frame frame) {
FieldInsnNode fieldInsnNode = frame.fieldInsnNode();
String fieldName = fieldInsnNode.name;
String fieldDesc = fieldInsnNode.desc;
Object value;
if (Descriptors.LONG_DESC.equals(fieldDesc)) {
value = frame.operandStack.popLong();
} else if (Descriptors.DOUBLE_DESC.equals(fieldDesc)) {
value = frame.operandStack.popDouble();
} else {
value = frame.operandStack.pop();
}
ObjectRef objectRef = frame.operandStack.popRef();
if (objectRef == null) {
frame.throwNullPointerException();
return;
}
frame.heap.putField(objectRef, fieldName, value);
// Log.result(frame.getCurrentOpCode(), value, objectRef, fieldName);
}
Aggregations