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 unnecessary clone when executing brillig #3120

Merged
merged 1 commit into from
Oct 12, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
let inverted_var = self.add_data(AcirVarData::Const(constant.inverse()));

// Check that the inverted var is valid.
// This check prevents invalid divisons by zero.

Check warning on line 284 in compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (divisons)
let should_be_one = self.mul_var(inverted_var, var)?;
self.maybe_eq_predicate(should_be_one, predicate)?;

Expand All @@ -300,7 +300,7 @@
let inverted_var = Self::expect_one_var(results);

// Check that the inverted var is valid.
// This check prevents invalid divisons by zero.

Check warning on line 303 in compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (divisons)
let should_be_one = self.mul_var(inverted_var, var)?;
self.maybe_eq_predicate(should_be_one, predicate)?;

Expand Down Expand Up @@ -560,7 +560,7 @@
/// Returns the quotient and remainder such that lhs = rhs * quotient + remainder
/// and |remainder| < |rhs|
/// and remainder has the same sign than lhs
/// Note that this is not the euclidian division, where we have instead remainder < |rhs|

Check warning on line 563 in compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (euclidian)
fn signed_division_var(
&mut self,
lhs: AcirVar,
Expand Down Expand Up @@ -616,7 +616,7 @@
}

/// Returns an `AcirVar` which will be constrained to be lhs mod 2^{rhs}
/// In order to do this, we 'simply' perform euclidian division of lhs by 2^{rhs}

Check warning on line 619 in compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (euclidian)
/// The remainder of the division is then lhs mod 2^{rhs}
pub(crate) fn truncate_var(
&mut self,
Expand Down Expand Up @@ -878,7 +878,7 @@
// Optimistically try executing the brillig now, if we can complete execution they just return the results.
// This is a temporary measure pending SSA optimizations being applied to Brillig which would remove constant-input opcodes (See #2066)
if let Some(brillig_outputs) =
self.execute_brillig(generated_brillig.byte_code.clone(), &b_inputs, &outputs)
self.execute_brillig(&generated_brillig.byte_code, &b_inputs, &outputs)
{
return Ok(brillig_outputs);
}
Expand Down Expand Up @@ -934,7 +934,7 @@
}

/// Recursively create acir values for returned arrays. This is necessary because a brillig returned array can have nested arrays as elements.
/// A singular array of witnesses is collected for a top level array, by deflattening the assigned witnesses at each level.

Check warning on line 937 in compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (deflattening)
fn brillig_array_output(
&mut self,
element_types: &[AcirType],
Expand Down Expand Up @@ -965,7 +965,7 @@

fn execute_brillig(
&mut self,
code: Vec<BrilligOpcode>,
code: &[BrilligOpcode],
inputs: &[BrilligInputs],
outputs_types: &[AcirType],
) -> Option<Vec<AcirValue>> {
Expand Down Expand Up @@ -1238,7 +1238,7 @@
///
/// Returns `None` if complete execution of the Brillig bytecode is not possible.
fn execute_brillig(
code: Vec<BrilligOpcode>,
code: &[BrilligOpcode],
inputs: &[BrilligInputs],
) -> Option<(Registers, Vec<Value>)> {
struct NullBbSolver;
Expand Down Expand Up @@ -1294,7 +1294,7 @@

// Instantiate a Brillig VM given the solved input registers and memory, along with the Brillig bytecode.
let input_registers = Registers::load(input_register_values);
let mut vm = VM::new(input_registers, input_memory, &code, Vec::new(), &NullBbSolver);
let mut vm = VM::new(input_registers, input_memory, code, Vec::new(), &NullBbSolver);

// Run the Brillig VM on these inputs, bytecode, etc!
let vm_status = vm.process_opcodes();
Expand Down