Commit 595426c0 authored by David Chase's avatar David Chase

cmd/compile: fix OASWB rewriting in racewalk

Special case for rewriting OAS inits omitted OASWB, added
that and OAS2FUNC.  The special case cannot be default case,
that causes racewalk to fail in horrible ways.

Fixes #16008.

Change-Id: Ie0d2f5735fe9d8255a109597b36d196d4f86703a
Reviewed-on: https://go-review.googlesource.com/23954Reviewed-by: default avatarKeith Randall <khr@golang.org>
Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 2ba3d5fc
...@@ -164,7 +164,7 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) { ...@@ -164,7 +164,7 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
var outn Nodes var outn Nodes
outn.Set(out) outn.Set(out)
instrumentnode(&ls[i], &outn, 0, 0) instrumentnode(&ls[i], &outn, 0, 0)
if ls[i].Op != OAS || ls[i].Ninit.Len() == 0 { if ls[i].Op != OAS && ls[i].Op != OASWB && ls[i].Op != OAS2FUNC || ls[i].Ninit.Len() == 0 {
out = append(outn.Slice(), ls[i]) out = append(outn.Slice(), ls[i])
} else { } else {
// Splice outn onto end of ls[i].Ninit // Splice outn onto end of ls[i].Ninit
......
// errorcheck -0 -race
package foo
const benchmarkNumNodes = 10000
func BenchmarkUpdateNodeTransaction(b B) {
s, nodeIDs := setupNodes(benchmarkNumNodes)
b.ResetTimer()
for i := 0; i < b.N(); i++ {
_ = s.Update(func(tx1 Tx) error {
_ = UpdateNode(tx1, &Node{
ID: nodeIDs[i%benchmarkNumNodes],
})
return nil
})
}
}
type B interface {
ResetTimer()
N() int
}
type Tx interface {
}
type Node struct {
ID string
}
type MemoryStore struct {
}
// go:noinline
func setupNodes(n int) (s *MemoryStore, nodeIDs []string) {
return
}
//go:noinline
func (s *MemoryStore) Update(cb func(Tx) error) error {
return nil
}
var sink interface{}
//go:noinline
func UpdateNode(tx Tx, n *Node) error {
sink = tx
sink = n
return nil
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment