// Check whether any of the functions we have compiled have gigantic stack frames.
obj.SortSlice(largeStackFrames, func(i, j int) bool {
- return largeStackFrames[i].Before(largeStackFrames[j])
+ return largeStackFrames[i].pos.Before(largeStackFrames[j].pos)
})
- for _, largePos := range largeStackFrames {
- yyerrorl(largePos, "stack frame too large (>1GB)")
+ for _, large := range largeStackFrames {
+ if large.callee != 0 {
+ yyerrorl(large.pos, "stack frame too large (>1GB): %d MB locals + %d MB args + %d MB callee", large.locals>>20, large.args>>20, large.callee>>20)
+ } else {
+ yyerrorl(large.pos, "stack frame too large (>1GB): %d MB locals + %d MB args", large.locals>>20, large.args>>20)
+ }
}
if len(compilequeue) != 0 {
// Note: check arg size to fix issue 25507.
if f.Frontend().(*ssafn).stksize >= maxStackSize || fn.Type.ArgWidth() >= maxStackSize {
largeStackFramesMu.Lock()
- largeStackFrames = append(largeStackFrames, fn.Pos)
+ largeStackFrames = append(largeStackFrames, largeStack{locals: f.Frontend().(*ssafn).stksize, args: fn.Type.ArgWidth(), pos: fn.Pos})
largeStackFramesMu.Unlock()
return
}
// the assembler may emit inscrutable complaints about invalid instructions.
if pp.Text.To.Offset >= maxStackSize {
largeStackFramesMu.Lock()
- largeStackFrames = append(largeStackFrames, fn.Pos)
+ locals := f.Frontend().(*ssafn).stksize
+ largeStackFrames = append(largeStackFrames, largeStack{locals: locals, args: fn.Type.ArgWidth(), callee: pp.Text.To.Offset - locals, pos: fn.Pos})
largeStackFramesMu.Unlock()
return
}
var errors []Error
+// largeStack is info about a function whose stack frame is too large (rare).
+type largeStack struct {
+ locals int64
+ args int64
+ callee int64
+ pos src.XPos
+}
+
var (
largeStackFramesMu sync.Mutex // protects largeStackFrames
- largeStackFrames []src.XPos // positions of functions whose stack frames are too large (rare)
+ largeStackFrames []largeStack
)
func errorexit() {