use of io.nuls.contract.vm.Result in project nuls by nuls-io.
the class NativeStrictMath method cos.
/**
* native
*
* @see StrictMath#cos(double)
*/
private static Result cos(MethodCode methodCode, MethodArgs methodArgs, Frame frame) {
double a = (double) methodArgs.invokeArgs[0];
double r = StrictMath.cos(a);
Result result = NativeMethod.result(methodCode, r, frame);
return result;
}
use of io.nuls.contract.vm.Result in project nuls by nuls-io.
the class NativeStrictMath method cosh.
/**
* native
*
* @see StrictMath#cosh(double)
*/
private static Result cosh(MethodCode methodCode, MethodArgs methodArgs, Frame frame) {
double x = (double) methodArgs.invokeArgs[0];
double r = StrictMath.cosh(x);
Result result = NativeMethod.result(methodCode, r, frame);
return result;
}
use of io.nuls.contract.vm.Result in project nuls by nuls-io.
the class NativeSystem method identityHashCode.
/**
* native
*
* @see System#identityHashCode(Object)
*/
private static Result identityHashCode(MethodCode methodCode, MethodArgs methodArgs, Frame frame) {
ObjectRef objectRef = (ObjectRef) methodArgs.invokeArgs[0];
int hashCode = identityHashCode(objectRef);
Result result = NativeMethod.result(methodCode, hashCode, frame);
return result;
}
use of io.nuls.contract.vm.Result in project nuls by nuls-io.
the class NativeSystem method arraycopy.
/**
* native
*
* @see System#arraycopy(Object, int, Object, int, int)
*/
private static Result arraycopy(MethodCode methodCode, MethodArgs methodArgs, Frame frame) {
Object[] args = methodArgs.invokeArgs;
ObjectRef srcObjectRef = (ObjectRef) args[0];
int srcPos = (int) args[1];
ObjectRef destObjectRef = (ObjectRef) args[2];
int destPos = (int) args[3];
int length = (int) args[4];
if (length > 0 && frame.checkArray(srcObjectRef, srcPos) && frame.checkArray(srcObjectRef, srcPos + length - 1) && frame.checkArray(destObjectRef, destPos) && frame.checkArray(destObjectRef, destPos + length - 1)) {
frame.heap.arraycopy(srcObjectRef, srcPos, destObjectRef, destPos, length);
}
Result result = NativeMethod.result(methodCode, null, frame);
return result;
}
use of io.nuls.contract.vm.Result in project nuls by nuls-io.
the class NativeClass method getSuperclass.
/**
* native
*
* @see Class#getSuperclass()
*/
private static Result getSuperclass(MethodCode methodCode, MethodArgs methodArgs, Frame frame) {
ObjectRef objectRef = methodArgs.objectRef;
VariableType variableType;
if (objectRef.getVariableType().isArray()) {
variableType = objectRef.getVariableType();
} else {
variableType = VariableType.valueOf(objectRef.getRef());
}
ClassCode classCode = frame.methodArea.loadClass(variableType.getType());
VariableType superVariableType = VariableType.valueOf(classCode.superName);
ObjectRef classRef = frame.heap.getClassRef(superVariableType.getDesc());
Result result = NativeMethod.result(methodCode, classRef, frame);
return result;
}
Aggregations