Utilities
Overview
Helper classes for the compiler.
Location
- Reference: Island.fx
- Namespace: RemObjects.Elements.System
constructor protected
constructor
Utilities()
init()
Utilities()
Sub New()
AbstractCall
class method AbstractCall
static void AbstractCall()
static func AbstractCall()
static void AbstractCall()
Shared Sub AbstractCall()
CalcHash
calculate the hash of a byte buffer; used by the String type.
Parameters:
- buf:
- len:
CreateDivideByZeroException
Creates a divide by zero exception and returns it. Used by the compiler to trigger this exception.
class method CreateDivideByZeroException: Exception
static Exception CreateDivideByZeroException()
static func CreateDivideByZeroException() -> Exception
static Exception CreateDivideByZeroException()
Shared Function CreateDivideByZeroException() As Exception
CreateIndexOutOfRangeException
Creates an index out of range exception and returns it. Used by the compiler to trigger this exception.
class method CreateIndexOutOfRangeException(aIndex: NativeUInt; aMax: NativeUInt): Exception
static Exception CreateIndexOutOfRangeException(NativeUInt aIndex, NativeUInt aMax)
static func CreateIndexOutOfRangeException(_ aIndex: NativeUInt, _ aMax: NativeUInt) -> Exception
static Exception CreateIndexOutOfRangeException(NativeUInt aIndex, NativeUInt aMax)
Shared Function CreateIndexOutOfRangeException(aIndex As NativeUInt, aMax As NativeUInt) As Exception
Parameters:
- aIndex:
- aMax:
CreateInvalidCastException
Creates an invalid cast exception and returns it. Used by the compiler to trigger this exception.
class method CreateInvalidCastException: Exception
static Exception CreateInvalidCastException()
static func CreateInvalidCastException() -> Exception
static Exception CreateInvalidCastException()
Shared Function CreateInvalidCastException() As Exception
CreateNullReferenceException
Creates a null reference exception and returns it. Used by the compiler to trigger this exception.
class method CreateNullReferenceException: Exception
static Exception CreateNullReferenceException()
static func CreateNullReferenceException() -> Exception
static Exception CreateNullReferenceException()
Shared Function CreateNullReferenceException() As Exception
CreateNullReferenceExceptionEx
Creates a null reference exception with information on what was null and returns it. Used by the compiler to trigger this exception.
Parameters:
- s:
DebugInvoke
class method DebugInvoke(data: ^void; invk: DebugInvokeCallback; ex: DebugExceptionCallback)
static void DebugInvoke(void* data, DebugInvokeCallback invk, DebugExceptionCallback ex)
static func DebugInvoke(_ data: UnsafeMutablePointer<void>, _ invk: DebugInvokeCallback, _ ex: DebugExceptionCallback)
static void DebugInvoke(void* data, DebugInvokeCallback invk, DebugExceptionCallback ex)
Shared Sub DebugInvoke(data As Ptr(Of Void), invk As DebugInvokeCallback, ex As DebugExceptionCallback)
Parameters:
- data:
- invk:
- ex:
Equals virtual (declared in Object)
Default constructor.
Parameters:
- aOther: the reference to compare this with.
Finalize protected virtual (declared in Object)
method Finalize
void Finalize()
func Finalize()
void Finalize()
Sub Finalize()
FinalizerIndex
Contains the index of the finalizer in the VMT, based on the size of pointers.
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
const FinalizerIndex: Int32 = 6;
// Android-x86, WebAssembly, Windows-i386
const FinalizerIndex: Int32 = 8;
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
const Int32 FinalizerIndex = 6
// Android-x86, WebAssembly, Windows-i386
const Int32 FinalizerIndex = 8
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
static let FinalizerIndex: Int32 = 6
// Android-x86, WebAssembly, Windows-i386
static let FinalizerIndex: Int32 = 8
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
static final Int32 FinalizerIndex = 6
// Android-x86, WebAssembly, Windows-i386
static final Int32 FinalizerIndex = 8
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
Dim FinalizerIndex As Int32 = 6
// Android-x86, WebAssembly, Windows-i386
Dim FinalizerIndex As Int32 = 8
GetCocoaObjectToString iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, visionOS, visionOS Simulator, watchOS, watchOS Simulator
Converts a Cocoa object to a string and return the utf16 string pointer value of it. Used by the debugger.
Parameters:
- aObj:
GetHashCode virtual (declared in Object)
Returns a hashcode for this object. Overriden implementations should make sure that the number returned here is constant given the same object.
method GetHashCode: Int32
Int32 GetHashCode()
func GetHashCode() -> Int32
Int32 GetHashCode()
Function GetHashCode() As Int32
GetObjectToString
Converts a Island object to a string and return the utf16 string pointer value of it. Used by the debugger.
Parameters:
- aObj:
GetObjectTypeName
Converts the type of an Island object to a string and return the utf16 string pointer value of it. Used by the debugger.
Parameters:
- aObj:
GetReturnAddress External
Returns the return address of this call. Maps to llvm.returnaddress.
class method GetReturnAddress(aLevel: Int32): ^void
static void* GetReturnAddress(Int32 aLevel)
static func GetReturnAddress(_ aLevel: Int32) -> UnsafeMutablePointer<void>
static void* GetReturnAddress(Int32 aLevel)
Shared Function GetReturnAddress(aLevel As Int32) As Ptr(Of Void)
Parameters:
- aLevel:
GetType (declared in Object)
Returns the actual type of this class
method GetType: Type
Type GetType()
func GetType() -> Type
Type GetType()
Function GetType() As Type
Initialize
class method Initialize
static void Initialize()
static func Initialize()
static void Initialize()
Shared Sub Initialize()
IsInstance
Used by the compiler to check if a type is an instance of a specific class (not interface).
Parameters:
- aInstance:
- aType:
IsInterfaceInstance
Used by the compiler to check if a type is an instance of a specific interface (not class).
Parameters:
- aInstance:
- aType:
- aHashCode:
NewArray
Creates a new array of the specific size. aTy should point to the concrete array type, not the element type.
Parameters:
- aTY:
- aElementSize:
- aElements:
NewDelegate
Creates a new delegate given a type, a Self pointer and a method pointer.
Parameters:
- aTY:
- aSelf:
- aPtr:
ReferenceEquals (declared in Object)
Compares two references for equivalence (even if they have an equals operator)
Parameters:
- a: left value
- b: right value
RegisterThread
class method RegisterThread
static void RegisterThread()
static func RegisterThread()
static void RegisterThread()
Shared Sub RegisterThread()
RegisterThreadHandlers
class method RegisterThreadHandlers(aRegister: Action; aUnregister: Action)
static void RegisterThreadHandlers(Action aRegister, Action aUnregister)
static func RegisterThreadHandlers(_ aRegister: Action, _ aUnregister: Action)
static void RegisterThreadHandlers(Action aRegister, Action aUnregister)
Shared Sub RegisterThreadHandlers(aRegister As Action, aUnregister As Action)
Parameters:
- aRegister:
- aUnregister:
SpinLockClassEnter
This is used by the class constructor code to decide if it should run the class constructor; this returns true if the class constructor, false if it should not.
The integer value passed should default to 0. If it's 0, it (safely) initializes it to the current thread id, until SpinLockClassExit is called, which sets it to -1. If the value at the time of entry is the current thread id, it returns false (it's already running and we're calling it recursively). If it's any other value the class constructor is already running in another thread, so does a spin lock loop, with yields, until that thread is done.
Parameters:
- x:
SpinLockClassExit
class method SpinLockClassExit(var x: NativeInt)
static void SpinLockClassExit(ref NativeInt x)
static func SpinLockClassExit(_ x: NativeInt)
static void SpinLockClassExit(__ref NativeInt x)
Shared Sub SpinLockClassExit(ByRef x As NativeInt)
Parameters:
- x:
SpinLockEnter
class method SpinLockEnter(var x: Int32)
static void SpinLockEnter(ref Int32 x)
static func SpinLockEnter(_ x: Int32)
static void SpinLockEnter(__ref Int32 x)
Shared Sub SpinLockEnter(ByRef x As Int32)
Parameters:
- x:
SpinLockExit
class method SpinLockExit(var x: Int32)
static void SpinLockExit(ref Int32 x)
static func SpinLockExit(_ x: Int32)
static void SpinLockExit(__ref Int32 x)
Shared Sub SpinLockExit(ByRef x As Int32)
Parameters:
- x:
ToString virtual (declared in Object)
Gets the string representation of this method.
method ToString: String
String ToString()
func ToString() -> String
String ToString()
Function ToString() As String
UnregisterThread
class method UnregisterThread
static void UnregisterThread()
static func UnregisterThread()
static void UnregisterThread()
Shared Sub UnregisterThread()
FinalizerIndex
Contains the index of the finalizer in the VMT, based on the size of pointers.
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
const FinalizerIndex: Int32 = 6;
// Android-x86, WebAssembly, Windows-i386
const FinalizerIndex: Int32 = 8;
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
const Int32 FinalizerIndex = 6
// Android-x86, WebAssembly, Windows-i386
const Int32 FinalizerIndex = 8
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
static let FinalizerIndex: Int32 = 6
// Android-x86, WebAssembly, Windows-i386
static let FinalizerIndex: Int32 = 8
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
static final Int32 FinalizerIndex = 6
// Android-x86, WebAssembly, Windows-i386
static final Int32 FinalizerIndex = 8
// Android-arm64-v8a, Android-armeabi, Android-armeabi-v7a, Android-x86_64, Fuchsia, iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, Ubuntu, visionOS, visionOS Simulator, watchOS, watchOS Simulator, Windows-arm64, Windows-x86_64
Dim FinalizerIndex As Int32 = 6
// Android-x86, WebAssembly, Windows-i386
Dim FinalizerIndex As Int32 = 8
AbstractCall
class method AbstractCall
static void AbstractCall()
static func AbstractCall()
static void AbstractCall()
Shared Sub AbstractCall()
CalcHash
calculate the hash of a byte buffer; used by the String type.
Parameters:
- buf:
- len:
CreateDivideByZeroException
Creates a divide by zero exception and returns it. Used by the compiler to trigger this exception.
class method CreateDivideByZeroException: Exception
static Exception CreateDivideByZeroException()
static func CreateDivideByZeroException() -> Exception
static Exception CreateDivideByZeroException()
Shared Function CreateDivideByZeroException() As Exception
CreateIndexOutOfRangeException
Creates an index out of range exception and returns it. Used by the compiler to trigger this exception.
class method CreateIndexOutOfRangeException(aIndex: NativeUInt; aMax: NativeUInt): Exception
static Exception CreateIndexOutOfRangeException(NativeUInt aIndex, NativeUInt aMax)
static func CreateIndexOutOfRangeException(_ aIndex: NativeUInt, _ aMax: NativeUInt) -> Exception
static Exception CreateIndexOutOfRangeException(NativeUInt aIndex, NativeUInt aMax)
Shared Function CreateIndexOutOfRangeException(aIndex As NativeUInt, aMax As NativeUInt) As Exception
Parameters:
- aIndex:
- aMax:
CreateInvalidCastException
Creates an invalid cast exception and returns it. Used by the compiler to trigger this exception.
class method CreateInvalidCastException: Exception
static Exception CreateInvalidCastException()
static func CreateInvalidCastException() -> Exception
static Exception CreateInvalidCastException()
Shared Function CreateInvalidCastException() As Exception
CreateNullReferenceException
Creates a null reference exception and returns it. Used by the compiler to trigger this exception.
class method CreateNullReferenceException: Exception
static Exception CreateNullReferenceException()
static func CreateNullReferenceException() -> Exception
static Exception CreateNullReferenceException()
Shared Function CreateNullReferenceException() As Exception
CreateNullReferenceExceptionEx
Creates a null reference exception with information on what was null and returns it. Used by the compiler to trigger this exception.
Parameters:
- s:
DebugInvoke
class method DebugInvoke(data: ^void; invk: DebugInvokeCallback; ex: DebugExceptionCallback)
static void DebugInvoke(void* data, DebugInvokeCallback invk, DebugExceptionCallback ex)
static func DebugInvoke(_ data: UnsafeMutablePointer<void>, _ invk: DebugInvokeCallback, _ ex: DebugExceptionCallback)
static void DebugInvoke(void* data, DebugInvokeCallback invk, DebugExceptionCallback ex)
Shared Sub DebugInvoke(data As Ptr(Of Void), invk As DebugInvokeCallback, ex As DebugExceptionCallback)
Parameters:
- data:
- invk:
- ex:
GetCocoaObjectToString iOS, iOS Simulator, Mac Catalyst, macOS, tvOS, tvOS Simulator, visionOS, visionOS Simulator, watchOS, watchOS Simulator
Converts a Cocoa object to a string and return the utf16 string pointer value of it. Used by the debugger.
Parameters:
- aObj:
GetObjectToString
Converts a Island object to a string and return the utf16 string pointer value of it. Used by the debugger.
Parameters:
- aObj:
GetObjectTypeName
Converts the type of an Island object to a string and return the utf16 string pointer value of it. Used by the debugger.
Parameters:
- aObj:
GetReturnAddress External
Returns the return address of this call. Maps to llvm.returnaddress.
class method GetReturnAddress(aLevel: Int32): ^void
static void* GetReturnAddress(Int32 aLevel)
static func GetReturnAddress(_ aLevel: Int32) -> UnsafeMutablePointer<void>
static void* GetReturnAddress(Int32 aLevel)
Shared Function GetReturnAddress(aLevel As Int32) As Ptr(Of Void)
Parameters:
- aLevel:
Initialize
class method Initialize
static void Initialize()
static func Initialize()
static void Initialize()
Shared Sub Initialize()
IsInstance
Used by the compiler to check if a type is an instance of a specific class (not interface).
Parameters:
- aInstance:
- aType:
IsInterfaceInstance
Used by the compiler to check if a type is an instance of a specific interface (not class).
Parameters:
- aInstance:
- aType:
- aHashCode:
NewArray
Creates a new array of the specific size. aTy should point to the concrete array type, not the element type.
Parameters:
- aTY:
- aElementSize:
- aElements:
NewDelegate
Creates a new delegate given a type, a Self pointer and a method pointer.
Parameters:
- aTY:
- aSelf:
- aPtr:
ReferenceEquals (declared in Object)
Compares two references for equivalence (even if they have an equals operator)
Parameters:
- a: left value
- b: right value
RegisterThread
class method RegisterThread
static void RegisterThread()
static func RegisterThread()
static void RegisterThread()
Shared Sub RegisterThread()
RegisterThreadHandlers
class method RegisterThreadHandlers(aRegister: Action; aUnregister: Action)
static void RegisterThreadHandlers(Action aRegister, Action aUnregister)
static func RegisterThreadHandlers(_ aRegister: Action, _ aUnregister: Action)
static void RegisterThreadHandlers(Action aRegister, Action aUnregister)
Shared Sub RegisterThreadHandlers(aRegister As Action, aUnregister As Action)
Parameters:
- aRegister:
- aUnregister:
SpinLockClassEnter
This is used by the class constructor code to decide if it should run the class constructor; this returns true if the class constructor, false if it should not.
The integer value passed should default to 0. If it's 0, it (safely) initializes it to the current thread id, until SpinLockClassExit is called, which sets it to -1. If the value at the time of entry is the current thread id, it returns false (it's already running and we're calling it recursively). If it's any other value the class constructor is already running in another thread, so does a spin lock loop, with yields, until that thread is done.
Parameters:
- x:
SpinLockClassExit
class method SpinLockClassExit(var x: NativeInt)
static void SpinLockClassExit(ref NativeInt x)
static func SpinLockClassExit(_ x: NativeInt)
static void SpinLockClassExit(__ref NativeInt x)
Shared Sub SpinLockClassExit(ByRef x As NativeInt)
Parameters:
- x:
SpinLockEnter
class method SpinLockEnter(var x: Int32)
static void SpinLockEnter(ref Int32 x)
static func SpinLockEnter(_ x: Int32)
static void SpinLockEnter(__ref Int32 x)
Shared Sub SpinLockEnter(ByRef x As Int32)
Parameters:
- x:
SpinLockExit
class method SpinLockExit(var x: Int32)
static void SpinLockExit(ref Int32 x)
static func SpinLockExit(_ x: Int32)
static void SpinLockExit(__ref Int32 x)
Shared Sub SpinLockExit(ByRef x As Int32)
Parameters:
- x:
UnregisterThread
class method UnregisterThread
static void UnregisterThread()
static func UnregisterThread()
static void UnregisterThread()
Shared Sub UnregisterThread()
constructor protected
constructor
Utilities()
init()
Utilities()
Sub New()
Equals virtual (declared in Object)
Default constructor.
Parameters:
- aOther: the reference to compare this with.
Finalize protected virtual (declared in Object)
method Finalize
void Finalize()
func Finalize()
void Finalize()
Sub Finalize()
GetHashCode virtual (declared in Object)
Returns a hashcode for this object. Overriden implementations should make sure that the number returned here is constant given the same object.
method GetHashCode: Int32
Int32 GetHashCode()
func GetHashCode() -> Int32
Int32 GetHashCode()
Function GetHashCode() As Int32
GetType (declared in Object)
Returns the actual type of this class
method GetType: Type
Type GetType()
func GetType() -> Type
Type GetType()
Function GetType() As Type
ToString virtual (declared in Object)
Gets the string representation of this method.