use of org.robovm.compiler.llvm.Ptrtoint in project robovm by robovm.
the class BroMethodCompiler method marshalPointerToLong.
protected Value marshalPointerToLong(Function fn, Value pointer) {
Variable result = fn.newVariable(I64);
fn.add(new Ptrtoint(result, pointer, I64));
return result.ref();
}
use of org.robovm.compiler.llvm.Ptrtoint in project robovm by robovm.
the class BroMethodCompiler method marshalNativeToArray.
protected Value marshalNativeToArray(Function fn, MarshalerMethod marshalerMethod, Value env, String arrayClassName, Value nativeValue, long flags, int[] dimensions) {
Invokestatic invokeToObject = marshalerMethod.getInvokeStatic(sootMethod.getDeclaringClass());
trampolines.add(invokeToObject);
Variable handle = fn.newVariable(I64);
fn.add(new Ptrtoint(handle, nativeValue, I64));
Value valueClass = ldcClass(fn, arrayClassName, env);
List<Value> args = new ArrayList<>();
args.add(env);
args.add(valueClass);
args.add(handle.ref());
args.add(new IntegerConstant(flags));
args.addAll(arrayDimensionsValues(dimensions));
return call(fn, invokeToObject.getFunctionRef(), args);
}
use of org.robovm.compiler.llvm.Ptrtoint in project robovm by robovm.
the class BroMethodCompiler method marshalArrayToNative.
protected void marshalArrayToNative(Function fn, MarshalerMethod marshalerMethod, Value env, Value object, Value destPtr, long flags, int[] dimensions) {
Invokestatic invokestatic = marshalerMethod.getInvokeStatic(sootMethod.getDeclaringClass());
trampolines.add(invokestatic);
Variable handle = fn.newVariable(I64);
fn.add(new Ptrtoint(handle, destPtr, I64));
List<Value> args = new ArrayList<>();
args.add(env);
args.add(object);
args.add(handle.ref());
args.add(new IntegerConstant(flags));
args.addAll(arrayDimensionsValues(dimensions));
call(fn, invokestatic.getFunctionRef(), args);
}
use of org.robovm.compiler.llvm.Ptrtoint in project robovm by robovm.
the class BroMethodCompiler method marshalNativeToObject.
protected Value marshalNativeToObject(Function fn, MarshalerMethod marshalerMethod, MarshaledArg marshaledArg, Value env, String valueClassName, Value nativeValue, long flags) {
if (nativeValue.getType() instanceof StructureType) {
nativeValue = createStackCopy(fn, nativeValue);
}
Invokestatic invokestatic = marshalerMethod.getInvokeStatic(sootMethod.getDeclaringClass());
trampolines.add(invokestatic);
Value valueClass = ldcClass(fn, valueClassName, env);
Variable handle = fn.newVariable(I64);
fn.add(new Ptrtoint(handle, nativeValue, I64));
Value object = call(fn, invokestatic.getFunctionRef(), env, valueClass, handle.ref(), new IntegerConstant(flags));
if (marshaledArg != null) {
marshaledArg.handle = handle.ref();
marshaledArg.object = object;
}
return object;
}
Aggregations