aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-06-06 00:44:01 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-06-06 00:44:01 +0000
commit269f05ff58289cfdd3a35f0d9afc8e229a98f50e (patch)
tree5375b70ffa2d9dda8fe739d2ee1a4a412d7d5c96 /libgo/go/runtime
parent91bd9240f918e758b75e362847f4fc3de8f99a12 (diff)
downloadgcc-269f05ff58289cfdd3a35f0d9afc8e229a98f50e.zip
gcc-269f05ff58289cfdd3a35f0d9afc8e229a98f50e.tar.gz
gcc-269f05ff58289cfdd3a35f0d9afc8e229a98f50e.tar.bz2
compiler: make use of specialized fast map routines
In the runtime there are specialized fast map routines for certain kep types. This CL lets the compiler make use of these functions, instead of always using the generic ones. As we now generate multiple versions of map delete calls, to make things easier we delay the expansion of the built-in delete function to flatten phase. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/180858 From-SVN: r271983
Diffstat (limited to 'libgo/go/runtime')
-rw-r--r--libgo/go/runtime/map_fast32.go9
-rw-r--r--libgo/go/runtime/map_fast64.go9
-rw-r--r--libgo/go/runtime/map_faststr.go8
3 files changed, 26 insertions, 0 deletions
diff --git a/libgo/go/runtime/map_fast32.go b/libgo/go/runtime/map_fast32.go
index 1fa5cd9..07a35e1 100644
--- a/libgo/go/runtime/map_fast32.go
+++ b/libgo/go/runtime/map_fast32.go
@@ -9,6 +9,15 @@ import (
"unsafe"
)
+// For gccgo, use go:linkname to rename compiler-called functions to
+// themselves, so that the compiler will export them.
+//
+//go:linkname mapaccess1_fast32 runtime.mapaccess1_fast32
+//go:linkname mapaccess2_fast32 runtime.mapaccess2_fast32
+//go:linkname mapassign_fast32 runtime.mapassign_fast32
+//go:linkname mapassign_fast32ptr runtime.mapassign_fast32ptr
+//go:linkname mapdelete_fast32 runtime.mapdelete_fast32
+
func mapaccess1_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer {
if raceenabled && h != nil {
callerpc := getcallerpc()
diff --git a/libgo/go/runtime/map_fast64.go b/libgo/go/runtime/map_fast64.go
index d23ac23..d21bf06 100644
--- a/libgo/go/runtime/map_fast64.go
+++ b/libgo/go/runtime/map_fast64.go
@@ -9,6 +9,15 @@ import (
"unsafe"
)
+// For gccgo, use go:linkname to rename compiler-called functions to
+// themselves, so that the compiler will export them.
+//
+//go:linkname mapaccess1_fast64 runtime.mapaccess1_fast64
+//go:linkname mapaccess2_fast64 runtime.mapaccess2_fast64
+//go:linkname mapassign_fast64 runtime.mapassign_fast64
+//go:linkname mapassign_fast64ptr runtime.mapassign_fast64ptr
+//go:linkname mapdelete_fast64 runtime.mapdelete_fast64
+
func mapaccess1_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer {
if raceenabled && h != nil {
callerpc := getcallerpc()
diff --git a/libgo/go/runtime/map_faststr.go b/libgo/go/runtime/map_faststr.go
index eced15a..083980f 100644
--- a/libgo/go/runtime/map_faststr.go
+++ b/libgo/go/runtime/map_faststr.go
@@ -9,6 +9,14 @@ import (
"unsafe"
)
+// For gccgo, use go:linkname to rename compiler-called functions to
+// themselves, so that the compiler will export them.
+//
+//go:linkname mapaccess1_faststr runtime.mapaccess1_faststr
+//go:linkname mapaccess2_faststr runtime.mapaccess2_faststr
+//go:linkname mapassign_faststr runtime.mapassign_faststr
+//go:linkname mapdelete_faststr runtime.mapdelete_faststr
+
func mapaccess1_faststr(t *maptype, h *hmap, ky string) unsafe.Pointer {
if raceenabled && h != nil {
callerpc := getcallerpc()