[dev.regabi] cmd/compile: split out package walk [generated]

[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>
This commit is contained in:
Russ Cox 2020-12-23 01:05:16 -05:00
parent 01fd2d05c8
commit e4895ab4c0
18 changed files with 790 additions and 764 deletions

View file

@ -288,3 +288,24 @@ func MarkFunc(n *Name) {
n.Class_ = PFUNC
n.Sym().SetFunc(true)
}
// ClosureDebugRuntimeCheck applies boilerplate checks for debug flags
// and compiling runtime
func ClosureDebugRuntimeCheck(clo *ClosureExpr) {
if base.Debug.Closure > 0 {
if clo.Esc() == EscHeap {
base.WarnfAt(clo.Pos(), "heap closure, captured vars = %v", clo.Func.ClosureVars)
} else {
base.WarnfAt(clo.Pos(), "stack closure, captured vars = %v", clo.Func.ClosureVars)
}
}
if base.Flag.CompilingRuntime && clo.Esc() == EscHeap {
base.ErrorfAt(clo.Pos(), "heap-allocated closure, not allowed in runtime")
}
}
// IsTrivialClosure reports whether closure clo has an
// empty list of captured vars.
func IsTrivialClosure(clo *ClosureExpr) bool {
return len(clo.Func.ClosureVars) == 0
}