@Unmanaged private void setSimpleNameCacheLowLevel(RuntimeObject object) { Address.ofObject(this).<RuntimeClass>toStructure().simpleName = object; }
@Unmanaged @PluggableDependency(ClassDependencyListener.class) private RuntimeObject getSimpleNameCacheLowLevel() { return Address.ofObject(this).<RuntimeClass>toStructure().simpleName; }
@Unmanaged private boolean isAssignableFromLowLevel(RuntimeClass other) { return Address.ofObject(this).<RuntimeClass>toStructure().isSupertypeOf.apply(other); }
public static Address lookupResource(Address map, String string) { RuntimeString runtimeString = Address.ofObject(string).toStructure(); int hashCode = hashCode(runtimeString); int sz = map.getInt(); Address content = contentStart(map); for (int i = 0; i < sz; ++i) { int index = (hashCode + i) % sz; if (index < 0) { index += sz; } Address entry = content.add(index * Address.sizeOf() * 2); Address key = entry.getAddress(); if (key == null) { return null; } if (equals(key.toStructure(), runtimeString)) { return entry; } } return null; }
@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); } }
@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); } }