about summary refs log tree commit diff
path: root/tvix/eval/src/value/builtin.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-03-03T21·52+0300
committertazjin <tazjin@tvl.su>2023-03-13T20·30+0000
commit1e37f8b52e3d42fed3e05b327ef30c83e97fd02a (patch)
treec05ece48e6d2d01d27694ee0949629616bdec611 /tvix/eval/src/value/builtin.rs
parentdfd0066de5f0616673f8e6cef4c6bed312e98d1e (diff)
feat(tvix/eval): give generators human-readable names r/5978
This adds static strings to generator frames that describe the
generator in a human-readable fashion, which are then logged in
observers.

This makes runtime traces very precise, explaining exactly what is
being requested from where.

Change-Id: I695659a6bd0b7b0bdee75bc8049651f62b150e0c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8206
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/eval/src/value/builtin.rs')
-rw-r--r--tvix/eval/src/value/builtin.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/value/builtin.rs b/tvix/eval/src/value/builtin.rs
index 0577111030a2..6d08ebf9506d 100644
--- a/tvix/eval/src/value/builtin.rs
+++ b/tvix/eval/src/value/builtin.rs
@@ -41,7 +41,7 @@ pub enum BuiltinResult {
     Partial(Builtin),
 
     /// Builtin was called and constructed a generator that the VM must run.
-    Called(Generator),
+    Called(&'static str, Generator),
 }
 
 /// Represents a single built-in function which directly executes Rust
@@ -105,7 +105,7 @@ impl Builtin {
     /// applied or return the builtin if it is partially applied.
     pub fn call(self) -> BuiltinResult {
         if self.0.partials.len() == self.0.arg_count {
-            BuiltinResult::Called((self.0.func)(self.0.partials))
+            BuiltinResult::Called(self.0.name, (self.0.func)(self.0.partials))
         } else {
             BuiltinResult::Partial(self)
         }