Module tvix_eval::vm::generators
source ยท Expand description
This module implements generator logic for the VM. Generators are functions used during evaluation which can suspend their execution during their control flow, and request that the VM do something.
This is used to keep the VMโs stack size constant even when evaluating deeply nested recursive data structures.
We implement generators using the genawaiter
crate.
Structsยง
- This is a generator which stores its state on the heap.
Enumsยง
- GeneratorState ๐States that a generator can be in while being driven by the VM.
- Messages that can be sent from generators to the VM. In most cases, the VM will suspend the generator when receiving a message and enter some other frame to process the request.
- Responses returned to generators from the VM.
Functionsยง
- call_functor ๐Call the given value as if it was an attribute set containing a functor. The arguments must already be prepared on the stack when a generator frame from this function is invoked.
- check_equality ๐Ask the VM to compare two values for equality.
- emit_warning ๐Emit a fully constructed runtime warning.
- Emit a runtime warning with the span of the current generator.
- Helper function to provide type annotations which are otherwise difficult to infer.
- Call the given value as a callable. The argument(s) must already be prepared on the stack.
- Helper function to call the given value with the provided list of arguments. This uses the StackPush and Call messages under the hood.
- Deep-force any value and return the evaluated result from the VM.
- request_enter_lambda ๐Request that the VM enter the given lambda.
- Force any value and return the evaluated result from the VM.
- Request a lookup in the VMโs import cache.
- Request that the VM populate its input cache for the given path.
- Request that the VM open a std::io::Read for the specified file.
- request_path_exists ๐
- request_path_import ๐Request that the VM import the given path.
- request_read_dir ๐
- request_span ๐
- Request that the VM pop a value from the stack and return it to the generator.
- Request that the VM place the given value on its stack.
- request_to_json ๐
- request_try_force ๐Force a value
Type Aliasesยง
- Generator ๐