use of org.robovm.compiler.trampoline.Invokestatic in project robovm by robovm.
the class BridgeMethodCompiler method updateObject.
private void updateObject(SootMethod method, Function fn, Value env, long flags, List<MarshaledArg> marshaledArgs) {
for (MarshaledArg value : marshaledArgs) {
MarshalerMethod marshalerMethod = config.getMarshalerLookup().findMarshalerMethod(new MarshalSite(method, value.paramIndex));
SootMethod afterMethod = ((PointerMarshalerMethod) marshalerMethod).getAfterBridgeCallMethod();
if (afterMethod != null) {
Invokestatic invokestatic = new Invokestatic(getInternalName(method.getDeclaringClass()), getInternalName(afterMethod.getDeclaringClass()), afterMethod.getName(), getDescriptor(afterMethod));
trampolines.add(invokestatic);
call(fn, invokestatic.getFunctionRef(), env, value.object, value.handle, new IntegerConstant(flags));
}
}
}
use of org.robovm.compiler.trampoline.Invokestatic in project robovm by robovm.
the class CallbackMethodCompiler method updateNative.
private void updateNative(SootMethod method, Function fn, Value env, long flags, List<MarshaledArg> marshaledArgs) {
for (MarshaledArg value : marshaledArgs) {
MarshalerMethod marshalerMethod = config.getMarshalerLookup().findMarshalerMethod(new MarshalSite(method, value.paramIndex));
SootMethod afterMethod = ((PointerMarshalerMethod) marshalerMethod).getAfterCallbackCallMethod();
if (afterMethod != null) {
Invokestatic invokestatic = new Invokestatic(getInternalName(method.getDeclaringClass()), getInternalName(afterMethod.getDeclaringClass()), afterMethod.getName(), getDescriptor(afterMethod));
trampolines.add(invokestatic);
call(fn, invokestatic.getFunctionRef(), env, value.handle, value.object, new IntegerConstant(flags));
}
}
}
use of org.robovm.compiler.trampoline.Invokestatic 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.trampoline.Invokestatic 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