Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove usage of acvm::default_is_opcode_supported #1366

Merged
merged 16 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/nargo_cli/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ fn check_from_path<B: Backend, P: AsRef<Path>>(
let mut driver = Resolver::resolve_root_manifest(
p.as_ref(),
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
// TODO: Remove need for driver to be aware of backend.
Box::new(|op| B::default().supports_opcode(op)),
)?;

driver.check_crate(compile_options).map_err(|_| CliError::CompilationError)?;
Expand Down
4 changes: 2 additions & 2 deletions crates/nargo_cli/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ fn setup_driver<B: Backend>(
Resolver::resolve_root_manifest(
program_dir,
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
// TODO: Remove need for driver to be aware of backend.
Box::new(|op| B::default().supports_opcode(op)),
)
}

Expand Down
4 changes: 2 additions & 2 deletions crates/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ fn run_tests<B: Backend>(
let mut driver = Resolver::resolve_root_manifest(
program_dir,
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
// TODO: Remove need for driver to be aware of backend.
Box::new(|op| B::default().supports_opcode(op)),
)?;

driver.check_crate(compile_options).map_err(|_| CliError::CompilationError)?;
Expand Down
8 changes: 2 additions & 6 deletions crates/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ pub use program::CompiledProgram;
pub struct Driver {
context: Context,
language: Language,
// We retain this as we need to pass this into `create_circuit` once signature is updated to allow.
#[allow(dead_code)]
is_opcode_supported: Box<dyn Fn(&Opcode) -> bool>,
}

Expand Down Expand Up @@ -286,22 +284,20 @@ impl Driver {
let program = monomorphize(main_function, &self.context.def_interner);

let np_language = self.language.clone();
// TODO: use proper `is_opcode_supported` implementation.
let is_opcode_supported = acvm::default_is_opcode_supported(np_language.clone());

let circuit_abi = if options.experimental_ssa {
experimental_create_circuit(
program,
np_language,
is_opcode_supported,
&self.is_opcode_supported,
options.show_ssa,
options.show_output,
)
} else {
create_circuit(
program,
np_language,
is_opcode_supported,
&self.is_opcode_supported,
options.show_ssa,
options.show_output,
)
Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_evaluator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub struct Evaluator {
pub fn create_circuit(
program: Program,
np_language: Language,
is_opcode_supported: fn(&AcirOpcode) -> bool,
is_opcode_supported: &impl Fn(&AcirOpcode) -> bool,
enable_logging: bool,
show_output: bool,
) -> Result<(Circuit, Abi), RuntimeError> {
Expand Down
4 changes: 2 additions & 2 deletions crates/noirc_evaluator/src/ssa_refactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use crate::errors::RuntimeError;
use acvm::{
acir::circuit::{Circuit, Opcode},
acir::circuit::{Circuit, Opcode as AcirOpcode},
Language,
};
use noirc_abi::Abi;
Expand All @@ -36,7 +36,7 @@ pub fn optimize_into_acir(program: Program) -> Acir {
pub fn experimental_create_circuit(
_program: Program,
_np_language: Language,
_is_opcode_supported: fn(&Opcode) -> bool,
_is_opcode_supported: &impl Fn(&AcirOpcode) -> bool,
_enable_logging: bool,
_show_output: bool,
) -> Result<(Circuit, Abi), RuntimeError> {
Expand Down