runtime: support register ABI for finalizers

This change modifies runfinq to properly pass arguments to finalizers in
registers via reflectcall.

For #40724.

Change-Id: I414c0eff466ef315a0eb10507994e598dd29ccb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/300112
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Michael Anthony Knyszek 2020-10-22 16:55:55 +00:00 committed by Michael Knyszek
parent 415ca3f1f0
commit f009b5b226
4 changed files with 191 additions and 14 deletions

View file

@ -1220,3 +1220,18 @@ func (th *TimeHistogram) Count(bucket, subBucket uint) (uint64, bool) {
func (th *TimeHistogram) Record(duration int64) {
(*timeHistogram)(th).record(duration)
}
func SetIntArgRegs(a int) int {
lock(&finlock)
old := intArgRegs
intArgRegs = a
unlock(&finlock)
return old
}
func FinalizerGAsleep() bool {
lock(&finlock)
result := fingwait
unlock(&finlock)
return result
}