Avail Runtime
An AvailRuntime comprises the modules, methods, and special objects that define an Avail system. It also manages global resources, such as file connections.
Author
Todd L Smith
Parameters
The module name resolver that this AvailRuntime should use to resolve unqualified module names.
The FileManager of the running Avail.
Types
An immutable state object that can atomically replace the current state in activeDiversionQueue via a compare-and-set (with retries).
A HookType describes an abstract missing behavior in the virtual machine, where an actual hook will have to be constructed to hold an A_Function within each separate AvailRuntime.
Properties
A call-out to allow tools like debuggers to intercept breakpoints. Only one breakpoint handler can be active for this runtime. The function will be invoked from within a safe point.
The class loader that should be used to locate and load Java classes.
The number of clock ticks since this runtime was created.
The ThreadPoolExecutor for running tasks and fibers of this AvailRuntime.
The collection of hooks for this runtime.
The module name resolver that this runtime should use to resolve unqualified module names.
A map of FiberKind to AtomicReference containing an optional function to invoke when a fiber (of that kind) is created and scheduled for the first time. This mechanism is used to capture new fibers in a debugger's list of fibers.
Determine whether any safe-point tasks have been queued for later.
Functions
Add a semantic restriction to the method associated with the given method name.
Allocate the next interpreter index in [0..maxInterpreters) thread-safely.
Assert that we're currently inside a safe point. This should only be checked while running a safe point task (good) or an interpreter task (should fail).
Answer this runtime's CallbackSystem.
Attempt to write the newValue into the specified newFiberHandlers, but only if it currently contains oldValue. Answer whether it wos successful. If it was not successful due to the oldValue not being the current value, make no change and answer false.
Schedule the specified task for eventual execution. The implementation is free to run the task immediately or delay its execution arbitrarily. The task is guaranteed to execute on an AvailThread.
Schedule the specified task for eventual execution. The implementation is free to run the task immediately or delay its execution arbitrarily. The task is guaranteed to execute on an Avail thread.
Extract the current A_Function for the given hook from this runtime.
Answer the function to invoke whenever a variable with write reactors is written when write tracing is not enabled.
Perform an integrity check on the parser data structures. Report the findings to System.out.
Answer my current A_Map of A_Modules. It's always Mutability.SHARED for safety.
Look up the given Java class name, and create a suitable Java POJO A_Type. Capture the classParameters, since the Avail POJO mechanism doesn't erase generics.
Look up the given Java class name, and create a suitable Java raw POJO for this raw Java class. The raw class does not capture type parameters.
Answer the Avail module roots.
Unbind the specified definition from the runtime system.
Remove a grammatical restriction from the method associated with the given method name.
Unbind the specified macro from the runtime system.
Remove a seal from the method associated with the given method name.
Remove a semantic restriction from the method associated with the given method name.
Schedule resumption of the specified fiber following suspension by a failed primitive. This method is an entry point.
Schedule resumption of the specified fiber following suspension due to an interrupt. This method is an entry point.
Schedule resumption of the specified fiber following suspension by a successful primitive. This method is an entry point.
Schedule the specified fiber to run the given function. This function is invoked via the HookType.BASE_FRAME hook, or if the fiber might be debugged, via the HookType.DEBUGGABLE_BASE_FRAME hook. The fiber must be in the unstarted state. This Kotlin method is an entry point for driving Avail externally.
Set the given hook's function for this runtime.
Set the runtime's default text interface.
Stringify a list of Avail, using the HookType.STRINGIFICATION hook associated with the specified runtime. Stringification will run in parallel, with each value being processed by its own new fiber. If stringification fails for a value for any reason, then the built-in mechanism, available via AvailObject.toString will be used for that value. Invoke the specified continuation with the resulting list, preserving the original order.
Stringify an AvailObject, using the HookType.STRINGIFICATION hook in the specified AvailRuntime. Stringification will run in a new fiber. If stringification fails for any reason, then the built-in mechanism, available via AvailObject.toString will be used. Invoke the specified continuation with the result.
Answer the runtime's default text interface.
Answer the function to invoke whenever an unassigned variable is read.
Remove the specified module from this runtime. The module's code should already have been removed via A_Module.removeFrom.
Remove the specified fiber from this runtime. This should be done explicitly when a fiber retires, although the fact that allFibers wraps a WeakHashMap ensures that fibers that are no longer referenced will still be cleaned up at some point.
Request that the specified action be executed when interpreter tasks are allowed to run. If there are any postponed safe-point tasks, that means we're either in or waiting for a safe-point to be reached, so don't start another interpreter task – queue it instead.
Request that the specified action be executed at the next safe-point. No interpreter tasks are running at a safe-point.