mirror of
https://github.com/golang/go
synced 2024-11-19 15:54:46 -07:00
4c9a372946
In the function prologue, we emit a jump to the beginning of the function immediately after calling morestack. And in the runtime stack growing code, it decodes and emulates that jump. This emulation was necessary before we had per-PC SP deltas, since the traceback code assumed that the frame size was fixed for the whole function, except on the first instruction where it was 0. Since we now have per-PC SP deltas and PCDATA, we can correctly record that the frame size is 0. This makes the emulation unnecessary. This may be helpful for registerized calling convention, where there may be unspills of arguments after calling morestack. It also simplifies the runtime. Change-Id: I7ebee31eaee81795445b33f521ab6a79624c4ceb Reviewed-on: https://go-review.googlesource.com/30138 Reviewed-by: David Chase <drchase@google.com>
19 lines
469 B
Go
19 lines
469 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package runtime
|
|
|
|
import "unsafe"
|
|
|
|
// adjust Gobuf as if it executed a call to fn with context ctxt
|
|
// and then did an immediate Gosave.
|
|
func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) {
|
|
if buf.lr != 0 {
|
|
throw("invalid use of gostartcall")
|
|
}
|
|
buf.lr = buf.pc
|
|
buf.pc = uintptr(fn)
|
|
buf.ctxt = ctxt
|
|
}
|