Search in sources :

Example 1 with Ptrtoint

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();
}
Also used : Variable(org.robovm.compiler.llvm.Variable) Ptrtoint(org.robovm.compiler.llvm.Ptrtoint)

Example 2 with Ptrtoint

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);
}
Also used : Invokestatic(org.robovm.compiler.trampoline.Invokestatic) Variable(org.robovm.compiler.llvm.Variable) Ptrtoint(org.robovm.compiler.llvm.Ptrtoint) Value(org.robovm.compiler.llvm.Value) ArrayList(java.util.ArrayList) IntegerConstant(org.robovm.compiler.llvm.IntegerConstant)

Example 3 with Ptrtoint

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);
}
Also used : Invokestatic(org.robovm.compiler.trampoline.Invokestatic) Variable(org.robovm.compiler.llvm.Variable) Ptrtoint(org.robovm.compiler.llvm.Ptrtoint) ArrayList(java.util.ArrayList) Value(org.robovm.compiler.llvm.Value) IntegerConstant(org.robovm.compiler.llvm.IntegerConstant)

Example 4 with Ptrtoint

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;
}
Also used : Invokestatic(org.robovm.compiler.trampoline.Invokestatic) Variable(org.robovm.compiler.llvm.Variable) Ptrtoint(org.robovm.compiler.llvm.Ptrtoint) StructureType(org.robovm.compiler.llvm.StructureType) Value(org.robovm.compiler.llvm.Value) IntegerConstant(org.robovm.compiler.llvm.IntegerConstant)

Aggregations

Ptrtoint (org.robovm.compiler.llvm.Ptrtoint)4 Variable (org.robovm.compiler.llvm.Variable)4 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)3 Value (org.robovm.compiler.llvm.Value)3 Invokestatic (org.robovm.compiler.trampoline.Invokestatic)3 ArrayList (java.util.ArrayList)2 StructureType (org.robovm.compiler.llvm.StructureType)1