mirror of
https://github.com/golang/go
synced 2024-09-29 13:14:28 -06:00
cmd/compile: restore missing columns in ssa.html
If the final pass(es) are identical during ssa.html generation, they are persisted in-memory as "pendingPhases" but never get written as a column in the html. This change flushes those in-memory phases. Fixes #38242 Change-Id: Id13477dcbe7b419a818bb457861b2422ba5ef4bc Reviewed-on: https://go-review.googlesource.com/c/go/+/227182 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
281d41cb40
commit
763bd58b19
@ -136,6 +136,11 @@ func Compile(f *Func) {
|
||||
}
|
||||
}
|
||||
|
||||
if f.HTMLWriter != nil {
|
||||
// Ensure we write any pending phases to the html
|
||||
f.HTMLWriter.flushPhases()
|
||||
}
|
||||
|
||||
if f.ruleMatches != nil {
|
||||
var keys []string
|
||||
for key := range f.ruleMatches {
|
||||
|
@ -774,14 +774,28 @@ func (w *HTMLWriter) WritePhase(phase, title string) {
|
||||
w.pendingPhases = append(w.pendingPhases, phase)
|
||||
w.pendingTitles = append(w.pendingTitles, title)
|
||||
if !bytes.Equal(hash, w.prevHash) {
|
||||
phases := strings.Join(w.pendingPhases, " + ")
|
||||
w.WriteMultiTitleColumn(phases, w.pendingTitles, fmt.Sprintf("hash-%x", hash), w.Func.HTML(phase, w.dot))
|
||||
w.pendingPhases = w.pendingPhases[:0]
|
||||
w.pendingTitles = w.pendingTitles[:0]
|
||||
w.flushPhases()
|
||||
}
|
||||
w.prevHash = hash
|
||||
}
|
||||
|
||||
// flushPhases collects any pending phases and titles, writes them to the html, and resets the pending slices.
|
||||
func (w *HTMLWriter) flushPhases() {
|
||||
phaseLen := len(w.pendingPhases)
|
||||
if phaseLen == 0 {
|
||||
return
|
||||
}
|
||||
phases := strings.Join(w.pendingPhases, " + ")
|
||||
w.WriteMultiTitleColumn(
|
||||
phases,
|
||||
w.pendingTitles,
|
||||
fmt.Sprintf("hash-%x", w.prevHash),
|
||||
w.Func.HTML(w.pendingPhases[phaseLen-1], w.dot),
|
||||
)
|
||||
w.pendingPhases = w.pendingPhases[:0]
|
||||
w.pendingTitles = w.pendingTitles[:0]
|
||||
}
|
||||
|
||||
// FuncLines contains source code for a function to be displayed
|
||||
// in sources column.
|
||||
type FuncLines struct {
|
||||
|
Loading…
Reference in New Issue
Block a user