From 1e37f8b52e3d42fed3e05b327ef30c83e97fd02a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 4 Mar 2023 00:52:37 +0300 Subject: feat(tvix/eval): give generators human-readable names 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 --- tvix/eval/src/value/builtin.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tvix/eval/src/value') diff --git a/tvix/eval/src/value/builtin.rs b/tvix/eval/src/value/builtin.rs index 0577111030..6d08ebf950 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) } -- cgit 1.4.1