Skip to content

Commit

Permalink
not matching
Browse files Browse the repository at this point in the history
  • Loading branch information
oflatt committed Nov 12, 2024
1 parent ec009f3 commit aec37ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions dag_in_context/src/greedy_dag_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,19 @@ impl<'a> Extractor<'a> {

let mut shared_total = NotNan::new(0.).unwrap();
let mut unshared_total = info.cm.get_op_cost(&node.op);

// special case: when the call is recursive, set super high cost
if node.op == "Call" {
let func_name = &node.children[0];
let func_name_str = &info.egraph[func_name].op;
assert!(func_name_str.starts_with('\"') && func_name_str.ends_with('\"'));
let func_name_str_without_quotes = &func_name_str[1..func_name_str.len() - 1];
if func_name_str_without_quotes == info._func {
eprintln!("here");
unshared_total = NotNan::new(100000000000.0).unwrap();
}
}

let mut costs: HashTrieMap<ClassId, (Term, Cost)> = Default::default();
let index_of_biggest_child = child_cost_sets
.iter()
Expand Down
3 changes: 2 additions & 1 deletion dag_in_context/src/optimizations/rec_to_loop.egg
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
(= always-runs-len (tuple-length always-runs))
(= start-ty (TupleT start-ty-list))
(HasType body func-ty))
((let loop-ty
((panic "good")
(let loop-ty
(TupleT (TLConcat start-ty-list (TCons (IntT) (TNil)))))
;; recursive case in the loop
(let new-rec-case
Expand Down

0 comments on commit aec37ce

Please sign in to comment.