Search in sources :

Example 6 with Store

use of org.robovm.compiler.llvm.Store in project robovm by robovm.

the class Functions method trycatchAllEnter.

public static void trycatchAllEnter(Function fn, Value env, BasicBlockRef onNoException, BasicBlockRef onException) {
    Variable ctx = fn.newVariable(TRYCATCH_CONTEXT_PTR);
    fn.add(new Alloca(ctx, TRYCATCH_CONTEXT));
    Variable selPtr = fn.newVariable(new PointerType(I32));
    fn.add(new Getelementptr(selPtr, ctx.ref(), 0, 1));
    fn.add(new Store(new IntegerConstant(-1), selPtr.ref()));
    Value result = call(fn, RVM_TRYCATCH_ENTER, env, ctx.ref());
    fn.add(new Switch(result, onException, new IntegerConstant(0), onNoException));
}
Also used : Variable(org.robovm.compiler.llvm.Variable) Alloca(org.robovm.compiler.llvm.Alloca) Switch(org.robovm.compiler.llvm.Switch) Value(org.robovm.compiler.llvm.Value) Store(org.robovm.compiler.llvm.Store) PointerType(org.robovm.compiler.llvm.PointerType) Getelementptr(org.robovm.compiler.llvm.Getelementptr) IntegerConstant(org.robovm.compiler.llvm.IntegerConstant)

Example 7 with Store

use of org.robovm.compiler.llvm.Store in project robovm by robovm.

the class BroMethodCompiler method storeValueForSetter.

protected void storeValueForSetter(SootMethod method, Function function, Type memberType, Value memberPtr, Value env, Value value, long flags) {
    soot.Type type = method.getParameterType(0);
    if (needsMarshaler(type)) {
        MarshalerMethod marshalerMethod = config.getMarshalerLookup().findMarshalerMethod(new MarshalSite(method, 0));
        if (memberType instanceof PrimitiveType) {
            value = marshalValueObjectToNative(function, marshalerMethod, memberType, env, value, flags);
        } else {
            if (memberType instanceof StructureType || memberType instanceof ArrayType) {
                // The parameter must not be null. We assume that Structs 
                // never have a NULL handle so we just check that the Java
                // Object isn't null.
                call(function, CHECK_NULL, env, value);
            }
            if (memberType instanceof ArrayType) {
                // Array
                marshalArrayToNative(function, marshalerMethod, env, value, memberPtr, flags, getArrayDimensions(method, 0));
                value = null;
            } else {
                value = marshalObjectToNative(function, marshalerMethod, null, memberType, env, value, flags);
            }
        }
    } else {
        value = marshalPrimitiveToNative(function, method, 0, value);
    }
    if (value != null) {
        function.add(new Store(value, memberPtr));
    }
}
Also used : MarshalSite(org.robovm.compiler.MarshalerLookup.MarshalSite) ArrayType(org.robovm.compiler.llvm.ArrayType) StructureType(org.robovm.compiler.llvm.StructureType) Store(org.robovm.compiler.llvm.Store) PrimitiveType(org.robovm.compiler.llvm.PrimitiveType) MarshalerMethod(org.robovm.compiler.MarshalerLookup.MarshalerMethod) ValueMarshalerMethod(org.robovm.compiler.MarshalerLookup.ValueMarshalerMethod) ArrayMarshalerMethod(org.robovm.compiler.MarshalerLookup.ArrayMarshalerMethod)

Aggregations

Store (org.robovm.compiler.llvm.Store)7 Value (org.robovm.compiler.llvm.Value)5 Variable (org.robovm.compiler.llvm.Variable)5 Getelementptr (org.robovm.compiler.llvm.Getelementptr)4 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)4 PointerType (org.robovm.compiler.llvm.PointerType)4 Alloca (org.robovm.compiler.llvm.Alloca)3 ArrayType (org.robovm.compiler.llvm.ArrayType)3 Bitcast (org.robovm.compiler.llvm.Bitcast)3 ConstantBitcast (org.robovm.compiler.llvm.ConstantBitcast)3 Ret (org.robovm.compiler.llvm.Ret)3 ArrayList (java.util.ArrayList)2 Call (org.robovm.compiler.llvm.Call)2 FloatingPointType (org.robovm.compiler.llvm.FloatingPointType)2 FunctionType (org.robovm.compiler.llvm.FunctionType)2 IntegerType (org.robovm.compiler.llvm.IntegerType)2 Load (org.robovm.compiler.llvm.Load)2 Type (org.robovm.compiler.llvm.Type)2 CharType (soot.CharType)2 Local (soot.Local)2