Commit 4ee4607c authored by LE Manh Cuong's avatar LE Manh Cuong Committed by Brad Fitzpatrick

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent c6f9321b
// 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
......@@ -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))
......
// 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
......@@ -90,6 +90,7 @@ var bootstrapDirs = []string{
"debug/macho",
"debug/pe",
"internal/goversion",
"internal/race",
"internal/xcoff",
"math/big",
"math/bits",
......
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