Skip to content

Commit 491f409

Browse files
committed
cmd/compile: minor comment improvements/corrections
Change-Id: Ie0934f1528d58d4971cdef726d3e2d23cf3935d3 Reviewed-on: https://go-review.googlesource.com/87475 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Alexandru Moșoi <[email protected]>
1 parent b55eedd commit 491f409

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/cmd/compile/internal/ssa/func.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type Func struct {
2828
Cache *Cache // re-usable cache
2929
fe Frontend // frontend state associated with this Func, callbacks into compiler frontend
3030
pass *pass // current pass information (name, options, etc.)
31-
Name string // e.g. bytes·Compare
31+
Name string // e.g. NewFunc or (*Func).NumBlocks (no package prefix)
3232
Type *types.Type // type signature of the function.
3333
Blocks []*Block // unordered set of all basic blocks (note: not indexable by ID)
3434
Entry *Block // the entry basic block

src/cmd/compile/internal/ssa/prove.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ type limitFact struct {
9090
}
9191

9292
// factsTable keeps track of relations between pairs of values.
93+
//
94+
// The fact table logic is sound, but incomplete. Outside of a few
95+
// special cases, it performs no deduction or arithmetic. While there
96+
// are known decision procedures for this, the ad hoc approach taken
97+
// by the facts table is effective for real code while remaining very
98+
// efficient.
9399
type factsTable struct {
94100
facts map[pair]relation // current known set of relation
95101
stack []fact // previous sets of relations
@@ -433,8 +439,8 @@ var (
433439
// TODO: OpIsInBounds actually test 0 <= a < b. This means
434440
// that the positive branch learns signed/LT and unsigned/LT
435441
// but the negative branch only learns unsigned/GE.
436-
OpIsInBounds: {unsigned, lt},
437-
OpIsSliceInBounds: {unsigned, lt | eq},
442+
OpIsInBounds: {unsigned, lt}, // 0 <= arg0 < arg1
443+
OpIsSliceInBounds: {unsigned, lt | eq}, // 0 <= arg0 <= arg1
438444
}
439445
)
440446

@@ -625,6 +631,7 @@ func updateRestrictions(parent *Block, ft *factsTable, t domain, v, w *Value, r
625631
// simplifyBlock simplifies block known the restrictions in ft.
626632
// Returns which branch must always be taken.
627633
func simplifyBlock(ft *factsTable, b *Block) branch {
634+
// Replace OpSlicemask operations in b with constants where possible.
628635
for _, v := range b.Values {
629636
if v.Op != OpSlicemask {
630637
continue

0 commit comments

Comments
 (0)