about summary refs log tree commit diff
path: root/tvix/glue/src/builtins
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-02-10T17·39-0500
committerclbot <clbot@tvl.fyi>2024-02-13T16·49+0000
commit7e286aab1a573edc9aef16bb68e9907371917adc (patch)
treef3e9aeb1ac674800ed13dbb0bfacddfb50dd372e /tvix/glue/src/builtins
parentdd261773192d0928571f806892d8065fbba1cf2d (diff)
feat(tvix/eval): Box Value::Catchable r/7508
This is now the only enum variant for Value that is larger than 8
bytes (it's 16 bytes), so boxing it (especially since it's not
perf-critical) allows us to get the Value size down to only 16 bytes!

Change-Id: I98598e2b762944448bef982e8ff7da6d6683c4aa
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10798
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: aspen <root@gws.fyi>
Diffstat (limited to 'tvix/glue/src/builtins')
-rw-r--r--tvix/glue/src/builtins/derivation.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/tvix/glue/src/builtins/derivation.rs b/tvix/glue/src/builtins/derivation.rs
index 299d064c40d6..efcacd8310cd 100644
--- a/tvix/glue/src/builtins/derivation.rs
+++ b/tvix/glue/src/builtins/derivation.rs
@@ -248,7 +248,7 @@ pub(crate) mod derivation_builtins {
                 "args" => {
                     for arg in value.to_list()? {
                         match strong_importing_coerce_to_string(&co, arg).await {
-                            Err(cek) => return Ok(Value::Catchable(cek)),
+                            Err(cek) => return Ok(Value::from(cek)),
                             Ok(s) => {
                                 input_context.mimic(&s);
                                 drv.arguments.push(s.to_str()?.to_owned())
@@ -299,7 +299,7 @@ pub(crate) mod derivation_builtins {
                 // handle builder and system.
                 "builder" | "system" => {
                     match strong_importing_coerce_to_string(&co, value).await {
-                        Err(cek) => return Ok(Value::Catchable(cek)),
+                        Err(cek) => return Ok(Value::from(cek)),
                         Ok(val_str) => {
                             input_context.mimic(&val_str);
 
@@ -334,7 +334,7 @@ pub(crate) mod derivation_builtins {
                     // In non-SA case, coerce to string and add to env.
                     if let Some(ref mut structured_attrs) = structured_attrs {
                         let val = generators::request_force(&co, value).await;
-                        if matches!(val, Value::Catchable(_)) {
+                        if val.is_catchable() {
                             return Ok(val);
                         }
 
@@ -343,14 +343,14 @@ pub(crate) mod derivation_builtins {
 
                         let val_json = match val.into_json(&co).await? {
                             Ok(v) => v,
-                            Err(cek) => return Ok(Value::Catchable(cek)),
+                            Err(cek) => return Ok(Value::from(cek)),
                         };
 
                         // No need to check for dups, we only iterate over every attribute name once
                         structured_attrs.insert(arg_name.to_owned(), val_json);
                     } else {
                         match strong_importing_coerce_to_string(&co, value).await {
-                            Err(cek) => return Ok(Value::Catchable(cek)),
+                            Err(cek) => return Ok(Value::from(cek)),
                             Ok(val_str) => {
                                 input_context.mimic(&val_str);
 
@@ -384,21 +384,21 @@ pub(crate) mod derivation_builtins {
                 .await
                 .context("evaluating the `outputHash` parameter")?
             {
-                Err(cek) => return Ok(Value::Catchable(cek)),
+                Err(cek) => return Ok(Value::from(cek)),
                 Ok(s) => s,
             };
             let output_hash_algo = match select_string(&co, &input, "outputHashAlgo")
                 .await
                 .context("evaluating the `outputHashAlgo` parameter")?
             {
-                Err(cek) => return Ok(Value::Catchable(cek)),
+                Err(cek) => return Ok(Value::from(cek)),
                 Ok(s) => s,
             };
             let output_hash_mode = match select_string(&co, &input, "outputHashMode")
                 .await
                 .context("evaluating the `outputHashMode` parameter")?
             {
-                Err(cek) => return Ok(Value::Catchable(cek)),
+                Err(cek) => return Ok(Value::from(cek)),
                 Ok(s) => s,
             };