diff options
| author | Keith Randall <khr@golang.org> | 2017-05-31 08:45:10 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2017-08-15 01:52:23 +0000 |
| commit | 3d1699ea787f38be6088f9a098d6e08dafca9387 (patch) | |
| tree | a054a8dbebd936a9128e9505199f30f699dd4679 /src/runtime/runtime2.go | |
| parent | e098e5142dd9554352171423f175381fd14fd943 (diff) | |
| download | go-3d1699ea787f38be6088f9a098d6e08dafca9387.tar.xz | |
runtime: new itab lookup table
Keep itabs in a growable hash table.
Use a simple open-addressable hash table, quadratic probing, power
of two sized.
Synchronization gets a bit more tricky. The common read path now
has two atomic reads, one to get the table pointer and one to read
the entry out of the table.
I set the max load factor to 75%, kind of arbitrarily. There's a
space-speed tradeoff here, and I'm not sure where we should land.
Because we use open addressing the itab.link field is no longer needed.
I'll remove it in a separate CL.
Fixes #20505
Change-Id: Ifb3d9a337512d6cf968c1fceb1eeaf89559afebf
Reviewed-on: https://go-review.googlesource.com/44472
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/runtime/runtime2.go')
| -rw-r--r-- | src/runtime/runtime2.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index adfdec6eac..456b650f5c 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -624,14 +624,13 @@ type _func struct { // Needs to be in sync with // ../cmd/compile/internal/gc/reflect.go:/^func.dumptypestructs. type itab struct { - inter *interfacetype - _type *_type - link *itab - hash uint32 // copy of _type.hash. Used for type switches. - bad bool // type does not implement interface - inhash bool // has this itab been added to hash? - unused [2]byte - fun [1]uintptr // variable sized + inter *interfacetype + _type *_type + _ uintptr + hash uint32 // copy of _type.hash. Used for type switches. + bad bool // type does not implement interface + _ [3]byte + fun [1]uintptr // variable sized } // Lock-free stack node. |
