@SuppressWarnings("unused") @Unmanaged private static boolean isAssignableLowLevel(RuntimeClass from, RuntimeClass to) { return to.isSupertypeOf.apply(from); }
@Unmanaged private boolean isAssignableFromLowLevel(RuntimeClass other) { return Address.ofObject(this).<RuntimeClass>toStructure().isSupertypeOf.apply(other); }
@Unmanaged public static void throwException(Throwable exception) { thrownException = exception; RuntimeObject exceptionPtr = Address.ofObject(exception).toStructure(); RuntimeClass exceptionClass = RuntimeClass.getClass(exceptionPtr); Address stackFrame = ShadowStack.getStackTop(); stackLoop: while (stackFrame != null) { int callSiteId = ShadowStack.getCallSiteId(stackFrame); CallSite callSite = findCallSiteById(callSiteId); ExceptionHandler handler = callSite.firstHandler; for (int i = 0; i < callSite.handlerCount; ++i) { if (handler.exceptionClass == null || handler.exceptionClass.isSupertypeOf.apply(exceptionClass)) { ShadowStack.setExceptionHandlerId(stackFrame, handler.id); break stackLoop; } handler = Structure.add(ExceptionHandler.class, handler, 1); } ShadowStack.setExceptionHandlerId(stackFrame, callSiteId - 1); stackFrame = ShadowStack.getNextStackFrame(stackFrame); } }
@SuppressWarnings("unused") @Unmanaged private static boolean isAssignableLowLevel(RuntimeClass from, RuntimeClass to) { return to.isSupertypeOf.apply(from); }
@Unmanaged public static void throwException(Throwable exception) { thrownException = exception; RuntimeObject exceptionPtr = Address.ofObject(exception).toStructure(); RuntimeClass exceptionClass = RuntimeClass.getClass(exceptionPtr); Address stackFrame = ShadowStack.getStackTop(); stackLoop: while (stackFrame != null) { int callSiteId = ShadowStack.getCallSiteId(stackFrame); CallSite callSite = findCallSiteById(callSiteId); ExceptionHandler handler = callSite.firstHandler; for (int i = 0; i < callSite.handlerCount; ++i) { if (handler.exceptionClass == null || handler.exceptionClass.isSupertypeOf.apply(exceptionClass)) { ShadowStack.setExceptionHandlerId(stackFrame, handler.id); break stackLoop; } handler = Structure.add(ExceptionHandler.class, handler, 1); } ShadowStack.setExceptionHandlerId(stackFrame, callSiteId - 1); stackFrame = ShadowStack.getNextStackFrame(stackFrame); } }