Age | Commit message (Collapse) | Author |
|
Spreading function compilation across multiple goroutines results in
non-deterministic output. This is how cmd/compile has historically
behaved for concurrent builds, but is troublesome for non-concurrent
builds, particularly because it interferes with "toolstash -cmp".
I spent some time trying to think of a simple, unified algorithm that
can concurrently schedule work but gracefully degrades to a
deterministic build for single-worker builds, but I couldn't come up
with any. The simplest idea I found was to simply abstract away the
operation of scheduling work so that we can have alternative
deterministic vs concurrent modes.
Change-Id: I08afa00527ce1844432412f4f8553781c4e323df
Reviewed-on: https://go-review.googlesource.com/c/go/+/318229
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
|
|
For ABI0 assembly functions that have Go declarations, generate
traceback argument info and attach it to the assembly functions.
So we can print argument in tracebacks if e.g. assembly function
panics.
Only do this for ABI0 functions, as for ABIInternal assembly
functions it is likely that they never spill arguments to memory.
Change-Id: I7e601ccd9aded5e6af2f02be975bf81ff9948f4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/315870
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
|
|
function
This fixes the build crash for
GOEXPERIMENT=regabi,regabiargs GOOS=windows go build syscall
Updates #40724.
Change-Id: I4400f6ff2e83e7e7e93ad5e58c6063b327532504
Reviewed-on: https://go-review.googlesource.com/c/go/+/309110
Trust: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
|
|
After recent discussion about bodyless functions, their wrappers,
their stack maps, nosplit, and callbacks, I was inspired to go and
be sure that more defaults were sensible. This may not be all --
currently rtcall is "ABIDefault" which I think is correct, but I
am not 100% certain.
Updates #40724.
Change-Id: I95b14ee0e5952fa53e7fea9f6f5192358aa24f23
Reviewed-on: https://go-review.googlesource.com/c/go/+/304549
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
|
|
replaced old type-based logic with new abi-based logic;
earlier versions of this CL compared them for equality.
For not-in-a-register, they match everywhere tested.
also modified GetFrameOffset to make it more like the one it replaces;
the LocalsOffset is subtracted.
Change-Id: I65ce7f0646c493c277df6b6f46e4839a0d886ac9
Reviewed-on: https://go-review.googlesource.com/c/go/+/302072
Trust: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
|
|
Repair of CL 300749.
ALSO:
found evidence that stack maps for bodyless methods are wrong.
gofmt in test/abi
removed never-executed code in types/size.go
Updates #44816.
Updates #40724.
Change-Id: Ifeb5fee60f60e7c7b58ee0457f58a3265d6cf3f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/302071
Trust: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
|
|
This reverts commit 8ed438c077d82c4b4662c327dbbdb3c64e7547ca, CL 300749.
Reason for revert: Looks like it crashes on link-register architectures
Change-Id: I0c261df58900008cada3359889d2a87508158447
Reviewed-on: https://go-review.googlesource.com/c/go/+/302053
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
|
|
ALSO:
found evidence that stack maps for bodyless methods are wrong.
gofmt in test/abi
removed never-executed code in types/size.go
Updates #44816.
Change-Id: I658c33f049337fb6f1e625f0c55430d25bfa877e
Reviewed-on: https://go-review.googlesource.com/c/go/+/300749
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
|
|
improved to run on more architectures.
this is in preparation for turning off calculation of frame offsets
in types.CalcSize.
Replaces https://go-review.googlesource.com/c/go/+/293392 .
Updates #44675.
For #40724.
Change-Id: I40ba496172447cf09b86bc646148859363c11ad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/297637
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
|
|
This reverts CL 293392.
Reason for revert: broke most non-x86 builders
Fixes #44675
Change-Id: I1e815c3ab27a02e83a2f0d221a617909dd021403
Reviewed-on: https://go-review.googlesource.com/c/go/+/297549
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
|
|
this is in preparation for turning off calculation of frame offsets
in types.CalcSize
For #40724.
Change-Id: I2c29fd289c014674076e5ec5170055dbca5ea64b
Reviewed-on: https://go-review.googlesource.com/c/go/+/293392
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
|
|
recent renames
Went in a semi-automated way through the clearest renames of functions,
and updated comments and error messages where it made sense.
Change-Id: Ied8e152b562b705da7f52f715991a77dab60da35
Reviewed-on: https://go-review.googlesource.com/c/go/+/284216
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
The code for allocating linksyms and recording that we need runtime
type descriptors is now concurrent-safe, so move it to where those
symbols are actually needed to reduce complexity and risk of failing
to generate all needed symbols in advance.
For #43701.
Change-Id: I759d2508213ac9a4e0b504b51a75fa10dfa37a8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/284076
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
|
|
This CL moves almost all PAUTOHEAP handling code to SSA construction.
Instead of changing Names to PAUTOHEAP, escape analysis now only sets
n.Esc() to ir.EscHeap, and SSA handles creating the "&x"
pseudo-variables and associating them via Heapaddr.
This CL also gets rid of n.Stackcopy, which was used to distinguish
the heap copy of a parameter used within a function from the stack
copy used in the function calling convention. In practice, this is
always obvious from context: liveness and function prologue/epilogue
want to know about the stack copies, and everywhere else wants the
heap copy.
Hopefully moving all parameter/result handling into SSA helps with
making the register ABI stuff easier.
Also, the only remaining uses of PAUTOHEAP are now for closure
variables, so I intend to rename it to PCLOSUREVAR or get rid of those
altogether too. But this CL is already big and scary enough.
Change-Id: Ief5ef6205041b9d0ee445314310c0c5a98187e77
Reviewed-on: https://go-review.googlesource.com/c/go/+/283233
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
|
|
This CL reorders function compilation to ensure that functions are
always compiled before any enclosed function literals. The primary
goal of this is to reduce the risk of race conditions that arise due
to compilation of function literals needing to inspect data from their
closure variables. However, a pleasant side effect is that it allows
skipping the redundant, separate compilation of function literals that
were inlined into their enclosing function.
Change-Id: I03ee96212988cb578c2452162b7e99cc5e92918f
Reviewed-on: https://go-review.googlesource.com/c/go/+/282892
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
|
|
No real code changes. Just splitting into a separate CL so the next
one is easier to review.
Change-Id: I428dc986b76370d8d3afc12cf19585f6384389d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/283314
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
|
|
The compiler currently has two modes for compilation: one where it
compiles each function as it sees them, and another where it enqueues
them all into a work queue. A subsequent CL is going to reorder
function compilation to ensure that functions are always compiled
before any non-trivial function literals they enclose, and this will
be easier if we always use the compile work queue.
Also, fewer compilation modes makes things simpler to reason about.
Change-Id: Ie090e81f7476c49486296f2b90911fa0a466a5dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/283313
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
|
|
These aren't part of the Node interface anymore, so no need to keep
them around.
Passes toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/ir
: Fix one off case that causes trouble for rf.
sed -i -e 's/n.SetClass(ir.PAUTO)/n.Class_ = ir.PAUTO/' ../ssa/export_test.go
pkgs=$(go list . ../...)
rf '
ex '"$(echo $pkgs)"' {
var n *Name
var c Class
n.Class() -> n.Class_
n.SetClass(c) -> n.Class_ = c
}
rm Name.Class
rm Name.SetClass
mv Name.Class_ Name.Class
'
Change-Id: Ifb304bf4691a8c455456aabd8aa77178d4a49500
Reviewed-on: https://go-review.googlesource.com/c/go/+/281294
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
|
|
Passes toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/gc
pkgs=$(grep -l -w Linksym ../*/*.go | xargs dirname | grep -v '/gc$' | sort -u)
rf '
ex . '"$(echo $pkgs)"' {
import "cmd/compile/internal/ir"
import "cmd/compile/internal/reflectdata"
import "cmd/compile/internal/staticdata"
import "cmd/compile/internal/types"
avoid reflectdata.TypeLinksym
avoid reflectdata.TypeLinksymLookup
avoid reflectdata.TypeLinksymPrefix
avoid staticdata.FuncLinksym
var f *ir.Func
var n *ir.Name
var s string
var t *types.Type
f.Sym().Linksym() -> f.Linksym()
n.Sym().Linksym() -> n.Linksym()
reflectdata.TypeSym(t).Linksym() -> reflectdata.TypeLinksym(t)
reflectdata.TypeSymPrefix(s, t).Linksym() -> reflectdata.TypeLinksymPrefix(s, t)
staticdata.FuncSym(n.Sym()).Linksym() -> staticdata.FuncLinksym(n)
types.TypeSymLookup(s).Linksym() -> reflectdata.TypeLinksymLookup(s)
}
'
Change-Id: I7a3ae1dcd61bcdf4a29f708ff12f7f80c2b280c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/280640
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
|
|
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Late addition to package ir.
mv closuredebugruntimecheck ClosureDebugRuntimeCheck
mv hasemptycvars IsTrivialClosure
mv ClosureDebugRuntimeCheck IsTrivialClosure func.go
mv func.go cmd/compile/internal/ir
# Late addition to package reflectdata.
mv markTypeUsedInInterface MarkTypeUsedInInterface
mv markUsedIfaceMethod MarkUsedIfaceMethod
mv MarkTypeUsedInInterface MarkUsedIfaceMethod reflect.go
mv reflect.go cmd/compile/internal/reflectdata
# Late addition to package staticdata.
mv litsym InitConst
mv InitConst data.go
mv data.go cmd/compile/internal/staticdata
# Extract staticinit out of walk into its own package.
mv InitEntry InitPlan InitSchedule InitSchedule.append InitSchedule.staticInit \
InitSchedule.tryStaticInit InitSchedule.staticcopy \
InitSchedule.staticassign InitSchedule.initplan InitSchedule.addvalue \
statuniqgen staticname stataddr anySideEffects getlit isvaluelit \
sched.go
mv InitSchedule.initplans InitSchedule.Plans
mv InitSchedule.inittemps InitSchedule.Temps
mv InitSchedule.out InitSchedule.Out
mv InitSchedule.staticInit InitSchedule.StaticInit
mv InitSchedule.staticassign InitSchedule.StaticAssign
mv InitSchedule Schedule
mv InitPlan Plan
mv InitEntry Entry
mv anySideEffects AnySideEffects
mv staticname StaticName
mv stataddr StaticLoc
mv sched.go cmd/compile/internal/staticinit
# Export API and unexport non-API.
mv transformclosure Closure
mv walk Walk
mv Order orderState
mv swt.go switch.go
mv racewalk.go race.go
mv closure.go order.go range.go select.go switch.go race.go \
sinit.go subr.go walk.go \
cmd/compile/internal/walk
'
: # Update format test.
cd ../../
go install cmd/compile/... cmd/internal/archive
go test -u || go test -u
rm -rf ../../../pkg/darwin_amd64/cmd
Change-Id: I11c7a45f74d4a9e963da15c080e1018caaa99c05
Reviewed-on: https://go-review.googlesource.com/c/go/+/279478
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# maxOpenDefers is declared in ssa.go but used only by walk.
mv maxOpenDefers walk.go
# gc.Arch -> ssagen.Arch
# It is not as nice but will do for now.
mv Arch ArchInfo
mv thearch Arch
mv Arch ArchInfo arch.go
# Pull dwarf out of pgen.go.
mv debuginfo declPos createDwarfVars preInliningDcls \
createSimpleVars createSimpleVar \
createComplexVars createComplexVar \
dwarf.go
# Pull high-level compilation out of pgen.go,
# leaving only the SSA code.
mv compilequeue funccompile compile compilenow \
compileFunctions isInlinableButNotInlined \
initLSym \
compile.go
mv BoundsCheckFunc GCWriteBarrierReg ssa.go
mv largeStack largeStackFrames CheckLargeStacks pgen.go
# All that is left in dcl.go is the nowritebarrierrecCheck
mv dcl.go nowb.go
# Export API and unexport non-API.
mv initssaconfig InitConfig
mv isIntrinsicCall IsIntrinsicCall
mv ssaDumpInline DumpInline
mv initSSATables InitTables
mv initSSAEnv InitEnv
mv compileSSA Compile
mv stackOffset StackOffset
mv canSSAType TypeOK
mv SSAGenState State
mv FwdRefAux fwdRefAux
mv cgoSymABIs CgoSymABIs
mv readSymABIs ReadSymABIs
mv initLSym InitLSym
mv useABIWrapGen symabiDefs CgoSymABIs ReadSymABIs InitLSym selectLSym makeABIWrapper setupTextLSym abi.go
mv arch.go abi.go nowb.go phi.go pgen.go pgen_test.go ssa.go cmd/compile/internal/ssagen
'
rm go.go gsubr.go
Change-Id: I47fad6cbf1d1e583fd9139003a08401d7cd048a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/279476
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|