diff options
| author | cuiweixie <cuiweixie@gmail.com> | 2025-08-09 02:01:55 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-08-11 09:51:15 -0700 |
| commit | b096ddb9ea84efa28eafd7850b8f8a8b3e76e49f (patch) | |
| tree | 7864060b58c58eba376bb6e9c0df1e2ed86d3933 /src/internal/runtime/maps/runtime.go | |
| parent | a2431776ebc57ebc385d3fd9d3cc6eb89acb9d9c (diff) | |
| download | go-b096ddb9ea84efa28eafd7850b8f8a8b3e76e49f.tar.xz | |
internal/runtime/maps: loop invariant code motion with h2(hash) by hand
Change-Id: I0cd9763aeedfe326bc566da39b8be0d0ebd113ec
GitHub-Last-Rev: 1ec88644148deb41eea2ae89f7f1fb1759b37c27
GitHub-Pull-Request: golang/go#74952
Reviewed-on: https://go-review.googlesource.com/c/go/+/694016
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/internal/runtime/maps/runtime.go')
| -rw-r--r-- | src/internal/runtime/maps/runtime.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/internal/runtime/maps/runtime.go b/src/internal/runtime/maps/runtime.go index ff8a748249..8bba23f070 100644 --- a/src/internal/runtime/maps/runtime.go +++ b/src/internal/runtime/maps/runtime.go @@ -94,10 +94,11 @@ func runtime_mapaccess1(typ *abi.MapType, m *Map, key unsafe.Pointer) unsafe.Poi // Probe table. seq := makeProbeSeq(h1(hash), t.groups.lengthMask) + h2Hash := h2(hash) for ; ; seq = seq.next() { g := t.groups.group(typ, seq.offset) - match := g.ctrls().matchH2(h2(hash)) + match := g.ctrls().matchH2(h2Hash) for match != 0 { i := match.first() @@ -168,10 +169,11 @@ func runtime_mapaccess2(typ *abi.MapType, m *Map, key unsafe.Pointer) (unsafe.Po // Probe table. seq := makeProbeSeq(h1(hash), t.groups.lengthMask) + h2Hash := h2(hash) for ; ; seq = seq.next() { g := t.groups.group(typ, seq.offset) - match := g.ctrls().matchH2(h2(hash)) + match := g.ctrls().matchH2(h2Hash) for match != 0 { i := match.first() @@ -262,9 +264,10 @@ outer: var firstDeletedGroup groupReference var firstDeletedSlot uintptr + h2Hash := h2(hash) for ; ; seq = seq.next() { g := t.groups.group(typ, seq.offset) - match := g.ctrls().matchH2(h2(hash)) + match := g.ctrls().matchH2(h2Hash) // Look for an existing slot containing this key. for match != 0 { @@ -329,7 +332,7 @@ outer: slotElem = emem } - g.ctrls().set(i, ctrl(h2(hash))) + g.ctrls().set(i, ctrl(h2Hash)) t.growthLeft-- t.used++ m.used++ |
