Skip to content

Commit dd3813c

Browse files
TomAFrenchSakapoi
authored andcommitted
chore: remove unnecessary clone when executing brillig (noir-lang#3120)
Co-authored-by: Tom French <git@tomfren.ch>
1 parent 7803c6e commit dd3813c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ impl AcirContext {
878878
// Optimistically try executing the brillig now, if we can complete execution they just return the results.
879879
// This is a temporary measure pending SSA optimizations being applied to Brillig which would remove constant-input opcodes (See #2066)
880880
if let Some(brillig_outputs) =
881-
self.execute_brillig(generated_brillig.byte_code.clone(), &b_inputs, &outputs)
881+
self.execute_brillig(&generated_brillig.byte_code, &b_inputs, &outputs)
882882
{
883883
return Ok(brillig_outputs);
884884
}
@@ -965,7 +965,7 @@ impl AcirContext {
965965

966966
fn execute_brillig(
967967
&mut self,
968-
code: Vec<BrilligOpcode>,
968+
code: &[BrilligOpcode],
969969
inputs: &[BrilligInputs],
970970
outputs_types: &[AcirType],
971971
) -> Option<Vec<AcirValue>> {
@@ -1238,7 +1238,7 @@ pub(crate) struct AcirVar(usize);
12381238
///
12391239
/// Returns `None` if complete execution of the Brillig bytecode is not possible.
12401240
fn execute_brillig(
1241-
code: Vec<BrilligOpcode>,
1241+
code: &[BrilligOpcode],
12421242
inputs: &[BrilligInputs],
12431243
) -> Option<(Registers, Vec<Value>)> {
12441244
struct NullBbSolver;
@@ -1294,7 +1294,7 @@ fn execute_brillig(
12941294

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

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

0 commit comments

Comments
 (0)