Skip to content

Commit

Permalink
Merge branch 'tf/replace-function-vis-with-module-vis' into tf/less-v…
Browse files Browse the repository at this point in the history
…isibility-hardcoding

* tf/replace-function-vis-with-module-vis:
  fix: Allow type aliases in main (#4505)
  chore: add `ModuleDeclaration` struct (#4512)
  fix: Force src impl for == on slices (#4507)
  chore: pass `import_directive` by reference (#4511)
  feat: Track stack frames and their variables in the debugger (#4188)
  chore: add regression test for issue 4449 (#4503)
  chore: pass macro processors by reference (#4501)
  chore: bump bb to 0.26.3 (#4488)
  fix: handling of gh deps in noir_wasm (#4499)
  fix: iterative flattening pass (#4492)
  • Loading branch information
TomAFrench committed Mar 7, 2024
2 parents 64e5463 + 480bd25 commit 7088d85
Show file tree
Hide file tree
Showing 42 changed files with 867 additions and 578 deletions.
7 changes: 2 additions & 5 deletions compiler/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,8 @@ pub fn check_crate(
deny_warnings: bool,
disable_macros: bool,
) -> CompilationResult<()> {
let macros: Vec<&dyn MacroProcessor> = if disable_macros {
vec![]
} else {
vec![&aztec_macros::AztecMacro as &dyn MacroProcessor]
};
let macros: &[&dyn MacroProcessor] =
if disable_macros { &[] } else { &[&aztec_macros::AztecMacro as &dyn MacroProcessor] };

let mut errors = vec![];
let diagnostics = CrateDefMap::collect_defs(crate_id, context, macros);
Expand Down
14 changes: 13 additions & 1 deletion compiler/noirc_errors/src/debug_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ use serde::{
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, Deserialize, Serialize)]
pub struct DebugVarId(pub u32);

#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, Deserialize, Serialize)]
pub struct DebugFnId(pub u32);

#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, PartialOrd, Ord, Deserialize, Serialize)]
pub struct DebugTypeId(pub u32);

Expand All @@ -33,7 +36,14 @@ pub struct DebugVariable {
pub debug_type_id: DebugTypeId,
}

#[derive(Debug, Clone, Hash, Deserialize, Serialize)]
pub struct DebugFunction {
pub name: String,
pub arg_names: Vec<String>,
}

pub type DebugVariables = BTreeMap<DebugVarId, DebugVariable>;
pub type DebugFunctions = BTreeMap<DebugFnId, DebugFunction>;
pub type DebugTypes = BTreeMap<DebugTypeId, PrintableType>;

#[serde_as]
Expand All @@ -45,6 +55,7 @@ pub struct DebugInfo {
#[serde_as(as = "BTreeMap<DisplayFromStr, _>")]
pub locations: BTreeMap<OpcodeLocation, Vec<Location>>,
pub variables: DebugVariables,
pub functions: DebugFunctions,
pub types: DebugTypes,
}

Expand All @@ -60,9 +71,10 @@ impl DebugInfo {
pub fn new(
locations: BTreeMap<OpcodeLocation, Vec<Location>>,
variables: DebugVariables,
functions: DebugFunctions,
types: DebugTypes,
) -> Self {
Self { locations, variables, types }
Self { locations, variables, functions, types }
}

/// Updates the locations map when the [`Circuit`][acvm::acir::circuit::Circuit] is modified.
Expand Down
3 changes: 2 additions & 1 deletion compiler/noirc_evaluator/src/ssa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub fn create_circuit(
) -> Result<(Circuit, DebugInfo, Vec<Witness>, Vec<Witness>, Vec<SsaReport>), RuntimeError> {
let debug_variables = program.debug_variables.clone();
let debug_types = program.debug_types.clone();
let debug_functions = program.debug_functions.clone();
let func_sig = program.main_function_signature.clone();
let recursive = program.recursive;
let mut generated_acir = optimize_into_acir(
Expand Down Expand Up @@ -130,7 +131,7 @@ pub fn create_circuit(
.map(|(index, locations)| (index, locations.into_iter().collect()))
.collect();

let mut debug_info = DebugInfo::new(locations, debug_variables, debug_types);
let mut debug_info = DebugInfo::new(locations, debug_variables, debug_functions, debug_types);

// Perform any ACIR-level optimizations
let (optimized_circuit, transformation_map) = acvm::compiler::optimize(circuit);
Expand Down
Loading

0 comments on commit 7088d85

Please sign in to comment.