From 0733682e5ff4cd294f5eccb31cbe87a543147bc6 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 22 Apr 2024 15:48:57 -0400 Subject: internal/runtime/maps: initial swiss table map implementation Add a new package that will contain a new "Swiss Table" (https://abseil.io/about/design/swisstables) map implementation, which is intended to eventually replace the existing runtime map implementation. This implementation is based on the fabulous github.com/cockroachdb/swiss package contributed by Peter Mattis. This CL adds an hash map implementation. It supports all the core operations, but does not have incremental growth. For #54766. Change-Id: I52cf371448c3817d471ddb1f5a78f3513565db41 Reviewed-on: https://go-review.googlesource.com/c/go/+/582415 Reviewed-by: Keith Randall Reviewed-by: Keith Randall Auto-Submit: Michael Pratt LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Knyszek --- src/internal/runtime/maps/runtime.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/internal/runtime/maps/runtime.go (limited to 'src/internal/runtime/maps/runtime.go') diff --git a/src/internal/runtime/maps/runtime.go b/src/internal/runtime/maps/runtime.go new file mode 100644 index 0000000000..9ebfb34b28 --- /dev/null +++ b/src/internal/runtime/maps/runtime.go @@ -0,0 +1,24 @@ +// Copyright 2024 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 maps + +import ( + "internal/abi" + "unsafe" +) + +// Functions below pushed from runtime. + +//go:linkname rand +func rand() uint64 + +//go:linkname typedmemmove +func typedmemmove(typ *abi.Type, dst, src unsafe.Pointer) + +//go:linkname typedmemclr +func typedmemclr(typ *abi.Type, ptr unsafe.Pointer) + +//go:linkname newarray +func newarray(typ *abi.Type, n int) unsafe.Pointer -- cgit v1.3-5-g9baa