Skip to content
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
409 changes: 371 additions & 38 deletions compiler/noirc_evaluator/src/ssa/opt/brillig_entry_points.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "brillig_entry_points_shared_recursive"
type = "bin"
authors = [""]

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
fn main() {
baz();
}

unconstrained fn foo<Env>(f: fn[Env]()) {
println("foo");
bar(f);
}

unconstrained fn bar<Env>(f: fn[Env]()) {
println("bar");
f();
}

fn baz() {
// Safety: testing context
unsafe {
foo(baz);
bar(baz);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "brillig_entry_points_regression_8069"
type = "bin"
authors = [""]

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
fn main() -> pub bool {
let ctx_depth = 5;
// Safety: testing context
let cond = unsafe { func_1(true, 1, ctx_depth) };
let _ = if !cond {
// Safety: testing context
unsafe { func_2(1, true, ctx_depth) }[0]
} else {
0
};
false
}
unconstrained fn func_1(a: bool, b: i8, mut ctx_depth: u32) -> bool {
if (ctx_depth == 0) {
false
} else {
ctx_depth = (ctx_depth - 1);
func_1(false, func_2((a as Field), false, ctx_depth)[3], ctx_depth)
}
}
unconstrained fn func_2(mut a: Field, mut b: bool, mut ctx_depth: u32) -> [i8; 4] {
if (ctx_depth == 0) {
[6, 101, 92, 30]
} else {
ctx_depth = (ctx_depth - 1);
func_2(a, func_1(b, 0, ctx_depth), ctx_depth)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[brillig_entry_points_regression_8069] Circuit output: Field(0)

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

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

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

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

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

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

Loading