Skip to content

Commit 12c286c

Browse files
committed
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: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
1 parent fc08a19 commit 12c286c

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/cmd/compile/internal/ssa/deadstore.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func dse(f *Func) {
6464
continue
6565
}
6666
if last != nil {
67-
b.Fatalf("two final stores - simultaneous live stores %s %s", last, v)
67+
b.Fatalf("two final stores - simultaneous live stores %s %s", last.LongString(), v.LongString())
6868
}
6969
last = v
7070
}

src/cmd/compile/internal/ssa/writebarrier.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -172,24 +172,23 @@ func writebarrier(f *Func) {
172172
memThen := mem
173173
memElse := mem
174174
for _, w := range stores {
175-
var val *Value
176175
ptr := w.Args[0]
177-
var typ interface{}
178-
if w.Op != OpStoreWB {
179-
typ = &ExternSymbol{Sym: w.Aux.(Type).Symbol()}
180-
}
181-
pos = w.Pos
176+
pos := w.Pos
182177

183178
var fn *obj.LSym
179+
var typ *ExternSymbol
180+
var val *Value
184181
switch w.Op {
185182
case OpStoreWB:
186183
fn = writebarrierptr
187184
val = w.Args[1]
188185
case OpMoveWB:
189186
fn = typedmemmove
190187
val = w.Args[1]
188+
typ = &ExternSymbol{Sym: w.Aux.(Type).Symbol()}
191189
case OpZeroWB:
192190
fn = typedmemclr
191+
typ = &ExternSymbol{Sym: w.Aux.(Type).Symbol()}
193192
}
194193

195194
// then block: emit write barrier call
@@ -255,7 +254,7 @@ func writebarrier(f *Func) {
255254

256255
// wbcall emits write barrier runtime call in b, returns memory.
257256
// if valIsVolatile, it moves val into temp space before making the call.
258-
func wbcall(pos src.XPos, b *Block, fn *obj.LSym, typ interface{}, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value {
257+
func wbcall(pos src.XPos, b *Block, fn *obj.LSym, typ *ExternSymbol, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value {
259258
config := b.Func.Config
260259

261260
var tmp GCNode

0 commit comments

Comments
 (0)