diff options
| author | Russ Cox <rsc@golang.org> | 2015-04-17 00:34:18 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-04-24 14:39:49 +0000 |
| commit | 9406f68e6afd02fd588e8ca05ebb729a4f4b8d0d (patch) | |
| tree | 7a6faf84692f7270855e513eef0dcfb6e0be907b /src | |
| parent | 80f575b78fceeba3ab5ec5a5f08b26725734b341 (diff) | |
| download | go-9406f68e6afd02fd588e8ca05ebb729a4f4b8d0d.tar.xz | |
cmd/internal/gc: add and test write barrier debug output
We can expand the test cases as we discover problems.
This is some basic tests plus all the things I got wrong
in some recent work.
Change-Id: Id875fcfaf74eb087ae42b441fe47a34c5b8ccb39
Reviewed-on: https://go-review.googlesource.com/9158
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/internal/gc/lex.go | 3 | ||||
| -rw-r--r-- | src/cmd/internal/gc/walk.go | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/internal/gc/lex.go b/src/cmd/internal/gc/lex.go index fc2963f8a3..5600d90df2 100644 --- a/src/cmd/internal/gc/lex.go +++ b/src/cmd/internal/gc/lex.go @@ -35,6 +35,8 @@ var goarch string var goroot string +var Debug_wb int + // Debug arguments. // These can be specified with the -d flag, as in "-d nil" // to set the debug_checknil variable. In general the list passed @@ -46,6 +48,7 @@ var debugtab = []struct { {"nil", &Debug_checknil}, // print information about nil checks {"typeassert", &Debug_typeassert}, // print information about type assertion inlining {"disablenil", &Disable_checknil}, // disable nil checks + {"wb", &Debug_wb}, // print information about write barriers } // Our own isdigit, isspace, isalpha, isalnum that take care diff --git a/src/cmd/internal/gc/walk.go b/src/cmd/internal/gc/walk.go index 72fac03371..043edc9f4f 100644 --- a/src/cmd/internal/gc/walk.go +++ b/src/cmd/internal/gc/walk.go @@ -2218,6 +2218,9 @@ func applywritebarrier(n *Node, init **NodeList) *Node { if Curfn != nil && Curfn.Func.Nowritebarrier { Yyerror("write barrier prohibited") } + if Debug_wb > 0 { + Warnl(int(n.Lineno), "write barrier") + } t := n.Left.Type l := Nod(OADDR, n.Left, nil) l.Etype = 1 // addr does not escape |
