Skip to content

Commit

Permalink
Merge pull request #627 from herbie-fp/oflatt-egg0.9.5
Browse files Browse the repository at this point in the history
update to egg 0.9.5
  • Loading branch information
pavpanchekha committed Jun 30, 2023
2 parents 578f711 + f682ae6 commit f26711c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions egg-herbie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ authors = [ "Oliver Flatt <[email protected]>", "Max Willsey <[email protected]>" ]
edition = "2018"

[dependencies]
# egg = "0.9.4"
egg = { git="https://github.com/egraphs-good/egg", rev="f7e9fd6cb87136d48f5275c8f60d98173ffc170a" }
egg = "0.9.5"
# egg = { git="https://github.com/egraphs-good/egg", rev="f7e9fd6cb87136d48f5275c8f60d98173ffc170a" }

log = "0.4"
indexmap = "1"
Expand Down
1 change: 1 addition & 0 deletions src/config.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
;; The maximum size of an egraph
(define *node-limit* (make-parameter 8000))
(define *proof-max-length* (make-parameter 200))
(define *proof-max-string-length* (make-parameter 10000))

;; In localization, the maximum number of locations returned
(define *localize-expressions-limit* (make-parameter 4))
Expand Down
27 changes: 16 additions & 11 deletions src/core/egg-herbie.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,22 @@
(define res (cast pointer _pointer _string/utf-8))
(destroy_string pointer)
(define env (make-hash))
(define converted
(for/list ([line (in-list (string-split res "\n"))])
(egg-expr->expr line egraph-data)))
(define expanded
(expand-proof
converted
(box (*proof-max-length*))))

(if (member #f expanded)
#f
expanded))
(cond
;; TODO: sometimes the proof is *super* long and it takes us too long just string-split
;; Ideally we would skip the string-splitting
[(< (string-length res) 10000)
(define converted
(for/list ([line (in-list (string-split res "\n"))])
(egg-expr->expr line egraph-data)))
(define expanded
(expand-proof
converted
(box (*proof-max-length*))))
(if (member #f expanded)
#f
expanded)]
[else
#f]))

(struct egg-add-exn exn:fail ())

Expand Down

0 comments on commit f26711c

Please sign in to comment.