mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: separate nowritebarrierrec from main
Main knows a bit too much about nowritebarrierrec. Abstract the API a little bit to make the package split easier. Change-Id: I4b76bdb1fed73dfb0d44e1a6c86de8c2d29a9488 Reviewed-on: https://go-review.googlesource.com/c/go/+/279301 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
e999c17022
commit
1a523c8ab0
2 changed files with 16 additions and 9 deletions
|
|
@ -15,7 +15,18 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Declaration stack & operations
|
func EnableNoWriteBarrierRecCheck() {
|
||||||
|
nowritebarrierrecCheck = newNowritebarrierrecChecker()
|
||||||
|
}
|
||||||
|
|
||||||
|
func NoWriteBarrierRecCheck() {
|
||||||
|
// Write barriers are now known. Check the
|
||||||
|
// call graph.
|
||||||
|
nowritebarrierrecCheck.check()
|
||||||
|
nowritebarrierrecCheck = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var nowritebarrierrecCheck *nowritebarrierrecChecker
|
||||||
|
|
||||||
func testdclstack() {
|
func testdclstack() {
|
||||||
if !types.IsDclstackValid() {
|
if !types.IsDclstackValid() {
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ var Target *ir.Package
|
||||||
// timing data for compiler phases
|
// timing data for compiler phases
|
||||||
var timings Timings
|
var timings Timings
|
||||||
|
|
||||||
var nowritebarrierrecCheck *nowritebarrierrecChecker
|
|
||||||
|
|
||||||
// Main parses flags and Go source files specified in the command-line
|
// Main parses flags and Go source files specified in the command-line
|
||||||
// arguments, type-checks the parsed Go package, compiles functions to machine
|
// arguments, type-checks the parsed Go package, compiles functions to machine
|
||||||
// code, and finally writes the compiled package definition to disk.
|
// code, and finally writes the compiled package definition to disk.
|
||||||
|
|
@ -382,7 +380,7 @@ func Main(archInit func(*Arch)) {
|
||||||
// We'll do the final check after write barriers are
|
// We'll do the final check after write barriers are
|
||||||
// inserted.
|
// inserted.
|
||||||
if base.Flag.CompilingRuntime {
|
if base.Flag.CompilingRuntime {
|
||||||
nowritebarrierrecCheck = newNowritebarrierrecChecker()
|
EnableNoWriteBarrierRecCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Phase 7: Transform closure bodies to properly reference captured variables.
|
// Phase 7: Transform closure bodies to properly reference captured variables.
|
||||||
|
|
@ -422,11 +420,9 @@ func Main(archInit func(*Arch)) {
|
||||||
|
|
||||||
compileFunctions()
|
compileFunctions()
|
||||||
|
|
||||||
if nowritebarrierrecCheck != nil {
|
if base.Flag.CompilingRuntime {
|
||||||
// Write barriers are now known. Check the
|
// Write barriers are now known. Check the call graph.
|
||||||
// call graph.
|
NoWriteBarrierRecCheck()
|
||||||
nowritebarrierrecCheck.check()
|
|
||||||
nowritebarrierrecCheck = nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finalize DWARF inline routine DIEs, then explicitly turn off
|
// Finalize DWARF inline routine DIEs, then explicitly turn off
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue