about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--corp/tvixbolt/Cargo.toml1
-rw-r--r--corp/tvixbolt/src/main.rs24
2 files changed, 12 insertions, 13 deletions
diff --git a/corp/tvixbolt/Cargo.toml b/corp/tvixbolt/Cargo.toml
index 123d49e109b4..5b5e955efcda 100644
--- a/corp/tvixbolt/Cargo.toml
+++ b/corp/tvixbolt/Cargo.toml
@@ -17,4 +17,3 @@ rev = "97b438e34be5211a4b48aeed9cc3ded489b4d6da"
 [dependencies.tvix-eval]
 path = "../tvix-eval/tvix/eval"
 default-features = false
-features = [ "disassembler" ]
diff --git a/corp/tvixbolt/src/main.rs b/corp/tvixbolt/src/main.rs
index 9ed79aa0da82..122a84e0ac6a 100644
--- a/corp/tvixbolt/src/main.rs
+++ b/corp/tvixbolt/src/main.rs
@@ -1,4 +1,7 @@
-use std::{fmt::Write, rc::Rc};
+use std::fmt::Write;
+
+use std::rc::Rc;
+use tvix_eval::observer::DisassemblingObserver;
 use web_sys::HtmlTextAreaElement;
 use yew::prelude::*;
 use yew::TargetCast;
@@ -107,7 +110,7 @@ impl Output {
 fn eval(code: &str) -> Output {
     let mut out = Output::default();
 
-    if code == "" {
+    if code.is_empty() {
         return out;
     }
 
@@ -131,21 +134,18 @@ fn eval(code: &str) -> Output {
         .expr()
         .expect("expression should exist if no errors occured");
 
-    let mut result = tvix_eval::compiler::compile(
+    let codemap = Rc::new(codemap);
+    let mut compilation_observer = DisassemblingObserver::new(codemap, &mut out.bytecode);
+
+    let result = tvix_eval::compile(
         root_expr,
         Some("/nixbolt".into()),
         &file,
-        tvix_eval::builtins::global_builtins(),
-        Rc::new(codemap),
+        tvix_eval::global_builtins(),
+        &mut compilation_observer,
     )
     .unwrap();
 
-    let lambda = Rc::new(result.lambda);
-
-    tvix_eval::disassembler::disassemble_lambda(&mut out.bytecode, lambda.clone());
-
-    out.bytecode.append(&mut result.output);
-
     for warning in result.warnings {
         writeln!(
             &mut out.warnings,
@@ -172,7 +172,7 @@ fn eval(code: &str) -> Output {
         return out;
     }
 
-    let result = tvix_eval::vm::run_lambda(lambda);
+    let result = tvix_eval::run_lambda(result.lambda);
 
     match result {
         Ok(value) => writeln!(&mut out.output, "{}", value).unwrap(),