From 9dedcc5bfc79b813abb39562f893503acf8d0d40 Mon Sep 17 00:00:00 2001 From: mattwparas Date: Tue, 24 Oct 2023 22:20:47 -0700 Subject: [PATCH] clean up logging --- crates/steel-core/src/compiler/compiler.rs | 12 ++++++------ crates/steel-core/src/steel_vm/engine.rs | 10 +++++----- crates/steel-core/src/steel_vm/vm.rs | 4 ++-- crates/steel-core/src/values/closed.rs | 20 ++++++++++---------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/crates/steel-core/src/compiler/compiler.rs b/crates/steel-core/src/compiler/compiler.rs index 294ed4529..075ea0828 100644 --- a/crates/steel-core/src/compiler/compiler.rs +++ b/crates/steel-core/src/compiler/compiler.rs @@ -598,7 +598,7 @@ impl Compiler { path: Option, sources: &mut Sources, ) -> Result { - log::info!(target: "expansion-phase", "Expanding macros -> phase 0"); + log::debug!(target: "expansion-phase", "Expanding macros -> phase 0"); let mut expanded_statements = self.expand_expressions(exprs, path, sources, builtin_modules.clone())?; @@ -613,14 +613,14 @@ impl Compiler { ); } - log::info!(target: "expansion-phase", "Expanding macros -> phase 1"); + log::debug!(target: "expansion-phase", "Expanding macros -> phase 1"); expanded_statements = expanded_statements .into_iter() .map(|x| expand_kernel(x, self.kernel.as_mut(), builtin_modules.clone())) .collect::>>()?; - log::info!(target: "expansion-phase", "Beginning constant folding"); + log::debug!(target: "expansion-phase", "Beginning constant folding"); let mut expanded_statements = self.apply_const_evaluation(constants.clone(), expanded_statements, false)?; @@ -646,7 +646,7 @@ impl Compiler { // debug!("About to expand defines"); - log::info!(target: "expansion-phase", "Flattening begins, converting internal defines to let expressions"); + log::debug!(target: "expansion-phase", "Flattening begins, converting internal defines to let expressions"); let mut expanded_statements = flatten_begins_and_expand_defines(expanded_statements); @@ -673,7 +673,7 @@ impl Compiler { ); } - log::info!(target: "expansion-phase", "Expanding multiple arity functions"); + log::debug!(target: "expansion-phase", "Expanding multiple arity functions"); // TODO - make sure I want to keep this let expanded_statements = @@ -688,7 +688,7 @@ impl Compiler { // Here we're gonna do the constant evaluation pass, using the kernel for execution of the // constant functions w/ memoization: - log::info!(target: "expansion-phase", "Generating instructions"); + log::debug!(target: "expansion-phase", "Generating instructions"); let instructions = self.generate_instructions_for_executable(expanded_statements)?; diff --git a/crates/steel-core/src/steel_vm/engine.rs b/crates/steel-core/src/steel_vm/engine.rs index f1c024013..584fb902f 100644 --- a/crates/steel-core/src/steel_vm/engine.rs +++ b/crates/steel-core/src/steel_vm/engine.rs @@ -224,7 +224,7 @@ impl Engine { /// Has access to primitives and syntax rules, but will not defer to a child /// kernel in the compiler pub(crate) fn new_kernel() -> Self { - log::info!(target:"kernel", "Instantiating a new kernel"); + log::debug!(target:"kernel", "Instantiating a new kernel"); let mut vm = Engine { virtual_machine: SteelThread::new(), @@ -241,7 +241,7 @@ impl Engine { vm.compile_and_run_raw_program(crate::steel_vm::primitives::ALL_MODULES) .unwrap(); - log::info!(target:"kernel", "Registered modules in the kernel!"); + log::debug!(target:"kernel", "Registered modules in the kernel!"); let core_libraries = [crate::stdlib::PRELUDE, crate::stdlib::DISPLAY]; @@ -249,7 +249,7 @@ impl Engine { vm.compile_and_run_raw_program(core).unwrap(); } - log::info!(target: "kernel", "Loaded prelude in the kernel!"); + log::debug!(target: "kernel", "Loaded prelude in the kernel!"); vm } @@ -278,7 +278,7 @@ impl Engine { return Engine::new_kernel(); } - log::info!(target:"kernel", "Instantiating a new kernel"); + log::debug!(target:"kernel", "Instantiating a new kernel"); let mut vm = Engine { virtual_machine: SteelThread::new(), @@ -303,7 +303,7 @@ impl Engine { // vm.run_raw_program_from_exprs(ast).unwrap(); } - log::info!(target: "kernel", "Loaded prelude in the kernel!"); + log::debug!(target: "kernel", "Loaded prelude in the kernel!"); let sources = vm.sources.clone(); diff --git a/crates/steel-core/src/steel_vm/vm.rs b/crates/steel-core/src/steel_vm/vm.rs index 6d6f2bc31..975d093aa 100644 --- a/crates/steel-core/src/steel_vm/vm.rs +++ b/crates/steel-core/src/steel_vm/vm.rs @@ -2592,14 +2592,14 @@ impl<'a> VmCore<'a> { .closure_interner .get(&closure_id) { - log::info!("Fetching closure from cache"); + log::trace!("Fetching closure from cache"); let mut prototype = prototype.clone(); prototype.set_captures(captures); prototype.set_heap_allocated(heap_vars); prototype } else { - log::info!("Constructing closure for the first time"); + log::trace!("Constructing closure for the first time"); debug_assert!(self.instructions[forward_index - 1].op_code == OpCode::ECLOSURE); diff --git a/crates/steel-core/src/values/closed.rs b/crates/steel-core/src/values/closed.rs index 97daa0638..140252990 100644 --- a/crates/steel-core/src/values/closed.rs +++ b/crates/steel-core/src/values/closed.rs @@ -175,7 +175,7 @@ impl Heap { let memory_size = self.memory.len() + self.vectors.len(); if memory_size > self.threshold { - log::info!(target: "gc", "Freeing memory"); + log::debug!(target: "gc", "Freeing memory"); let original_length = memory_size; @@ -188,13 +188,13 @@ impl Heap { // sweep collection. let mut changed = true; while changed { - log::info!(target: "gc", "Small collection"); + log::debug!(target: "gc", "Small collection"); let prior_len = self.memory.len() + self.vectors.len(); - log::info!(target: "gc", "Previous length: {:?}", prior_len); + log::debug!(target: "gc", "Previous length: {:?}", prior_len); self.memory.retain(|x| Rc::weak_count(x) > 0); self.vectors.retain(|x| Rc::weak_count(x) > 0); let after = self.memory.len() + self.vectors.len(); - log::info!(target: "gc", "Objects freed: {:?}", prior_len - after); + log::debug!(target: "gc", "Objects freed: {:?}", prior_len - after); changed = prior_len != after; } @@ -202,12 +202,12 @@ impl Heap { // Mark + Sweep! if post_small_collection_size as f64 > (0.25 * original_length as f64) { - log::info!(target: "gc", "---- Post small collection, running mark and sweep - heap size filled: {:?} ----", post_small_collection_size as f64 / original_length as f64); + log::debug!(target: "gc", "---- Post small collection, running mark and sweep - heap size filled: {:?} ----", post_small_collection_size as f64 / original_length as f64); // TODO fix the garbage collector self.mark_and_sweep(roots, live_functions, globals); } else { - log::info!(target: "gc", "---- Skipping mark and sweep - heap size filled: {:?} ----", post_small_collection_size as f64 / original_length as f64); + log::debug!(target: "gc", "---- Skipping mark and sweep - heap size filled: {:?} ----", post_small_collection_size as f64 / original_length as f64); } // self.mark_and_sweep(roots, live_functions, globals); @@ -236,7 +236,7 @@ impl Heap { function_stack: impl Iterator, globals: impl Iterator, ) { - log::info!(target: "gc", "Marking the heap"); + log::debug!(target: "gc", "Marking the heap"); let mut context = MarkAndSweepContext { queue: &mut self.mark_and_sweep_queue, @@ -285,7 +285,7 @@ impl Heap { // .collect::>() // ); - log::info!(target: "gc", "--- Sweeping ---"); + log::debug!(target: "gc", "--- Sweeping ---"); let prior_len = self.memory.len() + self.vectors.len(); // sweep @@ -296,8 +296,8 @@ impl Heap { let amount_freed = prior_len - after_len; - log::info!(target: "gc", "Freed objects: {:?}", amount_freed); - log::info!(target: "gc", "Objects alive: {:?}", after_len); + log::debug!(target: "gc", "Freed objects: {:?}", amount_freed); + log::debug!(target: "gc", "Objects alive: {:?}", after_len); // put them back as unreachable self.memory.iter().for_each(|x| x.borrow_mut().reset());