Commit 87c475c2 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile/internal/ssa: use obj.LSym instead of gc.Sym

Gc's Sym type represents a package-qualified identifier, which is a
frontend concept and doesn't belong in SSA. Bonus: we can replace some
interface{} types with *obj.LSym.

Passes toolstash -cmp.

Change-Id: I456eb9957207d80f99f6eb9b8eab4a1f3263e9ed
Reviewed-on: https://go-review.googlesource.com/36415
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
parent c2bc727f
...@@ -737,7 +737,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -737,7 +737,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
q.To.Reg = r q.To.Reg = r
} }
case ssa.OpAMD64CALLstatic: case ssa.OpAMD64CALLstatic:
if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
// Deferred calls will appear to be returning to // Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit. // the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line // However, the stack trace code will show the line
...@@ -751,7 +751,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -751,7 +751,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL) p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(v.Aux.(*gc.Sym)) p.To.Sym = v.Aux.(*obj.LSym)
if gc.Maxarg < v.AuxInt { if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt gc.Maxarg = v.AuxInt
} }
...@@ -996,7 +996,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { ...@@ -996,7 +996,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
p := gc.Prog(obj.AJMP) p := gc.Prog(obj.AJMP)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(b.Aux.(*gc.Sym)) p.To.Sym = b.Aux.(*obj.LSym)
case ssa.BlockAMD64EQF: case ssa.BlockAMD64EQF:
gc.SSAGenFPJump(s, b, next, &eqfJumps) gc.SSAGenFPJump(s, b, next, &eqfJumps)
......
...@@ -635,7 +635,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -635,7 +635,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Type = obj.TYPE_REG p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg() p.To.Reg = v.Reg()
case ssa.OpARMCALLstatic: case ssa.OpARMCALLstatic:
if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
// Deferred calls will appear to be returning to // Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit. // the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line // However, the stack trace code will show the line
...@@ -649,7 +649,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -649,7 +649,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL) p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(v.Aux.(*gc.Sym)) p.To.Sym = v.Aux.(*obj.LSym)
if gc.Maxarg < v.AuxInt { if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt gc.Maxarg = v.AuxInt
} }
...@@ -898,7 +898,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { ...@@ -898,7 +898,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
p := gc.Prog(obj.ARET) p := gc.Prog(obj.ARET)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(b.Aux.(*gc.Sym)) p.To.Sym = b.Aux.(*obj.LSym)
case ssa.BlockARMEQ, ssa.BlockARMNE, case ssa.BlockARMEQ, ssa.BlockARMNE,
ssa.BlockARMLT, ssa.BlockARMGE, ssa.BlockARMLT, ssa.BlockARMGE,
......
...@@ -632,7 +632,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -632,7 +632,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p4.To.Type = obj.TYPE_BRANCH p4.To.Type = obj.TYPE_BRANCH
gc.Patch(p4, p) gc.Patch(p4, p)
case ssa.OpARM64CALLstatic: case ssa.OpARM64CALLstatic:
if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
// Deferred calls will appear to be returning to // Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit. // the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line // However, the stack trace code will show the line
...@@ -646,7 +646,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -646,7 +646,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL) p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(v.Aux.(*gc.Sym)) p.To.Sym = v.Aux.(*obj.LSym)
if gc.Maxarg < v.AuxInt { if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt gc.Maxarg = v.AuxInt
} }
...@@ -805,7 +805,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { ...@@ -805,7 +805,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
p := gc.Prog(obj.ARET) p := gc.Prog(obj.ARET)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(b.Aux.(*gc.Sym)) p.To.Sym = b.Aux.(*obj.LSym)
case ssa.BlockARM64EQ, ssa.BlockARM64NE, case ssa.BlockARM64EQ, ssa.BlockARM64NE,
ssa.BlockARM64LT, ssa.BlockARM64GE, ssa.BlockARM64LT, ssa.BlockARM64GE,
......
...@@ -794,7 +794,7 @@ func (s *state) stmt(n *Node) { ...@@ -794,7 +794,7 @@ func (s *state) stmt(n *Node) {
s.stmtList(n.List) s.stmtList(n.List)
b := s.exit() b := s.exit()
b.Kind = ssa.BlockRetJmp // override BlockRet b.Kind = ssa.BlockRetJmp // override BlockRet
b.Aux = n.Left.Sym b.Aux = Linksym(n.Left.Sym)
case OCONTINUE, OBREAK: case OCONTINUE, OBREAK:
var op string var op string
...@@ -3004,7 +3004,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value { ...@@ -3004,7 +3004,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value {
case codeptr != nil: case codeptr != nil:
call = s.newValue2(ssa.OpInterCall, ssa.TypeMem, codeptr, s.mem()) call = s.newValue2(ssa.OpInterCall, ssa.TypeMem, codeptr, s.mem())
case sym != nil: case sym != nil:
call = s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, sym, s.mem()) call = s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, Linksym(sym), s.mem())
default: default:
Fatalf("bad call type %v %v", n.Op, n) Fatalf("bad call type %v %v", n.Op, n)
} }
...@@ -3365,7 +3365,7 @@ func (s *state) rtcall(fn *Node, returns bool, results []*Type, args ...*ssa.Val ...@@ -3365,7 +3365,7 @@ func (s *state) rtcall(fn *Node, returns bool, results []*Type, args ...*ssa.Val
} }
// Issue call // Issue call
call := s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, fn.Sym, s.mem()) call := s.newValue1A(ssa.OpStaticCall, ssa.TypeMem, Linksym(fn.Sym), s.mem())
s.vars[&memVar] = call s.vars[&memVar] = call
if !returns { if !returns {
...@@ -4981,8 +4981,8 @@ func (e *ssaExport) Debug_wb() bool { ...@@ -4981,8 +4981,8 @@ func (e *ssaExport) Debug_wb() bool {
return Debug_wb != 0 return Debug_wb != 0
} }
func (e *ssaExport) Syslook(name string) interface{} { func (e *ssaExport) Syslook(name string) *obj.LSym {
return syslook(name).Sym return Linksym(syslook(name).Sym)
} }
func (n *Node) Typ() ssa.Type { func (n *Node) Typ() ssa.Type {
......
...@@ -487,7 +487,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -487,7 +487,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p6.To.Type = obj.TYPE_BRANCH p6.To.Type = obj.TYPE_BRANCH
gc.Patch(p6, p2) gc.Patch(p6, p2)
case ssa.OpMIPSCALLstatic: case ssa.OpMIPSCALLstatic:
if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
// Deferred calls will appear to be returning to // Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit. // the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line // However, the stack trace code will show the line
...@@ -501,7 +501,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -501,7 +501,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL) p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(v.Aux.(*gc.Sym)) p.To.Sym = v.Aux.(*obj.LSym)
if gc.Maxarg < v.AuxInt { if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt gc.Maxarg = v.AuxInt
} }
...@@ -873,7 +873,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { ...@@ -873,7 +873,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
p := gc.Prog(obj.ARET) p := gc.Prog(obj.ARET)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(b.Aux.(*gc.Sym)) p.To.Sym = b.Aux.(*obj.LSym)
case ssa.BlockMIPSEQ, ssa.BlockMIPSNE, case ssa.BlockMIPSEQ, ssa.BlockMIPSNE,
ssa.BlockMIPSLTZ, ssa.BlockMIPSGEZ, ssa.BlockMIPSLTZ, ssa.BlockMIPSGEZ,
ssa.BlockMIPSLEZ, ssa.BlockMIPSGTZ, ssa.BlockMIPSLEZ, ssa.BlockMIPSGTZ,
......
...@@ -490,7 +490,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -490,7 +490,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p6.To.Type = obj.TYPE_BRANCH p6.To.Type = obj.TYPE_BRANCH
gc.Patch(p6, p2) gc.Patch(p6, p2)
case ssa.OpMIPS64CALLstatic: case ssa.OpMIPS64CALLstatic:
if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
// Deferred calls will appear to be returning to // Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit. // the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line // However, the stack trace code will show the line
...@@ -504,7 +504,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -504,7 +504,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL) p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(v.Aux.(*gc.Sym)) p.To.Sym = v.Aux.(*obj.LSym)
if gc.Maxarg < v.AuxInt { if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt gc.Maxarg = v.AuxInt
} }
...@@ -638,7 +638,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { ...@@ -638,7 +638,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
p := gc.Prog(obj.ARET) p := gc.Prog(obj.ARET)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(b.Aux.(*gc.Sym)) p.To.Sym = b.Aux.(*obj.LSym)
case ssa.BlockMIPS64EQ, ssa.BlockMIPS64NE, case ssa.BlockMIPS64EQ, ssa.BlockMIPS64NE,
ssa.BlockMIPS64LTZ, ssa.BlockMIPS64GEZ, ssa.BlockMIPS64LTZ, ssa.BlockMIPS64GEZ,
ssa.BlockMIPS64LEZ, ssa.BlockMIPS64GTZ, ssa.BlockMIPS64LEZ, ssa.BlockMIPS64GTZ,
......
...@@ -687,7 +687,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -687,7 +687,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.Patch(p4, p) gc.Patch(p4, p)
case ssa.OpPPC64CALLstatic: case ssa.OpPPC64CALLstatic:
if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
// Deferred calls will appear to be returning to // Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit. // the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line // However, the stack trace code will show the line
...@@ -722,7 +722,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -722,7 +722,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL) p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(v.Aux.(*gc.Sym)) p.To.Sym = v.Aux.(*obj.LSym)
if gc.Maxarg < v.AuxInt { if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt gc.Maxarg = v.AuxInt
} }
...@@ -874,7 +874,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { ...@@ -874,7 +874,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
p := gc.Prog(obj.AJMP) p := gc.Prog(obj.AJMP)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(b.Aux.(*gc.Sym)) p.To.Sym = b.Aux.(*obj.LSym)
case ssa.BlockPPC64EQ, ssa.BlockPPC64NE, case ssa.BlockPPC64EQ, ssa.BlockPPC64NE,
ssa.BlockPPC64LT, ssa.BlockPPC64GE, ssa.BlockPPC64LT, ssa.BlockPPC64GE,
......
...@@ -473,7 +473,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -473,7 +473,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Type = obj.TYPE_REG p.To.Type = obj.TYPE_REG
p.To.Reg = r p.To.Reg = r
case ssa.OpS390XCALLstatic: case ssa.OpS390XCALLstatic:
if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
// Deferred calls will appear to be returning to // Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit. // the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line // However, the stack trace code will show the line
...@@ -487,7 +487,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -487,7 +487,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL) p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(v.Aux.(*gc.Sym)) p.To.Sym = v.Aux.(*obj.LSym)
if gc.Maxarg < v.AuxInt { if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt gc.Maxarg = v.AuxInt
} }
...@@ -835,7 +835,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { ...@@ -835,7 +835,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
p := gc.Prog(s390x.ABR) p := gc.Prog(s390x.ABR)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(b.Aux.(*gc.Sym)) p.To.Sym = b.Aux.(*obj.LSym)
case ssa.BlockS390XEQ, ssa.BlockS390XNE, case ssa.BlockS390XEQ, ssa.BlockS390XNE,
ssa.BlockS390XLT, ssa.BlockS390XGE, ssa.BlockS390XLT, ssa.BlockS390XGE,
ssa.BlockS390XLE, ssa.BlockS390XGT, ssa.BlockS390XLE, ssa.BlockS390XGT,
......
...@@ -129,7 +129,7 @@ type Frontend interface { ...@@ -129,7 +129,7 @@ type Frontend interface {
// Syslook returns a symbol of the runtime function/variable with the // Syslook returns a symbol of the runtime function/variable with the
// given name. // given name.
Syslook(string) interface{} // returns *gc.Sym Syslook(string) *obj.LSym
} }
// interface used to hold *gc.Node. We'd use *gc.Node directly but // interface used to hold *gc.Node. We'd use *gc.Node directly but
......
...@@ -16,10 +16,10 @@ var PrintFunc = printFunc ...@@ -16,10 +16,10 @@ var PrintFunc = printFunc
var Opt = opt var Opt = opt
var Deadcode = deadcode var Deadcode = deadcode
var Copyelim = copyelim var Copyelim = copyelim
var TestCtxt = obj.Linknew(&x86.Linkamd64)
func testConfig(t testing.TB) *Config { func testConfig(t testing.TB) *Config {
testCtxt := &obj.Link{Arch: &x86.Linkamd64} return NewConfig("amd64", DummyFrontend{t}, TestCtxt, true)
return NewConfig("amd64", DummyFrontend{t}, testCtxt, true)
} }
// DummyFrontend is a test-only frontend. // DummyFrontend is a test-only frontend.
...@@ -68,8 +68,8 @@ func (DummyFrontend) Line(_ src.XPos) string { ...@@ -68,8 +68,8 @@ func (DummyFrontend) Line(_ src.XPos) string {
} }
func (DummyFrontend) AllocFrame(f *Func) { func (DummyFrontend) AllocFrame(f *Func) {
} }
func (DummyFrontend) Syslook(s string) interface{} { func (DummyFrontend) Syslook(s string) *obj.LSym {
return DummySym(s) return obj.Linklookup(TestCtxt, s, 0)
} }
func (d DummyFrontend) Logf(msg string, args ...interface{}) { d.t.Logf(msg, args...) } func (d DummyFrontend) Logf(msg string, args ...interface{}) { d.t.Logf(msg, args...) }
...@@ -100,7 +100,3 @@ func (d DummyFrontend) CanSSA(t Type) bool { ...@@ -100,7 +100,3 @@ func (d DummyFrontend) CanSSA(t Type) bool {
// There are no un-SSAable types in dummy land. // There are no un-SSAable types in dummy land.
return true return true
} }
type DummySym string
func (s DummySym) String() string { return string(s) }
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
package ssa package ssa
import ( import (
"cmd/internal/obj"
"cmd/internal/src" "cmd/internal/src"
"fmt"
) )
// writebarrier expands write barrier ops (StoreWB, MoveWB, etc.) into // writebarrier expands write barrier ops (StoreWB, MoveWB, etc.) into
...@@ -31,7 +31,7 @@ import ( ...@@ -31,7 +31,7 @@ import (
// number of blocks as fuse merges blocks introduced in this phase. // number of blocks as fuse merges blocks introduced in this phase.
func writebarrier(f *Func) { func writebarrier(f *Func) {
var sb, sp, wbaddr *Value var sb, sp, wbaddr *Value
var writebarrierptr, typedmemmove, typedmemclr interface{} // *gc.Sym var writebarrierptr, typedmemmove, typedmemclr *obj.LSym
var storeWBs, others []*Value var storeWBs, others []*Value
var wbs *sparseSet var wbs *sparseSet
for _, b := range f.Blocks { // range loop is safe since the blocks we added contain no WB stores for _, b := range f.Blocks { // range loop is safe since the blocks we added contain no WB stores
...@@ -71,7 +71,7 @@ func writebarrier(f *Func) { ...@@ -71,7 +71,7 @@ func writebarrier(f *Func) {
if sp == nil { if sp == nil {
sp = f.Entry.NewValue0(initln, OpSP, f.Config.fe.TypeUintptr()) sp = f.Entry.NewValue0(initln, OpSP, f.Config.fe.TypeUintptr())
} }
wbsym := &ExternSymbol{Typ: f.Config.fe.TypeBool(), Sym: f.Config.fe.Syslook("writeBarrier").(fmt.Stringer)} wbsym := &ExternSymbol{Typ: f.Config.fe.TypeBool(), Sym: f.Config.fe.Syslook("writeBarrier")}
wbaddr = f.Entry.NewValue1A(initln, OpAddr, f.Config.fe.TypeUInt32().PtrTo(), wbsym, sb) wbaddr = f.Entry.NewValue1A(initln, OpAddr, f.Config.fe.TypeUInt32().PtrTo(), wbsym, sb)
writebarrierptr = f.Config.fe.Syslook("writebarrierptr") writebarrierptr = f.Config.fe.Syslook("writebarrierptr")
typedmemmove = f.Config.fe.Syslook("typedmemmove") typedmemmove = f.Config.fe.Syslook("typedmemmove")
...@@ -162,7 +162,7 @@ func writebarrier(f *Func) { ...@@ -162,7 +162,7 @@ func writebarrier(f *Func) {
typ := w.Aux // only non-nil for MoveWB, MoveWBVolatile, ZeroWB typ := w.Aux // only non-nil for MoveWB, MoveWBVolatile, ZeroWB
var op Op var op Op
var fn interface{} // *gc.Sym var fn *obj.LSym
switch w.Op { switch w.Op {
case OpStoreWB: case OpStoreWB:
op = OpStore op = OpStore
...@@ -240,7 +240,7 @@ func writebarrier(f *Func) { ...@@ -240,7 +240,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 interface{}, typ interface{}, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value { func wbcall(pos src.XPos, b *Block, fn *obj.LSym, typ interface{}, ptr, val, mem, sp, sb *Value, valIsVolatile bool) *Value {
config := b.Func.Config config := b.Func.Config
var tmp GCNode var tmp GCNode
......
...@@ -660,7 +660,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -660,7 +660,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
q.To.Reg = r q.To.Reg = r
} }
case ssa.Op386CALLstatic: case ssa.Op386CALLstatic:
if v.Aux.(*gc.Sym) == gc.Deferreturn.Sym { if v.Aux.(*obj.LSym) == gc.Linksym(gc.Deferreturn.Sym) {
// Deferred calls will appear to be returning to // Deferred calls will appear to be returning to
// the CALL deferreturn(SB) that we are about to emit. // the CALL deferreturn(SB) that we are about to emit.
// However, the stack trace code will show the line // However, the stack trace code will show the line
...@@ -674,7 +674,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { ...@@ -674,7 +674,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p := gc.Prog(obj.ACALL) p := gc.Prog(obj.ACALL)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(v.Aux.(*gc.Sym)) p.To.Sym = v.Aux.(*obj.LSym)
if gc.Maxarg < v.AuxInt { if gc.Maxarg < v.AuxInt {
gc.Maxarg = v.AuxInt gc.Maxarg = v.AuxInt
} }
...@@ -864,7 +864,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) { ...@@ -864,7 +864,7 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
p := gc.Prog(obj.AJMP) p := gc.Prog(obj.AJMP)
p.To.Type = obj.TYPE_MEM p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN p.To.Name = obj.NAME_EXTERN
p.To.Sym = gc.Linksym(b.Aux.(*gc.Sym)) p.To.Sym = b.Aux.(*obj.LSym)
case ssa.Block386EQF: case ssa.Block386EQF:
gc.SSAGenFPJump(s, b, next, &eqfJumps) gc.SSAGenFPJump(s, b, next, &eqfJumps)
......
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