this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: remove support for list task dependencies

listTypeKnown was a zero-valued placeholder for future
associative-list support. It never contributed any behavior
(hardcoded to 0) yet appeared in autoUnblock and
stateCompletions. Remove it to simplify the condition set
and avoid misleading dead code.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ica8be84bb852dca6d7ffd0f185b0482980916518
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1236064
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+5 -82
+3 -13
internal/core/adt/sched.go
··· 613 613 // completes indicates which states this tasks contributes to. 614 614 completes condition 615 615 616 - // needes indicates which states of the corresponding node need to be 617 - // completed before this task can be run. 618 - needs condition 619 - 620 616 // a lower priority indicates a preference to run a task before tasks 621 617 // of a higher priority. 622 618 priority int8 ··· 663 659 } 664 660 665 661 func (s *scheduler) insertTask(t *task) { 662 + if t.run.completes == 0 { 663 + panic("task with no completes") 664 + } 666 665 completes := t.run.completes 667 - needs := t.run.needs 668 666 669 - s.needs |= needs 670 667 s.provided |= completes 671 668 672 - if needs&completes != 0 { 673 - panic("task depends on its own completion") 674 - } 675 669 t.completes = completes 676 670 677 671 s.incrementCounts(completes) ··· 685 679 break 686 680 } 687 681 s.tasks[i], s.tasks[i-1] = s.tasks[i-1], s.tasks[i] 688 - } 689 - 690 - if s.completed&needs != needs { 691 - t.waitFor(s, needs) 692 682 } 693 683 } 694 684
-48
internal/core/adt/sched_test.go
··· 140 140 process(name, t, deps...) 141 141 }, 142 142 completes: completes, 143 - needs: needs, 144 143 }, 145 144 node: n, 146 145 x: &String{Str: name}, // Set name for debugging purposes. ··· 197 196 fmt.Fprint(w, " FAIL") 198 197 }, 199 198 completes: completes, 200 - needs: needs, 201 199 }, 202 200 node: n, 203 201 x: &String{Str: name}, // Set name for debugging purposes. ··· 263 261 v0 (SUCCESS): 264 262 task: t1: FAILED`, 265 263 }, { 266 - // Tasks will have to be run in order according to their dependencies. 267 - // Note that the tasks will be run in order, as they all depend on the 268 - // same node, in which case the order must be and will be strictly 269 - // enforced. 270 - name: "dependency chain on nodes within scheduler", 271 - init: func() { 272 - v0 := node(nil) 273 - success("third", v0, c3ValueKnown, c2ArcTypeKnown) 274 - success("fourth", v0, c4ScalarKnown, c3ValueKnown) 275 - success("second", v0, c2ArcTypeKnown, c1AllAncestorsProcessed) 276 - success("first", v0, c1AllAncestorsProcessed, 0) 277 - }, 278 - log: ` 279 - running task first 280 - running task second 281 - running task third 282 - running task fourth`, 283 - 284 - state: ` 285 - v0 (SUCCESS): 286 - task: third: SUCCESS 287 - task: fourth: SUCCESS 288 - task: second: SUCCESS 289 - task: first: SUCCESS`, 290 - }, { 291 264 // If a task depends on a state completion for which there is no task, 292 265 // it should be considered as completed, because essentially all 293 266 // information is known about that state. ··· 317 290 v1 (SUCCESS): 318 291 task: t1: SUCCESS 319 292 v2 (SUCCESS):`, 320 - }, { 321 - name: "tasks depend on multiple other tasks within same scheduler", 322 - init: func() { 323 - v0 := node(nil) 324 - success("before1", v0, c2ArcTypeKnown, 0) 325 - success("last", v0, c4ScalarKnown, c1AllAncestorsProcessed|c2ArcTypeKnown|c3ValueKnown) 326 - success("block", v0, c3ValueKnown, c1AllAncestorsProcessed|c2ArcTypeKnown) 327 - success("before2", v0, c1AllAncestorsProcessed, 0) 328 - }, 329 - log: ` 330 - running task before1 331 - running task before2 332 - running task block 333 - running task last`, 334 - 335 - state: ` 336 - v0 (SUCCESS): 337 - task: before1: SUCCESS 338 - task: last: SUCCESS 339 - task: block: SUCCESS 340 - task: before2: SUCCESS`, 341 293 }, { 342 294 // In this test we simulate dynamic reference that are dependent 343 295 // on each other in a chain to form the fields. Task t0 would not be
+1 -18
internal/core/adt/states.go
··· 131 131 // TODO: rename to something better? 132 132 scalarKnown 133 133 134 - // listTypeKnown indicates that it is known that lists unified with this 135 - // Vertex should be interpreted as integer indexed lists, as associative 136 - // lists, or an error. 137 - // 138 - // This is a signal condition that is reached when: 139 - // - allFieldsKnown is reached (all expressions have ) 140 - // - it is unified with an associative list type 141 - // 142 - // TODO(assoclist): this is set to 0 below: This mode is only needed for 143 - // associative lists and is not yet used. We should use this again and fix 144 - // any performance issues when we implement associative lists. 145 - // listTypeKnown 146 - 147 134 // fieldConjunctsKnown means that all the conjuncts of all fields are 148 135 // known. 149 136 fieldConjunctsKnown ··· 245 232 // At the moment this is equal to 'scalarKnown'. 246 233 concreteKnown = scalarKnown 247 234 248 - // TODO(assoclist): see comment above. 249 - listTypeKnown condition = 0 250 - 251 235 // fieldConjunctsKnownIdx is the bit-position index of 252 236 // fieldConjunctsKnown, for use as a scheduler.counters index. 253 237 // It must equal bits.TrailingZeros16(uint16(fieldConjunctsKnown)). ··· 259 243 // new taskContexts. 260 244 var schedConfig = taskContext{ 261 245 counterMask: conditionsUsingCounters, 262 - autoUnblock: listTypeKnown | scalarKnown | arcTypeKnown, 246 + autoUnblock: scalarKnown | arcTypeKnown, 263 247 complete: stateCompletions, 264 248 } 265 249 ··· 365 349 if v.ArcType == ArcMember || v.ArcType == ArcNotPresent { 366 350 x |= scalarKnown 367 351 } 368 - x |= listTypeKnown 369 352 } 370 353 371 354 if x.meets(needFieldConjunctsKnown | needTasksDone) {
-2
internal/core/adt/tasks.go
··· 64 64 name: "ListLit", 65 65 f: processListLit, 66 66 completes: fieldConjunct, 67 - needs: listTypeKnown, 68 67 } 69 68 handleListVertex = &runner{ 70 69 name: "ListVertex", 71 70 f: processListVertex, 72 71 completes: fieldConjunct, 73 - needs: listTypeKnown, 74 72 } 75 73 handleDisjunctions = &runner{ 76 74 name: "Disjunctions",
+1 -1
internal/core/adt/unify.go
··· 75 75 n.blockOn(allAncestorsProcessed) 76 76 } 77 77 78 - n.blockOn(scalarKnown | listTypeKnown | arcTypeKnown) 78 + n.blockOn(scalarKnown | arcTypeKnown) 79 79 80 80 if v.Label.IsDef() { 81 81 v.ClosedRecursive = true