use of org.robovm.compiler.llvm.Unreachable in project robovm by robovm.
the class TrampolineCompiler method checkClassExists.
private boolean checkClassExists(Function f, Trampoline t) {
String targetClassName = t.getTarget();
if (isArray(targetClassName)) {
if (isPrimitiveBaseType(targetClassName)) {
return true;
}
targetClassName = getBaseType(targetClassName);
}
Clazz target = config.getClazzes().load(targetClassName);
if (target != null) {
Clazz caller = config.getClazzes().load(t.getCallingClass());
// If caller is in the bootclasspath it only sees classes in the bootclasspath
if (!caller.isInBootClasspath() || target.isInBootClasspath()) {
return true;
}
}
call(f, BC_THROW_NO_CLASS_DEF_FOUND_ERROR, f.getParameterRef(0), mb.getString(t.getTarget()));
f.add(new Unreachable());
return false;
}
use of org.robovm.compiler.llvm.Unreachable in project robovm by robovm.
the class TrampolineCompiler method throwNoSuchFieldError.
private void throwNoSuchFieldError(Function f, FieldAccessor accessor) {
call(f, BC_THROW_NO_SUCH_FIELD_ERROR, f.getParameterRef(0), mb.getString(String.format(NO_SUCH_FIELD_ERROR, accessor.getTarget().replace('/', '.'), accessor.getFieldName())));
f.add(new Unreachable());
}
use of org.robovm.compiler.llvm.Unreachable in project robovm by robovm.
the class MethodCompiler method throw_.
private void throw_(ThrowStmt stmt) {
Value obj = immediate(stmt, (Immediate) stmt.getOp());
checkNull(stmt, obj);
call(stmt, BC_THROW, env, obj);
function.add(new Unreachable()).attach(stmt);
}
use of org.robovm.compiler.llvm.Unreachable in project robovm by robovm.
the class AbstractMethodCompiler method compileSynchronizedWrapper.
private void compileSynchronizedWrapper(ModuleBuilder moduleBuilder, SootMethod method) {
String targetName = Symbols.methodSymbol(method);
Function syncFn = FunctionBuilder.synchronizedWrapper(method);
moduleBuilder.addFunction(syncFn);
FunctionType functionType = syncFn.getType();
FunctionRef target = new FunctionRef(targetName, functionType);
Value monitor = null;
if (method.isStatic()) {
FunctionRef fn = FunctionBuilder.ldcInternal(sootMethod.getDeclaringClass()).ref();
monitor = call(syncFn, fn, syncFn.getParameterRef(0));
} else {
monitor = syncFn.getParameterRef(1);
}
call(syncFn, MONITORENTER, syncFn.getParameterRef(0), monitor);
BasicBlockRef bbSuccess = syncFn.newBasicBlockRef(new Label("success"));
BasicBlockRef bbFailure = syncFn.newBasicBlockRef(new Label("failure"));
trycatchAllEnter(syncFn, bbSuccess, bbFailure);
syncFn.newBasicBlock(bbSuccess.getLabel());
Value result = call(syncFn, target, syncFn.getParameterRefs());
trycatchLeave(syncFn);
call(syncFn, MONITOREXIT, syncFn.getParameterRef(0), monitor);
syncFn.add(new Ret(result));
syncFn.newBasicBlock(bbFailure.getLabel());
trycatchLeave(syncFn);
call(syncFn, MONITOREXIT, syncFn.getParameterRef(0), monitor);
call(syncFn, BC_THROW_IF_EXCEPTION_OCCURRED, syncFn.getParameterRef(0));
syncFn.add(new Unreachable());
}
Aggregations