From c6ec0c360b352a369b45f5096449d47b503f9383 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sun, 11 Aug 2019 18:43:43 -0400 Subject: [PATCH] compiler/natives/src/sync: update for Go 1.13 internal API changes runtime_SemacquireMutex and runtime_Semrelease had a new parameter added in Go 1.13. Modify the signature of our override to match. The parameter is not used, since it's for tracing, which is not something GopherJS supports at this time. Add victim and victimSize struct fields, also new in Go 1.13, to our Pool struct override. Fixes: $ gopherjs build sync /goroot/src/sync/waitgroup.go:93:36: too many arguments /goroot/src/sync/rwmutex.go:133:44: too many arguments /goroot/src/sync/rwmutex.go:103:49: too many arguments /goroot/src/sync/rwmutex.go:85:44: too many arguments /goroot/src/sync/rwmutex.go:50:49: too many arguments /goroot/src/sync/pool.go:242:5: p.victim undefined (type *Pool has no field or method victim) /goroot/src/sync/pool.go:243:5: p.victimSize undefined (type *Pool has no field or method victimSize) /goroot/src/sync/pool.go:248:5: p.victim undefined (type *Pool has no field or method victim) /goroot/src/sync/pool.go:249:5: p.victimSize undefined (type *Pool has no field or method victimSize) /goroot/src/sync/pool.go:168:31: p.victimSize undefined (type *Pool has no field or method victimSize) /goroot/src/sync/pool.go:168:31: too many errors --- compiler/natives/src/sync/pool.go | 3 +++ compiler/natives/src/sync/sync.go | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler/natives/src/sync/pool.go b/compiler/natives/src/sync/pool.go index 629010d9e..2eef82bc9 100644 --- a/compiler/natives/src/sync/pool.go +++ b/compiler/natives/src/sync/pool.go @@ -8,6 +8,9 @@ type Pool struct { local unsafe.Pointer localSize uintptr + victim unsafe.Pointer + victimSize uintptr + store []interface{} New func() interface{} } diff --git a/compiler/natives/src/sync/sync.go b/compiler/natives/src/sync/sync.go index 2ae46e0a6..59dc2c32a 100644 --- a/compiler/natives/src/sync/sync.go +++ b/compiler/natives/src/sync/sync.go @@ -18,13 +18,14 @@ var semWaiters = make(map[*uint32][]chan bool) var semAwoken = make(map[*uint32]uint32) func runtime_Semacquire(s *uint32) { - runtime_SemacquireMutex(s, false) + runtime_SemacquireMutex(s, false, 0) } // SemacquireMutex is like Semacquire, but for profiling contended Mutexes. // Mutex profiling is not supported, so just use the same implementation as runtime_Semacquire. // TODO: Investigate this. If it's possible to implement, consider doing so, otherwise remove this comment. -func runtime_SemacquireMutex(s *uint32, lifo bool) { +func runtime_SemacquireMutex(s *uint32, lifo bool, skipframes int) { + // TODO: Use skipframes if needed/possible. if (*s - semAwoken[s]) == 0 { ch := make(chan bool) if lifo { @@ -41,8 +42,8 @@ func runtime_SemacquireMutex(s *uint32, lifo bool) { *s-- } -func runtime_Semrelease(s *uint32, handoff bool) { - // TODO: Use handoff if needed/possible. +func runtime_Semrelease(s *uint32, handoff bool, skipframes int) { + // TODO: Use handoff, skipframes if needed/possible. *s++ w := semWaiters[s]