"cmd/compile/internal/base"
"cmd/compile/internal/ir"
"cmd/compile/internal/liveness"
- "cmd/compile/internal/reflectdata"
"cmd/compile/internal/ssagen"
"cmd/compile/internal/typecheck"
"cmd/compile/internal/types"
walk.Walk(fn)
ir.CurFunc = nil // enforce no further uses of CurFunc
typecheck.DeclContext = ir.PEXTERN
-
- // Make sure type syms are declared for all types that might
- // be types of stack objects. We need to do this here
- // because symbols must be allocated before the parallel
- // phase of the compiler.
- for _, n := range fn.Dcl {
- if liveness.ShouldTrack(n) && n.Addrtaken() {
- reflectdata.WriteType(n.Type())
- // Also make sure we allocate a linker symbol
- // for the stack object data, for the same reason.
- if fn.LSym.Func().StackObjects == nil {
- fn.LSym.Func().StackObjects = base.Ctxt.Lookup(fn.LSym.Name + ".stkobj")
- }
- }
- }
}
// compileFunctions compiles all functions in compilequeue.
// Populate the stack object data.
// Format must match runtime/stack.go:stackObjectRecord.
- x := e.curfn.LSym.Func().StackObjects
+ x := base.Ctxt.Lookup(e.curfn.LSym.Name + ".stkobj")
+ e.curfn.LSym.Func().StackObjects = x
off := 0
off = objw.Uintptr(x, off, uint64(len(vars)))
for _, v := range vars {
// in which case the offset is relative to argp.
// Locals have a negative Xoffset, in which case the offset is relative to varp.
off = objw.Uintptr(x, off, uint64(v.FrameOffset()))
- if !types.TypeSym(v.Type()).Siggen() {
- e.Fatalf(v.Pos(), "stack object's type symbol not generated for type %s", v.Type())
- }
- off = objw.SymPtr(x, off, reflectdata.WriteType(v.Type()), 0)
+ off = objw.SymPtr(x, off, reflectdata.TypeLinksym(v.Type()), 0)
}
// Emit a funcdata pointing at the stack object data.