| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Inline and remove ngotype.
ex {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/reflectdata"
var n ir.Node
ngotype(n) -> reflectdata.TypeSym(n.Type())
}
rm ngotype
mv recordFlags RecordFlags
mv recordPackageName RecordPackageName
mv RecordFlags RecordPackageName dwarf.go
mv debuginfo Info
mv genAbstractFunc AbstractFunc
mv scope.go scope_test.go dwarf.go dwinl.go cmd/compile/internal/dwarfgen
'
Change-Id: I31fa982900dbba2066ca4c7a706af922e5481c70
Reviewed-on: https://go-review.googlesource.com/c/go/+/279477
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that the generic graph structure methods - Left, Right, and so on -
have been removed from the Node interface, each implementation's uses
can be replaced with direct field access, using more specific names,
and the methods themselves can be deleted.
Passes buildall w/ toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/ir
rf '
mv Func.iota Func.Iota_
mv Name.fn Name.Func_
'
cd ../gc
rf '
ex . ../ir {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/types"
var ns ir.Nodes
var b bool
var i64 int64
var n ir.Node
var op ir.Op
var sym *types.Sym
var class ir.Class
var decl *ir.Decl
decl.Left() -> decl.X
decl.SetLeft(n) -> decl.X = n
var asl *ir.AssignListStmt
asl.List() -> asl.Lhs
asl.PtrList() -> &asl.Lhs
asl.SetList(ns) -> asl.Lhs = ns
asl.Rlist() -> asl.Rhs
asl.PtrRlist() -> &asl.Rhs
asl.SetRlist(ns) -> asl.Rhs = ns
asl.Colas() -> asl.Def
asl.SetColas(b) -> asl.Def = b
var as *ir.AssignStmt
as.Left() -> as.X
as.SetLeft(n) -> as.X = n
as.Right() -> as.Y
as.SetRight(n) -> as.Y = n
as.Colas() -> as.Def
as.SetColas(b) -> as.Def = b
var ao *ir.AssignOpStmt
ao.Left() -> ao.X
ao.SetLeft(n) -> ao.X = n
ao.Right() -> ao.Y
ao.SetRight(n) -> ao.Y = n
ao.SubOp() -> ao.AsOp
ao.SetSubOp(op) -> ao.AsOp = op
ao.Implicit() -> ao.IncDec
ao.SetImplicit(b) -> ao.IncDec = b
var bl *ir.BlockStmt
bl.List() -> bl.List_
bl.PtrList() -> &bl.List_
bl.SetList(ns) -> bl.List_ = ns
var br *ir.BranchStmt
br.Sym() -> br.Label
br.SetSym(sym) -> br.Label = sym
var cas *ir.CaseStmt
cas.List() -> cas.List_
cas.PtrList() -> &cas.List_
cas.SetList(ns) -> cas.List_ = ns
cas.Body() -> cas.Body_
cas.PtrBody() -> &cas.Body_
cas.SetBody(ns) -> cas.Body_ = ns
cas.Rlist() -> cas.Vars
cas.PtrRlist() -> &cas.Vars
cas.SetRlist(ns) -> cas.Vars = ns
cas.Left() -> cas.Comm
cas.SetLeft(n) -> cas.Comm = n
var fr *ir.ForStmt
fr.Sym() -> fr.Label
fr.SetSym(sym) -> fr.Label = sym
fr.Left() -> fr.Cond
fr.SetLeft(n) -> fr.Cond = n
fr.Right() -> fr.Post
fr.SetRight(n) -> fr.Post = n
fr.Body() -> fr.Body_
fr.PtrBody() -> &fr.Body_
fr.SetBody(ns) -> fr.Body_ = ns
fr.List() -> fr.Late
fr.PtrList() -> &fr.Late
fr.SetList(ns) -> fr.Late = ns
fr.HasBreak() -> fr.HasBreak_
fr.SetHasBreak(b) -> fr.HasBreak_ = b
var gs *ir.GoDeferStmt
gs.Left() -> gs.Call
gs.SetLeft(n) -> gs.Call = n
var ifs *ir.IfStmt
ifs.Left() -> ifs.Cond
ifs.SetLeft(n) -> ifs.Cond = n
ifs.Body() -> ifs.Body_
ifs.PtrBody() -> &ifs.Body_
ifs.SetBody(ns) -> ifs.Body_ = ns
ifs.Rlist() -> ifs.Else
ifs.PtrRlist() -> &ifs.Else
ifs.SetRlist(ns) -> ifs.Else = ns
ifs.Likely() -> ifs.Likely_
ifs.SetLikely(b) -> ifs.Likely_ = b
var im *ir.InlineMarkStmt
im.Offset() -> im.Index
im.SetOffset(i64) -> im.Index = i64
var lab *ir.LabelStmt
lab.Sym() -> lab.Label
lab.SetSym(sym) -> lab.Label = sym
var rng *ir.RangeStmt
rng.Sym() -> rng.Label
rng.SetSym(sym) -> rng.Label = sym
rng.Right() -> rng.X
rng.SetRight(n) -> rng.X = n
rng.Body() -> rng.Body_
rng.PtrBody() -> &rng.Body_
rng.SetBody(ns) -> rng.Body_ = ns
rng.List() -> rng.Vars
rng.PtrList() -> &rng.Vars
rng.SetList(ns) -> rng.Vars = ns
rng.HasBreak() -> rng.HasBreak_
rng.SetHasBreak(b) -> rng.HasBreak_ = b
rng.Colas() -> rng.Def
rng.SetColas(b) -> rng.Def = b
var ret *ir.ReturnStmt
ret.List() -> ret.Results
ret.PtrList() -> &ret.Results
ret.SetList(ns) -> ret.Results = ns
var sel *ir.SelectStmt
sel.List() -> sel.Cases
sel.PtrList() -> &sel.Cases
sel.SetList(ns) -> sel.Cases = ns
sel.Sym() -> sel.Label
sel.SetSym(sym) -> sel.Label = sym
sel.HasBreak() -> sel.HasBreak_
sel.SetHasBreak(b) -> sel.HasBreak_ = b
sel.Body() -> sel.Compiled
sel.PtrBody() -> &sel.Compiled
sel.SetBody(ns) -> sel.Compiled = ns
var send *ir.SendStmt
send.Left() -> send.Chan
send.SetLeft(n) -> send.Chan = n
send.Right() -> send.Value
send.SetRight(n) -> send.Value = n
var sw *ir.SwitchStmt
sw.Left() -> sw.Tag
sw.SetLeft(n) -> sw.Tag = n
sw.List() -> sw.Cases
sw.PtrList() -> &sw.Cases
sw.SetList(ns) -> sw.Cases = ns
sw.Body() -> sw.Compiled
sw.PtrBody() -> &sw.Compiled
sw.SetBody(ns) -> sw.Compiled = ns
sw.Sym() -> sw.Label
sw.SetSym(sym) -> sw.Label = sym
sw.HasBreak() -> sw.HasBreak_
sw.SetHasBreak(b) -> sw.HasBreak_ = b
var tg *ir.TypeSwitchGuard
tg.Left() -> tg.Tag
tg.SetLeft(nil) -> tg.Tag = nil
tg.SetLeft(n) -> tg.Tag = n.(*ir.Ident)
tg.Right() -> tg.X
tg.SetRight(n) -> tg.X = n
var adds *ir.AddStringExpr
adds.List() -> adds.List_
adds.PtrList() -> &adds.List_
adds.SetList(ns) -> adds.List_ = ns
var addr *ir.AddrExpr
addr.Left() -> addr.X
addr.SetLeft(n) -> addr.X = n
addr.Right() -> addr.Alloc
addr.SetRight(n) -> addr.Alloc = n
var bin *ir.BinaryExpr
bin.Left() -> bin.X
bin.SetLeft(n) -> bin.X = n
bin.Right() -> bin.Y
bin.SetRight(n) -> bin.Y = n
var log *ir.LogicalExpr
log.Left() -> log.X
log.SetLeft(n) -> log.X = n
log.Right() -> log.Y
log.SetRight(n) -> log.Y = n
var call *ir.CallExpr
call.Left() -> call.X
call.SetLeft(n) -> call.X = n
call.List() -> call.Args
call.PtrList() -> &call.Args
call.SetList(ns) -> call.Args = ns
call.Rlist() -> call.Rargs
call.PtrRlist() -> &call.Rargs
call.SetRlist(ns) -> call.Rargs = ns
call.IsDDD() -> call.DDD
call.SetIsDDD(b) -> call.DDD = b
call.NoInline() -> call.NoInline_
call.SetNoInline(b) -> call.NoInline_ = b
call.Body() -> call.Body_
call.PtrBody() -> &call.Body_
call.SetBody(ns) -> call.Body_ = ns
var cp *ir.CallPartExpr
cp.Func() -> cp.Func_
cp.Left() -> cp.X
cp.SetLeft(n) -> cp.X = n
cp.Sym() -> cp.Method.Sym
var clo *ir.ClosureExpr
clo.Func() -> clo.Func_
var cr *ir.ClosureReadExpr
cr.Offset() -> cr.Offset_
var cl *ir.CompLitExpr
cl.Right() -> cl.Ntype
cl.SetRight(nil) -> cl.Ntype = nil
cl.SetRight(n) -> cl.Ntype = ir.Node(n).(ir.Ntype)
cl.List() -> cl.List_
cl.PtrList() -> &cl.List_
cl.SetList(ns) -> cl.List_ = ns
var conv *ir.ConvExpr
conv.Left() -> conv.X
conv.SetLeft(n) -> conv.X = n
var ix *ir.IndexExpr
ix.Left() -> ix.X
ix.SetLeft(n) -> ix.X = n
ix.Right() -> ix.Index
ix.SetRight(n) -> ix.Index = n
ix.IndexMapLValue() -> ix.Assigned
ix.SetIndexMapLValue(b) -> ix.Assigned = b
var kv *ir.KeyExpr
kv.Left() -> kv.Key
kv.SetLeft(n) -> kv.Key = n
kv.Right() -> kv.Value
kv.SetRight(n) -> kv.Value = n
var sk *ir.StructKeyExpr
sk.Sym() -> sk.Field
sk.SetSym(sym) -> sk.Field = sym
sk.Left() -> sk.Value
sk.SetLeft(n) -> sk.Value = n
sk.Offset() -> sk.Offset_
sk.SetOffset(i64) -> sk.Offset_ = i64
var ic *ir.InlinedCallExpr
ic.Body() -> ic.Body_
ic.PtrBody() -> &ic.Body_
ic.SetBody(ns) -> ic.Body_ = ns
ic.Rlist() -> ic.ReturnVars
ic.PtrRlist() -> &ic.ReturnVars
ic.SetRlist(ns) -> ic.ReturnVars = ns
var mak *ir.MakeExpr
mak.Left() -> mak.Len
mak.SetLeft(n) -> mak.Len = n
mak.Right() -> mak.Cap
mak.SetRight(n) -> mak.Cap = n
var par *ir.ParenExpr
par.Left() -> par.X
par.SetLeft(n) -> par.X = n
var res *ir.ResultExpr
res.Offset() -> res.Offset_
res.SetOffset(i64) -> res.Offset_ = i64
var dot *ir.SelectorExpr
dot.Left() -> dot.X
dot.SetLeft(n) -> dot.X = n
dot.Sym() -> dot.Sel
dot.SetSym(sym) -> dot.Sel = sym
dot.Offset() -> dot.Offset_
dot.SetOffset(i64) -> dot.Offset_ = i64
var sl *ir.SliceExpr
sl.Left() -> sl.X
sl.SetLeft(n) -> sl.X = n
sl.List() -> sl.List_
sl.PtrList() -> &sl.List_
sl.SetList(ns) -> sl.List_ = ns
var sh *ir.SliceHeaderExpr
sh.Left() -> sh.Ptr
sh.SetLeft(n) -> sh.Ptr = n
sh.List() -> sh.LenCap_
sh.PtrList() -> &sh.LenCap_
sh.SetList(ns) -> sh.LenCap_ = ns
var st *ir.StarExpr
st.Left() -> st.X
st.SetLeft(n) -> st.X = n
var ta *ir.TypeAssertExpr
ta.Left() -> ta.X
ta.SetLeft(n) -> ta.X = n
ta.Right() -> ta.Ntype
ta.SetRight(n) -> ta.Ntype = n
ta.List() -> ta.Itab
ta.PtrList() -> &ta.Itab
ta.SetList(ns) -> ta.Itab = ns
var u *ir.UnaryExpr
u.Left() -> u.X
u.SetLeft(n) -> u.X = n
var fn *ir.Func
fn.Body() -> fn.Body_
fn.PtrBody() -> &fn.Body_
fn.SetBody(ns) -> fn.Body_ = ns
fn.Iota() -> fn.Iota_
fn.SetIota(i64) -> fn.Iota_ = i64
fn.Func() -> fn
var nam *ir.Name
nam.SubOp() -> nam.BuiltinOp
nam.SetSubOp(op) -> nam.BuiltinOp = op
nam.Class() -> nam.Class_
nam.SetClass(class) -> nam.Class_ = class
nam.Func() -> nam.Func_
nam.Offset() -> nam.Offset_
nam.SetOffset(i64) -> nam.Offset_ = i64
}
ex . ../ir {
import "cmd/compile/internal/ir"
var n ir.Nodes
(&n).Append -> n.Append
(&n).AppendNodes -> n.AppendNodes
(&n).MoveNodes -> n.MoveNodes
(&n).Prepend -> n.Prepend
(&n).Set -> n.Set
(&n).Set1 -> n.Set1
(&n).Set2 -> n.Set2
(&n).Set3 -> n.Set3
var ntype ir.Ntype
ir.Node(ntype).(ir.Ntype) -> ntype
}
'
cd ../ir
rf '
rm \
Decl.Left Decl.SetLeft \
AssignListStmt.List AssignListStmt.PtrList AssignListStmt.SetList \
AssignListStmt.Rlist AssignListStmt.PtrRlist AssignListStmt.SetRlist \
AssignListStmt.Colas AssignListStmt.SetColas \
AssignStmt.Left AssignStmt.SetLeft \
AssignStmt.Right AssignStmt.SetRight \
AssignStmt.Colas AssignStmt.SetColas \
AssignOpStmt.Left AssignOpStmt.SetLeft \
AssignOpStmt.Right AssignOpStmt.SetRight \
AssignOpStmt.SubOp AssignOpStmt.SetSubOp \
AssignOpStmt.Implicit AssignOpStmt.SetImplicit \
BlockStmt.List BlockStmt.PtrList BlockStmt.SetList \
BranchStmt.SetSym \
CaseStmt.List CaseStmt.PtrList CaseStmt.SetList \
CaseStmt.Body CaseStmt.PtrBody CaseStmt.SetBody \
CaseStmt.Rlist CaseStmt.PtrRlist CaseStmt.SetRlist \
CaseStmt.Left CaseStmt.SetLeft \
ForStmt.Left ForStmt.SetLeft \
ForStmt.Right ForStmt.SetRight \
ForStmt.Body ForStmt.PtrBody ForStmt.SetBody \
ForStmt.List ForStmt.PtrList ForStmt.SetList \
ForStmt.HasBreak ForStmt.SetHasBreak \
ForStmt.Sym ForStmt.SetSym \
GoDeferStmt.Left GoDeferStmt.SetLeft \
IfStmt.Left IfStmt.SetLeft \
IfStmt.Body IfStmt.PtrBody IfStmt.SetBody \
IfStmt.Rlist IfStmt.PtrRlist IfStmt.SetRlist \
IfStmt.Likely IfStmt.SetLikely \
LabelStmt.SetSym \
RangeStmt.Right RangeStmt.SetRight \
RangeStmt.Body RangeStmt.PtrBody RangeStmt.SetBody \
RangeStmt.List RangeStmt.PtrList RangeStmt.SetList \
RangeStmt.HasBreak RangeStmt.SetHasBreak \
RangeStmt.Colas RangeStmt.SetColas \
RangeStmt.Sym RangeStmt.SetSym \
ReturnStmt.List ReturnStmt.PtrList ReturnStmt.SetList \
SelectStmt.List SelectStmt.PtrList SelectStmt.SetList \
SelectStmt.HasBreak SelectStmt.SetHasBreak \
SelectStmt.Body SelectStmt.PtrBody SelectStmt.SetBody \
SelectStmt.Sym SelectStmt.SetSym \
SendStmt.Left SendStmt.SetLeft \
SendStmt.Right SendStmt.SetRight \
SwitchStmt.Left SwitchStmt.SetLeft \
SwitchStmt.List SwitchStmt.PtrList SwitchStmt.SetList \
SwitchStmt.Body SwitchStmt.PtrBody SwitchStmt.SetBody \
SwitchStmt.HasBreak SwitchStmt.SetHasBreak \
SwitchStmt.Sym SwitchStmt.SetSym \
TypeSwitchGuard.Left TypeSwitchGuard.SetLeft \
TypeSwitchGuard.Right TypeSwitchGuard.SetRight \
AddStringExpr.List AddStringExpr.PtrList AddStringExpr.SetList \
AddrExpr.Left AddrExpr.SetLeft \
AddrExpr.Right AddrExpr.SetRight \
BinaryExpr.Left BinaryExpr.SetLeft \
BinaryExpr.Right BinaryExpr.SetRight \
LogicalExpr.Left LogicalExpr.SetLeft \
LogicalExpr.Right LogicalExpr.SetRight \
CallExpr.Left CallExpr.SetLeft \
CallExpr.List CallExpr.PtrList CallExpr.SetList \
CallExpr.Rlist CallExpr.PtrRlist CallExpr.SetRlist \
CallExpr.NoInline CallExpr.SetNoInline \
CallExpr.Body CallExpr.PtrBody CallExpr.SetBody \
CallExpr.IsDDD CallExpr.SetIsDDD \
CallPartExpr.Left CallPartExpr.SetLeft \
ClosureReadExpr.Offset \
ClosureReadExpr.Type \ # provided by miniExpr already
CompLitExpr.Right CompLitExpr.SetRight \
CompLitExpr.List CompLitExpr.PtrList CompLitExpr.SetList \
ConvExpr.Left ConvExpr.SetLeft \
IndexExpr.Left IndexExpr.SetLeft \
IndexExpr.Right IndexExpr.SetRight \
IndexExpr.IndexMapLValue IndexExpr.SetIndexMapLValue \
KeyExpr.Left KeyExpr.SetLeft \
KeyExpr.Right KeyExpr.SetRight \
StructKeyExpr.Left StructKeyExpr.SetLeft \
StructKeyExpr.Offset StructKeyExpr.SetOffset \
StructKeyExpr.SetSym \
InlinedCallExpr.Body InlinedCallExpr.PtrBody InlinedCallExpr.SetBody \
InlinedCallExpr.Rlist InlinedCallExpr.PtrRlist InlinedCallExpr.SetRlist \
MakeExpr.Left MakeExpr.SetLeft \
MakeExpr.Right MakeExpr.SetRight \
MethodExpr.Left MethodExpr.SetLeft \
MethodExpr.Right MethodExpr.SetRight \
MethodExpr.Offset MethodExpr.SetOffset \
MethodExpr.Class MethodExpr.SetClass \
ParenExpr.Left ParenExpr.SetLeft \
ResultExpr.Offset ResultExpr.SetOffset \
ReturnStmt.IsDDD \
SelectorExpr.Left SelectorExpr.SetLeft \
SelectorExpr.Offset SelectorExpr.SetOffset \
SelectorExpr.SetSym \
SliceExpr.Left SliceExpr.SetLeft \
SliceExpr.List SliceExpr.PtrList SliceExpr.SetList \
SliceHeaderExpr.Left SliceHeaderExpr.SetLeft \
SliceHeaderExpr.List SliceHeaderExpr.PtrList SliceHeaderExpr.SetList \
StarExpr.Left StarExpr.SetLeft \
TypeAssertExpr.Left TypeAssertExpr.SetLeft \
TypeAssertExpr.Right TypeAssertExpr.SetRight \
TypeAssertExpr.List TypeAssertExpr.PtrList TypeAssertExpr.SetList \
UnaryExpr.Left UnaryExpr.SetLeft \
Func.Body Func.PtrBody Func.SetBody \
Func.Iota Func.SetIota \
CallPartExpr.Func ClosureExpr.Func Func.Func Name.Func \
mv BlockStmt.List_ BlockStmt.List
mv CaseStmt.List_ CaseStmt.List
mv CaseStmt.Body_ CaseStmt.Body
mv ForStmt.Body_ ForStmt.Body
mv ForStmt.HasBreak_ ForStmt.HasBreak
mv Func.Iota_ Func.Iota
mv IfStmt.Body_ IfStmt.Body
mv IfStmt.Likely_ IfStmt.Likely
mv RangeStmt.Body_ RangeStmt.Body
mv RangeStmt.HasBreak_ RangeStmt.HasBreak
mv SelectStmt.HasBreak_ SelectStmt.HasBreak
mv SwitchStmt.HasBreak_ SwitchStmt.HasBreak
mv AddStringExpr.List_ AddStringExpr.List
mv CallExpr.NoInline_ CallExpr.NoInline
mv CallExpr.Body_ CallExpr.Body # TODO what is this?
mv CallExpr.DDD CallExpr.IsDDD
mv ClosureReadExpr.Offset_ ClosureReadExpr.Offset
mv CompLitExpr.List_ CompLitExpr.List
mv StructKeyExpr.Offset_ StructKeyExpr.Offset
mv InlinedCallExpr.Body_ InlinedCallExpr.Body
mv ResultExpr.Offset_ ResultExpr.Offset
mv SelectorExpr.Offset_ SelectorExpr.Offset
mv SliceExpr.List_ SliceExpr.List
mv SliceHeaderExpr.LenCap_ SliceHeaderExpr.LenCap
mv Func.Body_ Func.Body
mv CallPartExpr.Func_ CallPartExpr.Func
mv ClosureExpr.Func_ ClosureExpr.Func
mv Name.Func_ Name.Func
'
Change-Id: Ia2ee59649674f83eb123e63fda7a7781cf91cc56
Reviewed-on: https://go-review.googlesource.com/c/go/+/277935
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sets up for removing Func from Node interface.
That means that once the Name reorg is done,
which will let us remove Name, Sym, and Val,
Node will be basically a minimal interface.
Passes buildall w/ toolstash -cmp.
Change-Id: I6e87897572debd7f8e29b4f5167763dc2792b408
Reviewed-on: https://go-review.googlesource.com/c/go/+/279484
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The plan is to introduce a Node interface that replaces the old *Node pointer-to-struct.
The previous CL defined an interface INode modeling a *Node.
This CL:
- Changes all references outside internal/ir to use INode,
along with many references inside internal/ir as well.
- Renames Node to node.
- Renames INode to Node
So now ir.Node is an interface implemented by *ir.node, which is otherwise inaccessible,
and the code outside package ir is now (clearly) using only the interface.
The usual rule is never to redefine an existing name with a new meaning,
so that old code that hasn't been updated gets a "unknown name" error
instead of more mysterious errors or silent misbehavior. That rule would
caution against replacing Node-the-struct with Node-the-interface,
as in this CL, because code that says *Node would now be using a pointer
to an interface. But this CL is being landed at the same time as another that
moves Node from gc to ir. So the net effect is to replace *gc.Node with ir.Node,
which does follow the rule: any lingering references to gc.Node will be told
it's gone, not silently start using pointers to interfaces. So the rule is followed
by the CL sequence, just not this specific CL.
Overall, the loss of inlining caused by using interfaces cuts the compiler speed
by about 6%, a not insignificant amount. However, as we convert the representation
to concrete structs that are not the giant Node over the next weeks, that speed
should come back as more of the compiler starts operating directly on concrete types
and the memory taken up by the graph of Nodes drops due to the more precise
structs. Honestly, I was expecting worse.
% benchstat bench.old bench.new
name old time/op new time/op delta
Template 168ms ± 4% 182ms ± 2% +8.34% (p=0.000 n=9+9)
Unicode 72.2ms ±10% 82.5ms ± 6% +14.38% (p=0.000 n=9+9)
GoTypes 563ms ± 8% 598ms ± 2% +6.14% (p=0.006 n=9+9)
Compiler 2.89s ± 4% 3.04s ± 2% +5.37% (p=0.000 n=10+9)
SSA 6.45s ± 4% 7.25s ± 5% +12.41% (p=0.000 n=9+10)
Flate 105ms ± 2% 115ms ± 1% +9.66% (p=0.000 n=10+8)
GoParser 144ms ±10% 152ms ± 2% +5.79% (p=0.011 n=9+8)
Reflect 345ms ± 9% 370ms ± 4% +7.28% (p=0.001 n=10+9)
Tar 149ms ± 9% 161ms ± 5% +8.05% (p=0.001 n=10+9)
XML 190ms ± 3% 209ms ± 2% +9.54% (p=0.000 n=9+8)
LinkCompiler 327ms ± 2% 325ms ± 2% ~ (p=0.382 n=8+8)
ExternalLinkCompiler 1.77s ± 4% 1.73s ± 6% ~ (p=0.113 n=9+10)
LinkWithoutDebugCompiler 214ms ± 4% 211ms ± 2% ~ (p=0.360 n=10+8)
StdCmd 14.8s ± 3% 15.9s ± 1% +6.98% (p=0.000 n=10+9)
[Geo mean] 480ms 510ms +6.31%
name old user-time/op new user-time/op delta
Template 223ms ± 3% 237ms ± 3% +6.16% (p=0.000 n=9+10)
Unicode 103ms ± 6% 113ms ± 3% +9.53% (p=0.000 n=9+9)
GoTypes 758ms ± 8% 800ms ± 2% +5.55% (p=0.003 n=10+9)
Compiler 3.95s ± 2% 4.12s ± 2% +4.34% (p=0.000 n=10+9)
SSA 9.43s ± 1% 9.74s ± 4% +3.25% (p=0.000 n=8+10)
Flate 132ms ± 2% 141ms ± 2% +6.89% (p=0.000 n=9+9)
GoParser 177ms ± 9% 183ms ± 4% ~ (p=0.050 n=9+9)
Reflect 467ms ±10% 495ms ± 7% +6.17% (p=0.029 n=10+10)
Tar 183ms ± 9% 197ms ± 5% +7.92% (p=0.001 n=10+10)
XML 249ms ± 5% 268ms ± 4% +7.82% (p=0.000 n=10+9)
LinkCompiler 544ms ± 5% 544ms ± 6% ~ (p=0.863 n=9+9)
ExternalLinkCompiler 1.79s ± 4% 1.75s ± 6% ~ (p=0.075 n=10+10)
LinkWithoutDebugCompiler 248ms ± 6% 246ms ± 2% ~ (p=0.965 n=10+8)
[Geo mean] 483ms 504ms +4.41%
[git-generate]
cd src/cmd/compile/internal/ir
: # We need to do the conversion in multiple steps, so we introduce
: # a temporary type alias that will start out meaning the pointer-to-struct
: # and then change to mean the interface.
rf '
mv Node OldNode
add node.go \
type Node = *OldNode
'
: # It should work to do this ex in ir, but it misses test files, due to a bug in rf.
: # Run the command in gc to handle gc's tests, and then again in ssa for ssa's tests.
cd ../gc
rf '
ex . ../arm ../riscv64 ../arm64 ../mips64 ../ppc64 ../mips ../wasm {
import "cmd/compile/internal/ir"
*ir.OldNode -> ir.Node
}
'
cd ../ssa
rf '
ex {
import "cmd/compile/internal/ir"
*ir.OldNode -> ir.Node
}
'
: # Back in ir, finish conversion clumsily with sed,
: # because type checking and circular aliases do not mix.
cd ../ir
sed -i '' '
/type Node = \*OldNode/d
s/\*OldNode/Node/g
s/^func (n Node)/func (n *OldNode)/
s/OldNode/node/g
s/type INode interface/type Node interface/
s/var _ INode = (Node)(nil)/var _ Node = (*node)(nil)/
' *.go
gofmt -w *.go
sed -i '' '
s/{Func{}, 136, 248}/{Func{}, 152, 280}/
s/{Name{}, 32, 56}/{Name{}, 44, 80}/
s/{Param{}, 24, 48}/{Param{}, 44, 88}/
s/{node{}, 76, 128}/{node{}, 88, 152}/
' sizeof_test.go
cd ../ssa
sed -i '' '
s/{LocalSlot{}, 28, 40}/{LocalSlot{}, 32, 48}/
' sizeof_test.go
cd ../gc
sed -i '' 's/\*ir.Node/ir.Node/' mkbuiltin.go
cd ../../../..
go install std cmd
cd cmd/compile
go test -u || go test -u
Change-Id: I196bbe3b648e4701662e4a2bada40bf155e2a553
Reviewed-on: https://go-review.googlesource.com/c/go/+/272935
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that we have all the getters and setters defined, use them
and unexport all the actual Node fields. This is the next step
toward replacing Node with an interface.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
ex . ../ir ../ssa {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/types"
import "cmd/internal/src"
var n, x *ir.Node
var op ir.Op
var t *types.Type
var f *ir.Func
var m *ir.Name
var s *types.Sym
var p src.XPos
var i int64
var e uint16
var nodes ir.Nodes
n.Op = op -> n.SetOp(op)
n.Left = x -> n.SetLeft(x)
n.Right = x -> n.SetRight(x)
n.Orig = x -> n.SetOrig(x)
n.Type = t -> n.SetType(t)
n.Func = f -> n.SetFunc(f)
n.Name = m -> n.SetName(m)
n.Sym = s -> n.SetSym(s)
n.Pos = p -> n.SetPos(p)
n.Xoffset = i -> n.SetXoffset(i)
n.Esc = e -> n.SetEsc(e)
n.Ninit.Append -> n.PtrNinit().Append
n.Ninit.AppendNodes -> n.PtrNinit().AppendNodes
n.Ninit.MoveNodes -> n.PtrNinit().MoveNodes
n.Ninit.Prepend -> n.PtrNinit().Prepend
n.Ninit.Set -> n.PtrNinit().Set
n.Ninit.Set1 -> n.PtrNinit().Set1
n.Ninit.Set2 -> n.PtrNinit().Set2
n.Ninit.Set3 -> n.PtrNinit().Set3
&n.Ninit -> n.PtrNinit()
n.Ninit = nodes -> n.SetNinit(nodes)
n.Nbody.Append -> n.PtrNbody().Append
n.Nbody.AppendNodes -> n.PtrNbody().AppendNodes
n.Nbody.MoveNodes -> n.PtrNbody().MoveNodes
n.Nbody.Prepend -> n.PtrNbody().Prepend
n.Nbody.Set -> n.PtrNbody().Set
n.Nbody.Set1 -> n.PtrNbody().Set1
n.Nbody.Set2 -> n.PtrNbody().Set2
n.Nbody.Set3 -> n.PtrNbody().Set3
&n.Nbody -> n.PtrNbody()
n.Nbody = nodes -> n.SetNbody(nodes)
n.List.Append -> n.PtrList().Append
n.List.AppendNodes -> n.PtrList().AppendNodes
n.List.MoveNodes -> n.PtrList().MoveNodes
n.List.Prepend -> n.PtrList().Prepend
n.List.Set -> n.PtrList().Set
n.List.Set1 -> n.PtrList().Set1
n.List.Set2 -> n.PtrList().Set2
n.List.Set3 -> n.PtrList().Set3
&n.List -> n.PtrList()
n.List = nodes -> n.SetList(nodes)
n.Rlist.Append -> n.PtrRlist().Append
n.Rlist.AppendNodes -> n.PtrRlist().AppendNodes
n.Rlist.MoveNodes -> n.PtrRlist().MoveNodes
n.Rlist.Prepend -> n.PtrRlist().Prepend
n.Rlist.Set -> n.PtrRlist().Set
n.Rlist.Set1 -> n.PtrRlist().Set1
n.Rlist.Set2 -> n.PtrRlist().Set2
n.Rlist.Set3 -> n.PtrRlist().Set3
&n.Rlist -> n.PtrRlist()
n.Rlist = nodes -> n.SetRlist(nodes)
}
ex . ../ir ../ssa {
import "cmd/compile/internal/ir"
var n *ir.Node
n.Op -> n.GetOp()
n.Left -> n.GetLeft()
n.Right -> n.GetRight()
n.Orig -> n.GetOrig()
n.Type -> n.GetType()
n.Func -> n.GetFunc()
n.Name -> n.GetName()
n.Sym -> n.GetSym()
n.Pos -> n.GetPos()
n.Xoffset -> n.GetXoffset()
n.Esc -> n.GetEsc()
avoid (*ir.Node).PtrNinit
avoid (*ir.Node).PtrNbody
avoid (*ir.Node).PtrList
avoid (*ir.Node).PtrRlist
n.Ninit -> n.GetNinit()
n.Nbody -> n.GetNbody()
n.List -> n.GetList()
n.Rlist -> n.GetRlist()
}
'
cd ../ir
rf '
mv Node.Op Node.op
mv Node.GetOp Node.Op
mv Node.Left Node.left
mv Node.GetLeft Node.Left
mv Node.Right Node.right
mv Node.GetRight Node.Right
mv Node.Orig Node.orig
mv Node.GetOrig Node.Orig
mv Node.Type Node.typ
mv Node.GetType Node.Type
mv Node.Func Node.fn
mv Node.GetFunc Node.Func
mv Node.Name Node.name
mv Node.GetName Node.Name
# All uses are in other Node methods already.
mv Node.E Node.e
mv Node.Sym Node.sym
mv Node.GetSym Node.Sym
mv Node.Pos Node.pos
mv Node.GetPos Node.Pos
mv Node.Esc Node.esc
mv Node.GetEsc Node.Esc
# While we are here, rename Xoffset to more idiomatic Offset.
mv Node.Xoffset Node.offset
mv Node.GetXoffset Node.Offset
mv Node.SetXoffset Node.SetOffset
# While we are here, rename Ninit, Nbody to more idiomatic Init, Body.
mv Node.Ninit Node.init
mv Node.GetNinit Node.Init
mv Node.PtrNinit Node.PtrInit
mv Node.SetNinit Node.SetInit
mv Node.Nbody Node.body
mv Node.GetNbody Node.Body
mv Node.PtrNbody Node.PtrBody
mv Node.SetNbody Node.SetBody
mv Node.List Node.list
mv Node.GetList Node.List
mv Node.Rlist Node.rlist
mv Node.GetRlist Node.Rlist
# Unexport these
mv Node.SetHasOpt Node.setHasOpt
mv Node.SetHasVal Node.setHasVal
'
Change-Id: I9894f633375c5237a29b6d6d7b89ba181b56ca3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/273009
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we want to break up package gc at all, we will need to move
the compiler IR it defines into a separate package that can be
imported by packages that gc itself imports. This CL does that.
It also removes the TINT8 etc aliases so that all code is clear
about which package things are coming from.
This CL is automatically generated by the script below.
See the comments in the script for details about the changes.
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# These names were never fully qualified
# when the types package was added.
# Do it now, to avoid confusion about where they live.
inline -rm \
Txxx \
TINT8 \
TUINT8 \
TINT16 \
TUINT16 \
TINT32 \
TUINT32 \
TINT64 \
TUINT64 \
TINT \
TUINT \
TUINTPTR \
TCOMPLEX64 \
TCOMPLEX128 \
TFLOAT32 \
TFLOAT64 \
TBOOL \
TPTR \
TFUNC \
TSLICE \
TARRAY \
TSTRUCT \
TCHAN \
TMAP \
TINTER \
TFORW \
TANY \
TSTRING \
TUNSAFEPTR \
TIDEAL \
TNIL \
TBLANK \
TFUNCARGS \
TCHANARGS \
NTYPE \
BADWIDTH
# esc.go and escape.go do not need to be split.
# Append esc.go onto the end of escape.go.
mv esc.go escape.go
# Pull out the type format installation from func Main,
# so it can be carried into package ir.
mv Main:/Sconv.=/-0,/TypeLinkSym/-1 InstallTypeFormats
# Names that need to be exported for use by code left in gc.
mv Isconst IsConst
mv asNode AsNode
mv asNodes AsNodes
mv asTypesNode AsTypesNode
mv basicnames BasicTypeNames
mv builtinpkg BuiltinPkg
mv consttype ConstType
mv dumplist DumpList
mv fdumplist FDumpList
mv fmtMode FmtMode
mv goopnames OpNames
mv inspect Inspect
mv inspectList InspectList
mv localpkg LocalPkg
mv nblank BlankNode
mv numImport NumImport
mv opprec OpPrec
mv origSym OrigSym
mv stmtwithinit StmtWithInit
mv dump DumpAny
mv fdump FDumpAny
mv nod Nod
mv nodl NodAt
mv newname NewName
mv newnamel NewNameAt
mv assertRepresents AssertValidTypeForConst
mv represents ValidTypeForConst
mv nodlit NewLiteral
# Types and fields that need to be exported for use by gc.
mv nowritebarrierrecCallSym SymAndPos
mv SymAndPos.lineno SymAndPos.Pos
mv SymAndPos.target SymAndPos.Sym
mv Func.lsym Func.LSym
mv Func.setWBPos Func.SetWBPos
mv Func.numReturns Func.NumReturns
mv Func.numDefers Func.NumDefers
mv Func.nwbrCalls Func.NWBRCalls
# initLSym is an algorithm left behind in gc,
# not an operation on Func itself.
mv Func.initLSym initLSym
mv nodeQueue NodeQueue
mv NodeQueue.empty NodeQueue.Empty
mv NodeQueue.popLeft NodeQueue.PopLeft
mv NodeQueue.pushRight NodeQueue.PushRight
# Many methods on Node are actually algorithms that
# would apply to any node implementation.
# Those become plain functions.
mv Node.funcname FuncName
mv Node.isBlank IsBlank
mv Node.isGoConst isGoConst
mv Node.isNil IsNil
mv Node.isParamHeapCopy isParamHeapCopy
mv Node.isParamStackCopy isParamStackCopy
mv Node.isSimpleName isSimpleName
mv Node.mayBeShared MayBeShared
mv Node.pkgFuncName PkgFuncName
mv Node.backingArrayPtrLen backingArrayPtrLen
mv Node.isterminating isTermNode
mv Node.labeledControl labeledControl
mv Nodes.isterminating isTermNodes
mv Nodes.sigerr fmtSignature
mv Node.MethodName methodExprName
mv Node.MethodFunc methodExprFunc
mv Node.IsMethod IsMethod
# Every node will need to implement RawCopy;
# Copy and SepCopy algorithms will use it.
mv Node.rawcopy Node.RawCopy
mv Node.copy Copy
mv Node.sepcopy SepCopy
# Extract Node.Format method body into func FmtNode,
# but leave method wrapper behind.
mv Node.Format:0,$ FmtNode
# Formatting helpers that will apply to all node implementations.
mv Node.Line Line
mv Node.exprfmt exprFmt
mv Node.jconv jconvFmt
mv Node.modeString modeString
mv Node.nconv nconvFmt
mv Node.nodedump nodeDumpFmt
mv Node.nodefmt nodeFmt
mv Node.stmtfmt stmtFmt
# Constant support needed for code moving to ir.
mv okforconst OKForConst
mv vconv FmtConst
mv int64Val Int64Val
mv float64Val Float64Val
mv Node.ValueInterface ConstValue
# Organize code into files.
mv LocalPkg BuiltinPkg ir.go
mv NumImport InstallTypeFormats Line fmt.go
mv syntax.go Nod NodAt NewNameAt Class Pxxx PragmaFlag Nointerface SymAndPos \
AsNode AsTypesNode BlankNode OrigSym \
Node.SliceBounds Node.SetSliceBounds Op.IsSlice3 \
IsConst Node.Int64Val Node.CanInt64 Node.Uint64Val Node.BoolVal Node.StringVal \
Node.RawCopy SepCopy Copy \
IsNil IsBlank IsMethod \
Node.Typ Node.StorageClass node.go
mv ConstType ConstValue Int64Val Float64Val AssertValidTypeForConst ValidTypeForConst NewLiteral idealType OKForConst val.go
# Move files to new ir package.
mv bitset.go class_string.go dump.go fmt.go \
ir.go node.go op_string.go val.go \
sizeof_test.go cmd/compile/internal/ir
'
: # fix mkbuiltin.go to generate the changes made to builtin.go during rf
sed -i '' '
s/\[T/[types.T/g
s/\*Node/*ir.Node/g
/internal\/types/c \
fmt.Fprintln(&b, `import (`) \
fmt.Fprintln(&b, ` "cmd/compile/internal/ir"`) \
fmt.Fprintln(&b, ` "cmd/compile/internal/types"`) \
fmt.Fprintln(&b, `)`)
' mkbuiltin.go
gofmt -w mkbuiltin.go
: # update cmd/dist to add internal/ir
cd ../../../dist
sed -i '' '/compile.internal.gc/a\
"cmd/compile/internal/ir",
' buildtool.go
gofmt -w buildtool.go
: # update cmd/compile TestFormats
cd ../..
go install std cmd
cd cmd/compile
go test -u || go test # first one updates but fails; second passes
Change-Id: I5f7caf6b20629b51970279e81231a3574d5b51db
Reviewed-on: https://go-review.googlesource.com/c/go/+/273008
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move Flag, Debug, Ctxt, Exit, and error messages to
new package cmd/compile/internal/base.
These are the core functionality that everything in gc uses
and which otherwise prevent splitting any other code
out of gc into different packages.
A minor milestone: the compiler source code
no longer contains the string "yy".
[git-generate]
cd src/cmd/compile/internal/gc
rf '
mv atExit AtExit
mv Ctxt atExitFuncs AtExit Exit base.go
mv lineno Pos
mv linestr FmtPos
mv flusherrors FlushErrors
mv yyerror Errorf
mv yyerrorl ErrorfAt
mv yyerrorv ErrorfVers
mv noder.yyerrorpos noder.errorAt
mv Warnl WarnfAt
mv errorexit ErrorExit
mv base.go debug.go flag.go print.go cmd/compile/internal/base
'
: # update comments
sed -i '' 's/yyerrorl/ErrorfAt/g; s/yyerror/Errorf/g' *.go
: # bootstrap.go is not built by default so invisible to rf
sed -i '' 's/Fatalf/base.Fatalf/' bootstrap.go
goimports -w bootstrap.go
: # update cmd/dist to add internal/base
cd ../../../dist
sed -i '' '/internal.amd64/a\
"cmd/compile/internal/base",
' buildtool.go
gofmt -w buildtool.go
Change-Id: I59903c7084222d6eaee38823fd222159ba24a31a
Reviewed-on: https://go-review.googlesource.com/c/go/+/272250
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This creates space for a different kind of extension field
in LSym without making the struct any larger.
(There are many LSym, so we care about keeping the struct small.)
Change-Id: Ib16edb9e15f54c2a7351c8b875e19684058711e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/243943
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Three loops can be converted into one.
Minor reviewer-recommended refactoring.
Passes toolstash-check.
Updates #27739.
Change-Id: Ia87a11d88ae3ce56fcc4267fe6c5a9c13bf7f533
Reviewed-on: https://go-review.googlesource.com/c/go/+/176577
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
Remove a couple of unnecessary var declarations, an unused sort.Sort
type, and simplify a range by using the two-name variant.
Change-Id: Ia251f634db0bfbe8b1d553b8659272ddbd13b2c3
Reviewed-on: https://go-review.googlesource.com/102336
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Detect and remove the markers of lexical scopes that don't contain
any variables early in noder, instead of waiting until the end of DWARF
generation.
This saves memory by never allocating some of the markers and optimizes
some of the algorithms that depend on the number of scopes.
2. Assign scopes to Progs by doing, for each Prog, a binary search over
the markers array. This is faster, compared to sorting the Prog list
because there are fewer markers than there are Progs.
completed 15 of 15, estimated time remaining 0s (eta 2:30PM)
name old time/op new time/op delta
Template 274ms ± 5% 260ms ± 6% -4.91% (p=0.000 n=15+15)
Unicode 126ms ± 5% 127ms ± 9% ~ (p=0.856 n=13+15)
GoTypes 861ms ± 5% 857ms ± 4% ~ (p=0.595 n=15+15)
Compiler 4.11s ± 4% 4.12s ± 5% ~ (p=1.000 n=15+15)
SSA 10.7s ± 2% 10.9s ± 4% +2.01% (p=0.002 n=14+14)
Flate 163ms ± 4% 166ms ± 9% ~ (p=0.134 n=14+15)
GoParser 203ms ± 4% 205ms ± 6% ~ (p=0.461 n=15+15)
Reflect 544ms ± 5% 549ms ± 4% ~ (p=0.174 n=15+15)
Tar 249ms ± 9% 245ms ± 6% ~ (p=0.285 n=15+15)
XML 286ms ± 4% 291ms ± 5% ~ (p=0.081 n=15+15)
[Geo mean] 528ms 529ms +0.14%
name old user-time/op new user-time/op delta
Template 358ms ± 7% 354ms ± 5% ~ (p=0.242 n=14+15)
Unicode 189ms ±11% 191ms ±10% ~ (p=0.438 n=15+15)
GoTypes 1.15s ± 4% 1.14s ± 3% ~ (p=0.405 n=15+15)
Compiler 5.36s ± 6% 5.35s ± 5% ~ (p=0.588 n=15+15)
SSA 14.6s ± 3% 15.0s ± 4% +2.58% (p=0.000 n=15+15)
Flate 214ms ±12% 216ms ± 8% ~ (p=0.539 n=15+15)
GoParser 267ms ± 6% 270ms ± 5% ~ (p=0.569 n=15+15)
Reflect 712ms ± 5% 709ms ± 4% ~ (p=0.894 n=15+15)
Tar 329ms ± 8% 330ms ± 5% ~ (p=0.974 n=14+15)
XML 371ms ± 3% 381ms ± 5% +2.85% (p=0.002 n=13+15)
[Geo mean] 705ms 709ms +0.62%
name old alloc/op new alloc/op delta
Template 38.0MB ± 0% 38.4MB ± 0% +1.27% (p=0.000 n=15+14)
Unicode 28.8MB ± 0% 28.8MB ± 0% +0.16% (p=0.000 n=15+14)
GoTypes 112MB ± 0% 114MB ± 0% +1.64% (p=0.000 n=15+15)
Compiler 465MB ± 0% 474MB ± 0% +1.91% (p=0.000 n=15+15)
SSA 1.48GB ± 0% 1.53GB ± 0% +3.32% (p=0.000 n=15+15)
Flate 24.3MB ± 0% 24.8MB ± 0% +1.77% (p=0.000 n=14+15)
GoParser 30.7MB ± 0% 31.1MB ± 0% +1.27% (p=0.000 n=15+15)
Reflect 76.3MB ± 0% 77.1MB ± 0% +1.03% (p=0.000 n=15+15)
Tar 39.2MB ± 0% 39.6MB ± 0% +1.02% (p=0.000 n=13+15)
XML 41.5MB ± 0% 42.1MB ± 0% +1.45% (p=0.000 n=15+15)
[Geo mean] 77.5MB 78.7MB +1.48%
name old allocs/op new allocs/op delta
Template 385k ± 0% 387k ± 0% +0.54% (p=0.000 n=15+15)
Unicode 342k ± 0% 343k ± 0% +0.10% (p=0.000 n=15+15)
GoTypes 1.19M ± 0% 1.19M ± 0% +0.64% (p=0.000 n=14+15)
Compiler 4.51M ± 0% 4.54M ± 0% +0.53% (p=0.000 n=15+15)
SSA 12.2M ± 0% 12.4M ± 0% +1.16% (p=0.000 n=15+15)
Flate 234k ± 0% 236k ± 0% +0.63% (p=0.000 n=14+15)
GoParser 318k ± 0% 320k ± 0% +0.63% (p=0.000 n=15+15)
Reflect 974k ± 0% 977k ± 0% +0.28% (p=0.000 n=15+15)
Tar 395k ± 0% 397k ± 0% +0.38% (p=0.000 n=15+13)
XML 404k ± 0% 407k ± 0% +0.55% (p=0.000 n=15+15)
[Geo mean] 794k 799k +0.55%
name old text-bytes new text-bytes delta
HelloSize 680kB ± 0% 680kB ± 0% ~ (all equal)
name old data-bytes new data-bytes delta
HelloSize 9.62kB ± 0% 9.62kB ± 0% ~ (all equal)
name old bss-bytes new bss-bytes delta
HelloSize 125kB ± 0% 125kB ± 0% ~ (all equal)
name old exe-bytes new exe-bytes delta
HelloSize 1.11MB ± 0% 1.12MB ± 0% +1.11% (p=0.000 n=15+15)
Change-Id: I95a0173ee28c52be1a4851d2a6e389529e74bf28
Reviewed-on: https://go-review.googlesource.com/95396
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
|
| |
|
|
|
|
|
|
|
| |
After we track decomposition, offset could mean stack offset or offset
in recomposed variable. Disambiguate.
Change-Id: I4d810b8c0dcac7a4ec25ac1e52898f55477025df
Reviewed-on: https://go-review.googlesource.com/50875
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change compiler and linker to emit DWARF lexical blocks in .debug_info
section when compiling with -N -l.
Version of debug_info is updated from DWARF v2 to DWARF v3 since
version 2 does not allow lexical blocks with discontinuous PC ranges.
Remaining open problems:
- scope information is removed from inlined functions
- variables records do not have DW_AT_start_scope attributes so a
variable will shadow other variables with the same name as soon as its
containing scope begins, even before its declaration.
Updates #6913.
Updates #12899.
Change-Id: Idc6808788512ea20e7e45bcf782453acb416fb49
Reviewed-on: https://go-review.googlesource.com/40095
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit c8b889cc4824f4dbd64a51a3f7b5b6dce4b87ed2.
Reason for revert: broke noopt build, compiler performance regression, new Curfn uses
Let's fix those and then try this again.
Change-Id: Icc3cad1365d04cac8fd09da9dbb0bbf55c13ef44
Reviewed-on: https://go-review.googlesource.com/39991
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
|
Change compiler and linker to emit DWARF lexical blocks in debug_info.
Version of debug_info is updated from DWARF v.2 to DWARF v.3 since version 2
does not allow lexical blocks with discontinuous ranges.
Second attempt at https://go-review.googlesource.com/#/c/29591/
Remaining open problems:
- scope information is removed from inlined functions
- variables in debug_info do not have DW_AT_start_scope attributes so a
variable will shadow other variables with the same name as soon as its
containing scope begins, before its declaration.
Updates golang/go#12899, golang/go#6913
Change-Id: I0e260a45b564d14a87b88974eb16c5387cb410a5
Reviewed-on: https://go-review.googlesource.com/36879
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|