-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/core/adt: fix lifetime tracking of shared closeContext
Upon sharing of a node the processing of this node terminates. This, in turn, leads to the closeContext to be finalized. However, if at a later point another conjunct invalidates the sharing, processing will continue. For this reason, we should hold finalizing a closeContext until all other conjuncts are processed or up to the point sharing is undone. Delaying closing closeContext can have an impact on performance. In this case it should not matter, as there is nothing to process about shared nodes. Fixes #3062 Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com> Change-Id: Id654881563eba54123c8afbd837d47bba7f53614 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195897 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
- Loading branch information
Showing
4 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
|
||
-- in.cue -- | ||
issue3062: ok1: { | ||
#S: "a" | ||
#o: x: #S | ||
o: #o | ||
o: X | ||
X: x: A | ||
A: "a" | ||
} | ||
-- out/eval/stats -- | ||
Leaks: 0 | ||
Freed: 11 | ||
Reused: 4 | ||
Allocs: 7 | ||
Retain: 3 | ||
|
||
Unifications: 11 | ||
Conjuncts: 18 | ||
Disjuncts: 12 | ||
-- out/eval -- | ||
(struct){ | ||
issue3062: (struct){ | ||
ok1: (struct){ | ||
#S: (string){ "a" } | ||
#o: (#struct){ | ||
x: (string){ "a" } | ||
} | ||
o: (#struct){ | ||
x: (string){ "a" } | ||
} | ||
X: (struct){ | ||
x: (string){ "a" } | ||
} | ||
A: (string){ "a" } | ||
} | ||
} | ||
} | ||
-- out/compile -- | ||
--- in.cue | ||
{ | ||
issue3062: { | ||
ok1: { | ||
#S: "a" | ||
#o: { | ||
x: 〈1;#S〉 | ||
} | ||
o: 〈0;#o〉 | ||
o: 〈0;X〉 | ||
X: { | ||
x: 〈1;A〉 | ||
} | ||
A: "a" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters