Commit 12c286c1 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: minor writebarrier cleanup

This CL mainly moves some work to the switch on w.Op,
to make a follow-up change simpler and clearer.

Updates #19838

Change-Id: I86f3181c380dd60960afcc24224f655276b8956c
Reviewed-on: https://go-review.googlesource.com/42010
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
parent fc08a19c
...@@ -64,7 +64,7 @@ func dse(f *Func) { ...@@ -64,7 +64,7 @@ func dse(f *Func) {
continue continue
} }
if last != nil { if last != nil {
b.Fatalf("two final stores - simultaneous live stores %s %s", last, v) b.Fatalf("two final stores - simultaneous live stores %s %s", last.LongString(), v.LongString())
} }
last = v last = v
} }
......
...@@ -172,15 +172,12 @@ func writebarrier(f *Func) { ...@@ -172,15 +172,12 @@ func writebarrier(f *Func) {
memThen := mem memThen := mem
memElse := mem memElse := mem
for _, w := range stores { for _, w := range stores {
var val *Value
ptr := w.Args[0] ptr := w.Args[0]
var typ interface{} pos := w.Pos
if w.Op != OpStoreWB {
typ = &ExternSymbol{Sym: w.Aux.(Type).Symbol()}
}
pos = w.Pos
var fn *obj.LSym var fn *obj.LSym
var typ *ExternSymbol
var val *Value
switch w.Op { switch w.Op {
case OpStoreWB: case OpStoreWB:
fn = writebarrierptr fn = writebarrierptr
...@@ -188,8 +185,10 @@ func writebarrier(f *Func) { ...@@ -188,8 +185,10 @@ func writebarrier(f *Func) {
case OpMoveWB: case OpMoveWB:
fn = typedmemmove fn = typedmemmove
val = w.Args[1] val = w.Args[1]
typ = &ExternSymbol{Sym: w.Aux.(Type).Symbol()}
case OpZeroWB: case OpZeroWB:
fn = typedmemclr fn = typedmemclr
typ = &ExternSymbol{Sym: w.Aux.(Type).Symbol()}
} }
// then block: emit write barrier call // then block: emit write barrier call
...@@ -255,7 +254,7 @@ func writebarrier(f *Func) { ...@@ -255,7 +254,7 @@ func writebarrier(f *Func) {
// wbcall emits write barrier runtime call in b, returns memory. // wbcall emits write barrier runtime call in b, returns memory.
// if valIsVolatile, it moves val into temp space before making the call. // if valIsVolatile, it moves val into temp space before making the call.
func wbcall(pos src.XPos, b *Block, fn *obj.LSym, typ interface{}, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value { func wbcall(pos src.XPos, b *Block, fn *obj.LSym, typ *ExternSymbol, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value {
config := b.Func.Config config := b.Func.Config
var tmp GCNode var tmp GCNode
......
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