Skip to content

Commit 614d1fc

Browse files
mpvlcueckoo
authored andcommitted
internal/core/adt: adjustments to closedness algo
Embedding within a struct that refer to a definition close that struct. We need to therefore make a distinction between fields that are not within the embedding and in the same struct (always allowed) or outside that struct (may not be allowed). Before we tracked this with a single inclusion list of IDs, which meant that an embedding would have to include all IDs from nodes that are outside of its outer struct scope. This was complicated to manage. Now we track each embedding and outer scope separately, effectively having the main groups and separate allow and deny lists. This means we now track more groups, but the groups will be smaller. In future CLs we can now more easily filter unnecessary groups, though, for instance if we have structs with a single embedding. Fixes #3920 Issue #3934 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Ia925281624280d04a10587b089884f9a83588b95 Dispatch-Trailer: {"type":"trybot","CL":1216387,"patchset":3,"ref":"refs/changes/87/1216387/3","targetBranch":"master"}
1 parent 7e29d44 commit 614d1fc

File tree

119 files changed

+1158
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+1158
-403
lines changed

cue/testdata/benchmarks/disjunctelim.txtar

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ Unifications: 22
5050
Conjuncts: 843
5151
Disjuncts: 618
5252

53-
CloseIDElems: 63
54-
NumCloseIDs: 4
53+
CloseIDElems: 54
54+
NumCloseIDs: 3
5555
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
5656
diff old new
5757
--- old
@@ -74,8 +74,8 @@ diff old new
7474
+Conjuncts: 843
7575
+Disjuncts: 618
7676
+
77-
+CloseIDElems: 63
78-
+NumCloseIDs: 4
77+
+CloseIDElems: 54
78+
+NumCloseIDs: 3
7979
-- out/eval/stats --
8080
Leaks: 0
8181
Freed: 367

cue/testdata/benchmarks/inlinedisjunction.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Unifications: 16
2424
Conjuncts: 113
2525
Disjuncts: 58
2626

