Skip to content

Commit

Permalink
internal/core/adt: fix cycle in patterns
Browse files Browse the repository at this point in the history
The finalized state of a node was set before processing
patterns. This caused cycles in patterns to go unnoticed.

Fixing this further exposed some issues with cycle detection
in sharing: allowing cyclic nodes to share could make
structure sharing go unnoticed. We now do not allow
sharing in this case.

Another issue was that clearing the Refs in a nonRooted
struct could remove a necessary cycle detection.

Issue #3476
Issue #2854
Issue #2850

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ibfbf716b9aa2b07ac83d0125a8e5188486eda4eb
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202216
Reviewed-by: Matthew Sackman <matthew@cue.works>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
  • Loading branch information
mpvl committed Oct 8, 2024
1 parent 695d6d3 commit 16df890
Show file tree
Hide file tree
Showing 9 changed files with 284 additions and 533 deletions.
28 changes: 14 additions & 14 deletions cue/testdata/benchmarks/issue1684.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ nestedClosed: passing: {
D: {id: {}} | {[string]: D}
}
-- out/evalalpha/stats --
Leaks: 2135
Freed: 530
Reused: 530
Allocs: 2135
Leaks: 3341
Freed: 794
Reused: 794
Allocs: 3341
Retain: 0

Unifications: 475
Conjuncts: 4333
Disjuncts: 790
Unifications: 937
Conjuncts: 6553
Disjuncts: 1414
-- out/evalalpha --
(struct){
#Secret: (#struct){
Expand Down Expand Up @@ -143,18 +143,18 @@ diff old new
-Freed: 1064333
-Reused: 1064282
-Allocs: 51
+Leaks: 2135
+Freed: 530
+Reused: 530
+Allocs: 2135
+Leaks: 3341
+Freed: 794
+Reused: 794
+Allocs: 3341
Retain: 0

-Unifications: 792123
-Conjuncts: 2480117
-Disjuncts: 1064333
+Unifications: 475
+Conjuncts: 4333
+Disjuncts: 790
+Unifications: 937
+Conjuncts: 6553
+Disjuncts: 1414
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
Expand Down
Loading

0 comments on commit 16df890

Please sign in to comment.