Skip to content

Commit

Permalink
Fix: issue where identity reducer was always returning true
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Nov 10, 2024
1 parent 8117f45 commit 3814a54
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 45 deletions.
15 changes: 8 additions & 7 deletions crates/uplc/src/optimize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pub mod shrinker;
pub mod shrinker2;

pub fn aiken_optimize_and_intern(program: Program<Name>) -> Program<Name> {
println!("PROG IS {}", program.to_pretty());
// println!("PROG IS {}", program.to_pretty());
let mut prog = program.run_once_pass();
println!("PROG IS {}", prog.to_pretty());
// println!("PROG IS {}", prog.to_pretty());
let mut prev_count = 0;

loop {
Expand All @@ -21,15 +21,15 @@ pub fn aiken_optimize_and_intern(program: Program<Name>) -> Program<Name> {
prev_count = context.node_count;
}
}
println!("PROG IS {}", prog.to_pretty());
// println!("PROG IS {}", prog.to_pretty());

prog = prog
.builtin_curry_reducer()
.multi_pass()
.0
.builtin_curry_reducer();

println!("PROG IS {}", prog.to_pretty());
// println!("PROG IS {}", prog.to_pretty());

loop {
let (current_program, context) = prog.multi_pass();
Expand All @@ -43,15 +43,16 @@ pub fn aiken_optimize_and_intern(program: Program<Name>) -> Program<Name> {
}
}

println!("PROG IS {}", prog.to_pretty());
// println!("PROG IS {}", prog.to_pretty());

let x = prog.clean_up();

println!("PROG IS {}", x.to_pretty());
// println!("PROG IS {}", x.to_pretty());

x

// prog.lambda_reducer_1()
// prog.
// lambda_reducer_1()
// .inline_reducer_1()
// .identity_reducer_1()
// .lambda_reducer_1()
Expand Down
Loading

0 comments on commit 3814a54

Please sign in to comment.