27-
CloseIDElems: 10
27+
CloseIDElems: 22
2828
NumCloseIDs: 3
2929
-- out/eval --
3030
(struct){
@@ -66,7 +66,7 @@ diff old new
6666
+Conjuncts: 113
6767
+Disjuncts: 58
6868
+
69-
+CloseIDElems: 10
69+
+CloseIDElems: 22
7070
+NumCloseIDs: 3
7171
-- out/eval/stats --
7272
Leaks: 0

cue/testdata/benchmarks/issue2176.txtar

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ Unifications: 377
6868
Conjuncts: 1333
6969
Disjuncts: 8
7070

71-
CloseIDElems: 135
72-
NumCloseIDs: 537
71+
CloseIDElems: 20071
72+
NumCloseIDs: 535
7373
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
7474
diff old new
7575
--- old
7676
+++ new
77-
@@ -1,9 +1,12 @@
77+
@@ -1,12 +1,12 @@
7878
-Leaks: 90
7979
-Freed: 746
8080
-Reused: 742
@@ -84,6 +84,9 @@ diff old new
8484
-Unifications: 828
8585
-Conjuncts: 3306
8686
-Disjuncts: 1475
87+
-
88+
-CloseIDElems: 0
89+
-NumCloseIDs: 12
8790
+Leaks: 449
8891
+Freed: 0
8992
+Reused: 0
@@ -94,8 +97,8 @@ diff old new
9497
+Conjuncts: 1333
9598
+Disjuncts: 8
9699
+
97-
+CloseIDElems: 135
98-
+NumCloseIDs: 537
100+
+CloseIDElems: 20071
101+
+NumCloseIDs: 535
99102
-- out/eval/stats --
100103
Leaks: 90
101104
Freed: 746
@@ -106,6 +109,9 @@ Retain: 1363
106109
Unifications: 828
107110
Conjuncts: 3306
108111
Disjuncts: 1475
112+
113+
CloseIDElems: 0
114+
NumCloseIDs: 12
109115
-- out/evalalpha --
110116
(struct){
111117
#Datastream: (#struct){

cue/testdata/benchmarks/issue3307.txtar

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Retain: 72
3232
Unifications: 21
3333
Conjuncts: 3
3434
Disjuncts: 93
35+
36+
CloseIDElems: 0
37+
NumCloseIDs: 1
3538
-- out/eval --
3639
(_|_){
3740
// [incomplete] incomplete bool: _

cue/testdata/benchmarks/issue3514.txtar

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Unifications: 69
4646
Conjuncts: 7053
4747
Disjuncts: 2386
4848

49-
CloseIDElems: 15
50-
NumCloseIDs: 6876
49+
CloseIDElems: 82
50+
NumCloseIDs: 5733
5151
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
5252
diff old new
5353
--- old
@@ -72,8 +72,8 @@ diff old new
7272
+Conjuncts: 7053
7373
+Disjuncts: 2386
7474
+
75-
+CloseIDElems: 15
76-
+NumCloseIDs: 6876
75+
+CloseIDElems: 82
76+
+NumCloseIDs: 5733
7777
-- out/eval/stats --
7878
Leaks: 27
7979
Freed: 31092

cue/testdata/benchmarks/issue3633.txtar

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Unifications: 667
1010
Conjuncts: 2680
1111
Disjuncts: 1955
1212

13-
CloseIDElems: 4233
14-
NumCloseIDs: 55
13+
CloseIDElems: 7225
14+
NumCloseIDs: 53
1515
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
1616
diff old new
1717
--- old
@@ -34,8 +34,8 @@ diff old new
3434
+Conjuncts: 2680
3535
+Disjuncts: 1955
3636
+
37-
+CloseIDElems: 4233
38-
+NumCloseIDs: 55
37+
+CloseIDElems: 7225
38+
+NumCloseIDs: 53
3939
-- out/eval/stats --
4040
Leaks: 0
4141
Freed: 3595

cue/testdata/benchmarks/issue572.txtar

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,44 @@ unified: {
99
"\(entry)": true
1010
}
1111
}
12+
-- out/evalalpha/stats --
13+
Leaks: 3001
14+
Freed: 0
15+
Reused: 0
16+
Allocs: 3001
17+
Retain: 0
18+
19+
Unifications: 3001
20+
Conjuncts: 7498
21+
Disjuncts: 0
22+
23+
CloseIDElems: 4500
24+
NumCloseIDs: 4499
25+
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
26+
diff old new
27+
--- old
28+
+++ new
29+
@@ -1,12 +1,12 @@
30+
-Leaks: 0
31+
-Freed: 3001
32+
-Reused: 2998
33+
-Allocs: 3
34+
+Leaks: 3001
35+
+Freed: 0
36+
+Reused: 0
37+
+Allocs: 3001
38+
Retain: 0
39+
40+
Unifications: 3001
41+
Conjuncts: 7498
42+
-Disjuncts: 3001
43+
-
44+
-CloseIDElems: 0
45+
-NumCloseIDs: 1
46+
+Disjuncts: 0
47+
+
48+
+CloseIDElems: 4500
49+
+NumCloseIDs: 4499
1250
-- out/eval/stats --
1351
Leaks: 0
1452
Freed: 3001
@@ -19,6 +57,9 @@ Retain: 0
1957
Unifications: 3001
2058
Conjuncts: 7498
2159
Disjuncts: 3001
60+
61+
CloseIDElems: 0
62+
NumCloseIDs: 1
2263
-- out/eval --
2364
(struct){
2465
_entries(:p): (#list){

cue/testdata/benchmarks/listdedup.txtar

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Unifications: 40
4343
Conjuncts: 98
4444
Disjuncts: 24
4545

46-
CloseIDElems: 1224
47-
NumCloseIDs: 22
46+
CloseIDElems: 956
47+
NumCloseIDs: 18
4848
-- out/evalalpha --
4949
(struct){
5050
A: (#struct){ |((#struct){
@@ -486,8 +486,8 @@ diff old new
486486
+Conjuncts: 98
487487
+Disjuncts: 24
488488
+
489-
+CloseIDElems: 1224
490-
+NumCloseIDs: 22
489+
+CloseIDElems: 956
490+
+NumCloseIDs: 18
491491
-- out/eval/stats --
492492
Leaks: 0
493493
Freed: 24096

cue/testdata/benchmarks/mergeddisjunction.txtar

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ Retain: 0
5050
Unifications: 99
5151
Conjuncts: 530
5252
Disjuncts: 283
53+
54+
CloseIDElems: 0
55+
NumCloseIDs: 2
5356
-- out/eval --
5457
(struct){
5558
list: (#list){

cue/testdata/benchmarks/sharefg.txtar

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,43 @@ weaveExtraField: {
109109
f2: f&{ ref: f1 }
110110
f1: { out: 2 }
111111
}
112+
-- out/evalalpha/stats --
113+
Leaks: 452
114+
Freed: 0
115+
Reused: 0
116+
Allocs: 452
117+
Retain: 0
118+
119+
Unifications: 452
120+
Conjuncts: 845
121+
Disjuncts: 0
122+
123+
CloseIDElems: 4039
124+
NumCloseIDs: 238
125+
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
126+
diff old new
127+
--- old
128+
+++ new
129+
@@ -1,9 +1,12 @@
130+
-Leaks: 112
131+
-Freed: 340
132+
-Reused: 308
133+
-Allocs: 144
134+
-Retain: 428
135+
+Leaks: 452
136+
+Freed: 0
137+
+Reused: 0
138+
+Allocs: 452
139+
+Retain: 0
140+
141+
Unifications: 452
142+
-Conjuncts: 853
143+
-Disjuncts: 720
144+
+Conjuncts: 845
145+
+Disjuncts: 0
146+
+
147+
+CloseIDElems: 4039
148+
+NumCloseIDs: 238
112149
-- out/eval/stats --
113150
Leaks: 112
114151
Freed: 340

cue/testdata/benchmarks/typocheck.txtar

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ Unifications: 703
3131
Conjuncts: 1305
3232
Disjuncts: 0
3333

34-
CloseIDElems: 31712
35-
NumCloseIDs: 210
34+
CloseIDElems: 45090
35+
NumCloseIDs: 212
3636
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
3737
diff old new
3838
--- old
3939
+++ new
40-
@@ -1,9 +1,12 @@
40+
@@ -1,12 +1,12 @@
4141
-Leaks: 0
4242
-Freed: 700
4343
-Reused: 594
@@ -47,6 +47,9 @@ diff old new
4747
-Unifications: 700
4848
-Conjuncts: 1302
4949
-Disjuncts: 807
50+
-
51+
-CloseIDElems: 0
52+
-NumCloseIDs: 4
5053
+Leaks: 703
5154
+Freed: 0
5255
+Reused: 0
@@ -57,8 +60,8 @@ diff old new
5760
+Conjuncts: 1305
5861
+Disjuncts: 0
5962
+
60-
+CloseIDElems: 31712
61-
+NumCloseIDs: 210
63+
+CloseIDElems: 45090
64+
+NumCloseIDs: 212
6265
-- out/eval/stats --
6366
Leaks: 0
6467
Freed: 700
@@ -69,6 +72,9 @@ Retain: 108
6972
Unifications: 700
7073
Conjuncts: 1302
7174
Disjuncts: 807
75+
76+
CloseIDElems: 0
77+
NumCloseIDs: 4
7278
-- out/eval --
7379
(struct){
7480
out: (#struct){

cue/testdata/builtins/056_issue314.txtar

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ Unifications: 21
8484
Conjuncts: 24
8585
Disjuncts: 0
8686

87-
CloseIDElems: 21
88-
NumCloseIDs: 4
87+
CloseIDElems: 18
88+
NumCloseIDs: 3
8989
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
9090
diff old new
9191
--- old
@@ -110,8 +110,8 @@ diff old new
110110
+Conjuncts: 24
111111
+Disjuncts: 0
112112
+
113-
+CloseIDElems: 21
114-
+NumCloseIDs: 4
113+
+CloseIDElems: 18
114+
+NumCloseIDs: 3
115115
-- out/eval/stats --
116116
Leaks: 0
117117
Freed: 45

cue/testdata/builtins/matchn.txtar

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,45 @@ issue3694: simple: {
345345
uses?: string
346346
})
347347
}
348+
-- out/evalalpha/stats --
349+
Leaks: 1034
350+
Freed: 0
351+
Reused: 0
352+
Allocs: 1034
353+
Retain: 0
354+
355+
Unifications: 931
356+
Conjuncts: 1511
357+
Disjuncts: 16
358+
359+
CloseIDElems: 1227
360+
NumCloseIDs: 483
361+
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
362+
diff old new
363+
--- old
364+
+++ new
365+
@@ -1,9 +1,12 @@
366+
-Leaks: 52
367+
-Freed: 951
368+
-Reused: 944
369+
-Allocs: 59
370+
-Retain: 129
371+
-
372+
-Unifications: 987
373+
-Conjuncts: 1635
374+
-Disjuncts: 1081
375+
+Leaks: 1034
376+
+Freed: 0
377+
+Reused: 0
378+
+Allocs: 1034
379+
+Retain: 0
380+
+
381+
+Unifications: 931
382+
+Conjuncts: 1511
383+
+Disjuncts: 16
384+
+
385+
+CloseIDElems: 1227
386+
+NumCloseIDs: 483
348387
-- out/eval/stats --
349388
Leaks: 52
350389
Freed: 951

cue/testdata/builtins/validators.txtar

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ Retain: 23
221221
Unifications: 181
222222
Conjuncts: 327
223223
Disjuncts: 202
224+
225+
CloseIDElems: 0
226+
NumCloseIDs: 8
224227
-- out/evalalpha --
225228
Errors:
226229
issue3474.topValidator.failType.A: conflicting values >10 and {C:1} (mismatched types number and struct):

0 commit comments

Comments
 (0)