cmd/compile: use internal/race

CL 14870 added internal/race to factor out duplicated race thunks,
we should use it.

No signification changes in compile time and compile binary size.

Change-Id: I786af44dd5bb0f4ab6709432eeb603f27a5b6c63
Reviewed-on: https://go-review.googlesource.com/c/go/+/178118
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
LE Manh Cuong 2019-05-20 15:07:01 +07:00 committed by Brad Fitzpatrick
parent c6f9321b5a
commit 4ee4607c97
4 changed files with 4 additions and 20 deletions

View File

@ -1,9 +0,0 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !race
package gc
const raceEnabled = false

View File

@ -13,6 +13,7 @@ import (
"cmd/internal/src"
"cmd/internal/sys"
"fmt"
"internal/race"
"math/rand"
"sort"
"sync"
@ -325,7 +326,7 @@ func compileSSA(fn *Node, worker int) {
}
func init() {
if raceEnabled {
if race.Enabled {
rand.Seed(time.Now().UnixNano())
}
}
@ -336,7 +337,7 @@ func init() {
func compileFunctions() {
if len(compilequeue) != 0 {
sizeCalculationDisabled = true // not safe to calculate sizes concurrently
if raceEnabled {
if race.Enabled {
// Randomize compilation order to try to shake out races.
tmp := make([]*Node, len(compilequeue))
perm := rand.Perm(len(compilequeue))

View File

@ -1,9 +0,0 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build race
package gc
const raceEnabled = true

View File

@ -90,6 +90,7 @@ var bootstrapDirs = []string{
"debug/macho",
"debug/pe",
"internal/goversion",
"internal/race",
"internal/xcoff",
"math/big",
"math/bits",