Skip to content

Commit 334be14

Browse files
guipublicvezenovm
andauthored
chore: do not inline acir calls in brillig (#9412)
Co-authored-by: Maxim Vezenov <[email protected]>
1 parent f0783ea commit 334be14

20 files changed

+650
-97
lines changed

compiler/noirc_evaluator/src/errors.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ pub enum RuntimeError {
8585
"Only constant indices are supported when indexing an array containing reference values"
8686
)]
8787
DynamicIndexingWithReference { call_stack: CallStack },
88+
#[error(
89+
"Calling constrained function '{constrained}' from the unconstrained function '{unconstrained}'"
90+
)]
91+
UnconstrainedCallingConstrained {
92+
call_stack: CallStack,
93+
constrained: String,
94+
unconstrained: String,
95+
},
8896
}
8997

9098
#[derive(Debug, Clone, Serialize, Deserialize, Hash)]
@@ -198,7 +206,8 @@ impl RuntimeError {
198206
| RuntimeError::BreakOrContinue { call_stack }
199207
| RuntimeError::DynamicIndexingWithReference { call_stack }
200208
| RuntimeError::UnknownReference { call_stack }
201-
| RuntimeError::RecursionLimit { call_stack, .. } => call_stack,
209+
| RuntimeError::RecursionLimit { call_stack, .. }
210+
| RuntimeError::UnconstrainedCallingConstrained { call_stack, .. } => call_stack,
202211
}
203212
}
204213
}

compiler/noirc_evaluator/src/ssa/function_builder/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ impl FunctionBuilder {
178178
}
179179

180180
/// Insert a numeric constant into the current function of type Field
181-
#[cfg(test)]
182181
pub fn field_constant(&mut self, value: impl Into<FieldElement>) -> ValueId {
183182
self.numeric_constant(value.into(), NumericType::NativeField)
184183
}

compiler/noirc_evaluator/src/ssa/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn primary_passes(options: &SsaEvaluatorOptions) -> Vec<SsaPass<'_>> {
107107
SsaPass::new(Ssa::expand_signed_checks, "expand signed checks"),
108108
SsaPass::new(Ssa::remove_unreachable_functions, "Removing Unreachable Functions"),
109109
SsaPass::new(Ssa::defunctionalize, "Defunctionalization"),
110-
SsaPass::new(Ssa::inline_simple_functions, "Inlining simple functions")
110+
SsaPass::new_try(Ssa::inline_simple_functions, "Inlining simple functions")
111111
.and_then(Ssa::remove_unreachable_functions),
112112
// BUG: Enabling this mem2reg causes an integration test failure in aztec-package; see:
113113
// https://github.com/AztecProtocol/aztec-packages/pull/11294#issuecomment-2622809518

0 commit comments

Comments
 (0)