diff options
author | Austin Clements <austin@google.com> | 2018-01-15 12:27:17 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2018-02-13 16:34:46 +0000 |
commit | 20101894078199a3a9014ca99ec4e2a0a16a0869 (patch) | |
tree | 8e7ff5c0fcc37243fcd39ba23ea2976503712f63 /src/cmd/compile/internal/ssa/writebarrier.go | |
parent | 245310883dcae717bb662b22d5b1fd07fdd59b76 (diff) | |
download | go-20101894078199a3a9014ca99ec4e2a0a16a0869.tar.gz go-20101894078199a3a9014ca99ec4e2a0a16a0869.zip |
runtime: remove legacy eager write barrier
Now that the buffered write barrier is implemented for all
architectures, we can remove the old eager write barrier
implementation. This CL removes the implementation from the runtime,
support in the compiler for calling it, and updates some compiler
tests that relied on the old eager barrier support. It also makes sure
that all of the useful comments from the old write barrier
implementation still have a place to live.
Fixes #22460.
Updates #21640 since this fixes the layering concerns of the write
barrier (but not the other things in that issue).
Change-Id: I580f93c152e89607e0a72fe43370237ba97bae74
Reviewed-on: https://go-review.googlesource.com/92705
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/writebarrier.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/writebarrier.go | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/cmd/compile/internal/ssa/writebarrier.go b/src/cmd/compile/internal/ssa/writebarrier.go index b711d8d2bf..c41a677159 100644 --- a/src/cmd/compile/internal/ssa/writebarrier.go +++ b/src/cmd/compile/internal/ssa/writebarrier.go @@ -31,7 +31,7 @@ func needwb(v *Value) bool { // and runtime calls, like // // if writeBarrier.enabled { -// writebarrierptr(ptr, val) +// gcWriteBarrier(ptr, val) // Not a regular Go call // } else { // *ptr = val // } @@ -44,7 +44,7 @@ func writebarrier(f *Func) { } var sb, sp, wbaddr, const0 *Value - var writebarrierptr, typedmemmove, typedmemclr, gcWriteBarrier *obj.LSym + var typedmemmove, typedmemclr, gcWriteBarrier *obj.LSym var stores, after []*Value var sset *sparseSet var storeNumber []int32 @@ -96,10 +96,7 @@ func writebarrier(f *Func) { } wbsym := f.fe.Syslook("writeBarrier") wbaddr = f.Entry.NewValue1A(initpos, OpAddr, f.Config.Types.UInt32Ptr, wbsym, sb) - writebarrierptr = f.fe.Syslook("writebarrierptr") - if !f.fe.Debug_eagerwb() { - gcWriteBarrier = f.fe.Syslook("gcWriteBarrier") - } + gcWriteBarrier = f.fe.Syslook("gcWriteBarrier") typedmemmove = f.fe.Syslook("typedmemmove") typedmemclr = f.fe.Syslook("typedmemclr") const0 = f.ConstInt32(initpos, f.Config.Types.UInt32, 0) @@ -198,7 +195,6 @@ func writebarrier(f *Func) { var val *Value switch w.Op { case OpStoreWB: - fn = writebarrierptr val = w.Args[1] nWBops-- case OpMoveWB: @@ -217,11 +213,13 @@ func writebarrier(f *Func) { switch w.Op { case OpStoreWB, OpMoveWB, OpZeroWB: volatile := w.Op == OpMoveWB && isVolatile(val) - if w.Op == OpStoreWB && !f.fe.Debug_eagerwb() { + if w.Op == OpStoreWB { memThen = bThen.NewValue3A(pos, OpWB, types.TypeMem, gcWriteBarrier, ptr, val, memThen) } else { memThen = wbcall(pos, bThen, fn, typ, ptr, val, memThen, sp, sb, volatile) } + // Note that we set up a writebarrier function call. + f.fe.SetWBPos(pos) case OpVarDef, OpVarLive, OpVarKill: memThen = bThen.NewValue1A(pos, w.Op, types.TypeMem, w.Aux, memThen) } @@ -239,11 +237,6 @@ func writebarrier(f *Func) { case OpVarDef, OpVarLive, OpVarKill: memElse = bElse.NewValue1A(pos, w.Op, types.TypeMem, w.Aux, memElse) } - - if fn != nil { - // Note that we set up a writebarrier function call. - f.fe.SetWBPos(pos) - } } // merge memory |