aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/reflectdata
AgeCommit message (Collapse)Author
2026-01-27cmd/link, runtime: remove typelinksIan Lance Taylor
Instead of adding a typelinks section to a Go binary, mark the start and end of the typelinked type descriptors. The runtime can then step through the descriptors to find them all, rather than relying on the extra linker-generated offset list. The runtime steps through the type descriptors lazily, as many Go programs don't need the typelinks list at all. This reduces the size of cmd/go by 15K bytes, which isn't much but it's not nothing. A future CL will change the reflect package to use the type pointers directly rather than converting to offsets and then back to type pointers. For #6853 Change-Id: Id0af4ce81c5b1cea899fc92b6ff9d2db8ce4c267 Reviewed-on: https://go-review.googlesource.com/c/go/+/724261 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2026-01-26cmd/compile/internal/reflectdata: fix divide by zero for zero-size array ↵fumiyanokesinn
elements When generating equality signatures for arrays with zero-size ASPECIAL elements (e.g., [3]struct{_ [0]float64}), the compiler crashed with a divide by zero error when computing the loop unroll factor. Skip comparison code generation for zero-size elements since they need no comparison. Fixes #77303 Change-Id: Ib432cfece22b1cb714de4f0a0b0d1a2d89bb0d33 Reviewed-on: https://go-review.googlesource.com/c/go/+/738841 Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
2026-01-23cmd/compile: simplify AlgType usageKeith Randall
Only walk needs to distinguish different sizes of AMEM. Move the size-distinguishing AlgType there. Change-Id: I0a725b5bd13795a623b3668325f1068579abd340 Reviewed-on: https://go-review.googlesource.com/c/go/+/727461 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-23cmd/compile: simplify array parsing in equality signaturesKeith Randall
Change-Id: I166586a1f75165cd17df371f9af7cd5b6b3ddc32 Reviewed-on: https://go-review.googlesource.com/c/go/+/727502 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2026-01-23cmd/compile: clean up eq and hash implementationsKeith Randall
Use unsafe.Pointer instead of *any as the argument type. Now that we're using signatures, we don't have exact types so we might as well use unsafe.Pointer everywhere. Simplify hash function choice a bit. Change-Id: If1a07091031c4b966fde3a1d66295a04fd5a838c Reviewed-on: https://go-review.googlesource.com/c/go/+/727501 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2026-01-23cmd/compile: use equality signatures in hash function generationKeith Randall
There aren't a huge number of generated hash functions, so this probably won't save a whole lot of memory. But it means we can clean up a bunch of code by basing equality and hashing on the same underlying infrastructure. Change-Id: I36ed1e49044fecb33120d8736f1c0403a4a2554e Reviewed-on: https://go-review.googlesource.com/c/go/+/727500 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-23cmd/compile: reorg equality functions a bitKeith Randall
Use signature for closure name instead of type. Use signature instead of type to decide to use a runtime builtin comparator. Remove trailing skips from signatures. Change-Id: I73b2dcd3c6e2f1b2857985e14c24b290941b3ca3 Reviewed-on: https://go-review.googlesource.com/c/go/+/725604 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com>
2026-01-23cmd/compile: redo how equality functions are generatedkhr@golang.org
Instead of generating an equality function for each type that needs it, generate one per "signature". A "signature" is a summary of the comparisons needed to check a type for equality. For instance, the type type S struct { i int32 j uint32 s string e error } Will have the signature "M8SI". M8 = 8 bytes of regular memory S = string I = nonempty interface This way, potentially many types that have the same signature can share the same equality function. The number of generated equality functions in the go binary is reduced from 634 to 286. The go binary is ~1% smaller. The generation of equality functions gets simpler (particularly, how we do inlining of sub-types, unrolling, etc.) and the generated code is probably a bit more efficient. The new function names are kind of weird, but will seldom show up for users. They will appear in cpu profiles, and in tracebacks in the situation where comparisons panic because an interface somewhere in the type being compared contains an uncomparable type (e.g. a slice). Note that this CL only affects generated comparison functions. It does not generally affect generated code for == (except when that code decides to call a comparison function as a subtask). Maybe a TODO for the future. Update #6853 Change-Id: I202bd6424cb6bf7c745a62c9603d4f01dc1a1fc8 Reviewed-on: https://go-review.googlesource.com/c/go/+/725380 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
2025-11-12cmd/compile: don't clear ptrmask in fillptrmaskIan Lance Taylor
It is only ever called with a newly allocated slice. This clearing code dates back to the C version of the compiler, in which the function started like this: static void gengcmask(Type *t, uint8 gcmask[16]) { ... memset(gcmask, 0, 16); if(!haspointers(t)) return; That memset was required for C, but not for Go. Change-Id: I6fceb99b2dc8682685dca2e4289fcd58e2e5a0e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/718340 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-09-12cmd/compile: optimize abi.Type.GCData loadsJake Bailey
This fires in just one place; stkframe.go's stkobjinit. But, it does make the struct literal entirely constants. Change-Id: Ice76cb3cddd97adee011fdaab40597839da2e89f Reviewed-on: https://go-review.googlesource.com/c/go/+/701300 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2025-09-12cmd/compile, reflect: further allow inlining of TypeForJake Bailey
Previous CLs optimized direct use of abi.Type, but reflect.Type is indirected, so was not benefiting. For TypeFor, we can use toRType directly without a nil check because the types are statically known. Normally, I'd think SSA would remove the nil check, but due to some oddity (specifically, late fuse being required to remove the nil check, but opt doesn't run that late) means that the nil check persists and gets in the way. Manually writing the code in this instance seems to fix the problem. It also exposed another problem; depending on the ordering, writeType could get to a type symbol before SSA, thereby preventing Extra from being created on the symbol for later lookups that don't go through TypeLinksym directly. In writeType, for non-shape types, call TypeLinksym to ensure that the type is set up for later callers. That change itself passed toolstash -cmp. All up, this stack put through compilecmp shows a lot of improvement in various reflect-using packages, and reflect itself. It is too big to fit in the commit message but here's some info: compilecmp master -> HEAD master (d767064170): cmd/compile: mark abi.PtrType.Elem sym as used HEAD (846a94c568): cmd/compile, reflect: further allow inlining of TypeFor file before after Δ % addr2line 3735911 3735391 -520 -0.014% asm 6382235 6382091 -144 -0.002% buildid 3608568 3608360 -208 -0.006% cgo 5951816 5951480 -336 -0.006% compile 28362080 28339772 -22308 -0.079% cover 6668686 6661414 -7272 -0.109% dist 4311961 4311425 -536 -0.012% fix 3771706 3771474 -232 -0.006% link 8686073 8684993 -1080 -0.012% nm 3715923 3715459 -464 -0.012% objdump 6074366 6073774 -592 -0.010% pack 3025653 3025277 -376 -0.012% pprof 18269485 18261653 -7832 -0.043% test2json 3442726 3438390 -4336 -0.126% trace 16984831 16981767 -3064 -0.018% vet 10701931 10696355 -5576 -0.052% total 133693951 133639075 -54876 -0.041% runtime runtime.stkobjinit 240 -> 165 (-31.25%) runtime [cmd/compile] runtime.stkobjinit 240 -> 165 (-31.25%) reflect reflect.Value.Seq2.func3 309 -> 245 (-20.71%) reflect.Value.Seq2.func1.1 281 -> 198 (-29.54%) reflect.Value.Seq.func1.1 242 -> 165 (-31.82%) reflect.Value.Seq2.func2 360 -> 285 (-20.83%) reflect.Value.Seq.func4 281 -> 239 (-14.95%) reflect.Value.Seq2.func4 399 -> 284 (-28.82%) reflect.Value.Seq.func2 271 -> 230 (-15.13%) reflect.TypeFor[go.shape.uint64] 33 -> 18 (-45.45%) reflect.Value.Seq.func3 219 -> 178 (-18.72%) reflect [cmd/compile] reflect.Value.Seq2.func2 360 -> 285 (-20.83%) reflect.Value.Seq.func4 281 -> 239 (-14.95%) reflect.Value.Seq.func2 271 -> 230 (-15.13%) reflect.Value.Seq.func1.1 242 -> 165 (-31.82%) reflect.Value.Seq2.func1.1 281 -> 198 (-29.54%) reflect.Value.Seq2.func3 309 -> 245 (-20.71%) reflect.Value.Seq.func3 219 -> 178 (-18.72%) reflect.TypeFor[go.shape.uint64] 33 -> 18 (-45.45%) reflect.Value.Seq2.func4 399 -> 284 (-28.82%) fmt fmt.(*pp).fmtBytes 1723 -> 1691 (-1.86%) database/sql/driver reflect.TypeFor[go.shape.interface 33 -> 18 (-45.45%) database/sql/driver.init 72 -> 57 (-20.83%) Change-Id: I9eb750cf0b7ebf532589f939431feb0a899e42ff Reviewed-on: https://go-review.googlesource.com/c/go/+/701301 Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-08cmd/compile: optimize loads from abi.Type.{Size_,PtrBytes,Kind_}Jake Bailey
With the previous CL in place, we can now pretty easily optimize a few more loads from abi.Type. I've done Size_, PtrBytes, and Kind_, which are easily calculated. Among std/cmd, this rule fires a number of times: 75 abi.Type field Kind_ 50 abi.PtrType field Elem 14 abi.Type field Hash 4 abi.Type field Size_ 2 abi.Type field PtrBytes The other ones that show up when compiling std/cmd are TFlag and GCData, but these are not trivially calculated. Doing TFlag would probably be a decent help given it's often used in things like switches where statically knowing the kind could eliminate a bunch of dead code. Change-Id: Ic7fd2113fa7479af914d06916edbca60cc71819f Reviewed-on: https://go-review.googlesource.com/c/go/+/701298 Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-08-05cmd: remove dead codeqiulaidongfeng
Fixes #74076 Change-Id: Icc67b3d4e342f329584433bd1250c56ae8f5a73d Reviewed-on: https://go-review.googlesource.com/c/go/+/690635 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-07-30all: remove redundant Swiss prefixesMichael Pratt
Now that there is only one map implementation we can simplify names. For #54766. Change-Id: I6a6a636cc6a8fc5e7712c27782fc0ced7467b939 Reviewed-on: https://go-review.googlesource.com/c/go/+/691596 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-07-30all: remove GOEXPERIMENT=swissmapMichael Pratt
For #54766. Change-Id: I6a6a636c40b5fe2e8b0d4a5e23933492bc8bb76e Reviewed-on: https://go-review.googlesource.com/c/go/+/691595 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: 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>
2025-07-29internal/abi: move direct/indirect flag from Kind to TFlagKeith Randall
This info makes more sense in the flags instead of as a high bit of the kind. This makes kind access simpler because we now don't need to mask anything. Cleaned up most direct field accesses to use methods instead. (reflect making new types is the only remaining direct accessor.) IfaceIndir -> !IsDirectIface everywhere. gocore has been updated to handle the new location. So has delve. TODO: any other tools need updating? Change-Id: I123f97a4d4bdd0bff1641ee7e276d1cc0bd7e8eb Reviewed-on: https://go-review.googlesource.com/c/go/+/681936 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-07internal/runtime/maps: make clear also erase tombstoneskhr@golang.org
This will make future uses of the map faster because the probe sequences will likely be shorter. Change-Id: If10f3af49a5feaff7d1b82337bbbfb93bcd9dcb5 Reviewed-on: https://go-review.googlesource.com/c/go/+/633076 Auto-Submit: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com>
2025-04-18cmd/compile: use the builtin clearapocelipes
To simplify the code a bit. Change-Id: Ia72f576de59ff161ec389a4992bb635f89783540 GitHub-Last-Rev: eaec8216be964418a085649fcca53a042f28ce1a GitHub-Pull-Request: golang/go#73411 Reviewed-on: https://go-review.googlesource.com/c/go/+/666117 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2025-02-10cmd/compile: avoid ifaceeq call if we know the interface is directKeith Randall
We can just use == if the interface is direct. Fixes #70738 Change-Id: Ia9a644791a370fec969c04c42d28a9b58f16911f Reviewed-on: https://go-review.googlesource.com/c/go/+/635435 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-11-19internal/runtime/maps: assume constant elem offset with int64 and string keysKeith Randall
Note this doesn't work with int32 keys because alignment padding can change the offset of the element. Change-Id: I27804d3cfc7cc1b7f995f7e29630f0824f0ee899 Reviewed-on: https://go-review.googlesource.com/c/go/+/629418 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
2024-11-18runtime: get rid of gc programs for typesKeith Randall
Instead, have the runtime build the gc bitmaps on demand at runtime. Change-Id: If7a245bc62e4bce3ce80972410b0ed307d921abe Reviewed-on: https://go-review.googlesource.com/c/go/+/616255 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com>
2024-11-18cmd: change from sort functions to slices functionsIan Lance Taylor
Doing this because the slices functions are slightly faster and slightly easier to use. It also removes one dependency layer. We did this outside of bootstrap tools in CL 587655. Now that the bootstrap compiler is 1.22, we can do this in more code. Change-Id: I9ed2dd473758cacd14f76a0639368523ccdff72f Reviewed-on: https://go-review.googlesource.com/c/go/+/626038 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
2024-11-18cmd/compile: remove gc programs from stack frame objectsKeith Randall
This is a two-pronged approach. First, try to keep large objects off the stack frame. Second, if they do manage to appear anyway, use straight bitmasks instead of gc programs. Generally probably a good idea to keep large objects out of stack frames. But particularly keeping gc programs off the stack simplifies runtime code a bit. This CL sets the limit of most stack objects to 131072 bytes (on 64-bit archs). There can still be large objects if allocated by a late pass, like order, or they are required to be on the stack, like function arguments. But the size for the bitmasks for these objects isn't a huge deal, as we have already have (probably several) bitmasks for the frame liveness map itself. Change-Id: I6d2bed0e9aa9ac7499955562c6154f9264061359 Reviewed-on: https://go-review.googlesource.com/c/go/+/542815 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-11-17runtime/internal/maps: remove entryMaskKeith Randall
It is easily recomputed as capacity-1. This reduces a table from 40 to 32 bytes (on 64-bit archs). That gets us down one sizeclass. Change-Id: Icb74fb2de50baa18ca62052c7b2fe8e6af4c8837 Reviewed-on: https://go-review.googlesource.com/c/go/+/625198 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com>
2024-11-17internal/runtime/maps: eliminate a load from the hot pathKeith Randall
typ.Group.Size involves two loads. Instead cache GroupSize as a separate fields of the map type so we can get to it in just one load. Change-Id: I10ffdce1c7f75dcf448da14040fda78f0d75fd1d Reviewed-on: https://go-review.googlesource.com/c/go/+/627716 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-11-12runtime: fix iterator returns map entries after clear (pre-swissmap)Youlin Feng
Fixes #70189 Fixes #59411 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-noswissmap Change-Id: I4ef7ecd7e996330189309cb2a658cf34bf9e1119 Reviewed-on: https://go-review.googlesource.com/c/go/+/625275 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-11-07cmd/internal/obj: replace obj.Addrel func with LSym.AddRel methodRuss Cox
The old API was to do r := obj.AddRel(sym) r.Type = this r.Off = that etc The new API is: sym.AddRel(ctxt, obj.Reloc{Type: this: Off: that, etc}) This new API is more idiomatic and avoids ever having relocations that are only partially constructed. Most importantly, it sets up for sym.AddRel being able to check relocation validity in the future. (Passing ctxt is for use in validity checking.) Passes golang.org/x/tools/cmd/toolstash/buildall. Change-Id: I042ea76e61bb3bf6402f98ca11291a13f4799972 Reviewed-on: https://go-review.googlesource.com/c/go/+/625616 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-30internal/runtime/maps: store group across Iter.Next callsMichael Pratt
A previous CL kept it across loop iterations, but those are more rare than call iterations. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: Ieea0f1677e357f5e451650b1c697da7f63f3bca1 Reviewed-on: https://go-review.googlesource.com/c/go/+/621116 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-30internal/runtime/maps: cleanup seed usageMichael Pratt
Keep only a single seed; initialize it; and reset it when the map is empty. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: Icc231f70957337a2d0dcd9c7daf9bd3cb4354d71 Reviewed-on: https://go-review.googlesource.com/c/go/+/616466 Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-30cmd/compile,runtime: add indirect key/elem to swissmapMichael Pratt
We use the same heuristics as existing maps. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: I44bb51483cae2c1714717f1b501850fb9e55a39a Reviewed-on: https://go-review.googlesource.com/c/go/+/616461 Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-30runtime: add concurrent write checks to swissmapMichael Pratt
This is the same design as existing maps. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: I5f6ef5fea1e0f0616bcd90eaae7faee4cdac58c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/616460 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com>
2024-10-29internal/runtime/maps: remove type fieldsMichael Pratt
Rather than storing the same type pointer in multiple places, just pass it around. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: Ia6c74805c7a44125ae473177b317f16c6688e6de Reviewed-on: https://go-review.googlesource.com/c/go/+/622377 Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-28internal/runtime/maps: shift optimizationsMichael Pratt
Masking the shift lets the compiler elide a few instructions for handling a shift of > 63 bits. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: I669fe01caa1de1b8521f1f56b6906f3e9066a39b Reviewed-on: https://go-review.googlesource.com/c/go/+/611190 Auto-Submit: 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> Reviewed-by: Keith Randall <khr@google.com>
2024-10-28internal/runtime/maps: small maps point directly to a groupMichael Pratt
If the map contains 8 or fewer entries, it is wasteful to have a directory that points to a table that points to a group. Add a special case that replaces the directory with a direct pointer to a group. We could theoretically do similar for single table maps (no directory, just point directly to a table), but that is left for later. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: I6fc04dfc11c31dadfe5b5d6481b4c4abd43d48ed Reviewed-on: https://go-review.googlesource.com/c/go/+/611188 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com>
2024-10-28internal/runtime/maps: merge Iter.groupIdx and Iter.slotIdxMichael Pratt
For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: Ie21ef0f33f42735eadccd75eeebb3b5e81c2f459 Reviewed-on: https://go-review.googlesource.com/c/go/+/618535 Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Commit-Queue: Michael Pratt <mpratt@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-21cmd/link,runtime: DWARF/gdb support for swiss mapsMichael Pratt
For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-amd64-longtest-swissmap Change-Id: I6695c0b143560d974b710e1d78e7a7d09278f7cc Reviewed-on: https://go-review.googlesource.com/c/go/+/620215 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-21cmd/compile,internal/runtime/maps: add extendible hashingMichael Pratt
Extendible hashing splits a swisstable map into many swisstables. This keeps grow operations small. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-amd64-longtest-swissmap Change-Id: Id91f34af9e686bf35eb8882ee479956ece89e821 Reviewed-on: https://go-review.googlesource.com/c/go/+/604936 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2024-10-14all: wire up swisstable mapsMichael Pratt
Use the new SwissTable-based map in internal/runtime/maps as the basis for the runtime map when GOEXPERIMENT=swissmap. Integration is complete enough to pass all.bash. Notable missing features: * Race integration / concurrent write detection * Stack-allocated maps * Specialized "fast" map variants * Indirect key / elem For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-amd64-longtest-swissmap Change-Id: Ie97b656b6d8e05c0403311ae08fef9f51756a639 Reviewed-on: https://go-review.googlesource.com/c/go/+/594596 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-03cmd: replace many sort.Interface with slices.Sort and SortFuncZxilly
with slices there's no need to implement sort.Interface Change-Id: I59167e78881cb1df89a71e33d738d6aeca7adb71 GitHub-Last-Rev: 507ba84453f7305b6b2bf6317292111c00c93ffe GitHub-Pull-Request: golang/go#68724 Reviewed-on: https://go-review.googlesource.com/c/go/+/602895 Reviewed-by: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2024-08-02all: split old and swiss map abi and compiler integrationMichael Pratt
The two map implementations are still identical, but now the compiler targets the appropriate ABI depending on GOEXPERIMENT. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-amd64-longtest-swissmap Change-Id: I8438f64f044ba9de30ddbf2b8ceb9b4edd2d5614 Reviewed-on: https://go-review.googlesource.com/c/go/+/580779 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2024-04-02all: use kind* of abiqiulaidongfeng
For #59670 Change-Id: Id66e102f13e529dd041b68ce869026a56f0a1b9b GitHub-Last-Rev: 43aa9376f72bc02a9d86518cdc99494a6b2f8573 GitHub-Pull-Request: golang/go#65564 Reviewed-on: https://go-review.googlesource.com/c/go/+/562298 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Austin Clements <austin@google.com>
2024-03-18cmd/compile: simplify algorithm kindsKeith Randall
Add a ANOALG kind which is "ANOEQ, plus has a part that is marked Noalg". That way, AlgType can return just a kind. The field we used to return was used only to get this bit of information. Change-Id: Iaa409742825cc1f19ab414b1f5b74c1f112ed5f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/572075 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2024-02-20cmd/compile/internal/reflectdata,reflect: merge MaxPtrmaskBytes const into ↵qiulaidongfeng
internal/abi For #59670 Change-Id: I5c0a463f54208db215683f11e6454d0178edda3c GitHub-Last-Rev: 6963f3c8fb9cf34cdc8dda7ee92a58c71ca65520 GitHub-Pull-Request: golang/go#64904 Reviewed-on: https://go-review.googlesource.com/c/go/+/553275 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-02-08cmd/compile: generate itabs using rttype mechanismKeith Randall
Change-Id: I9a85704c57e978c8c6303b21da3e4627d3446f3e Reviewed-on: https://go-review.googlesource.com/c/go/+/549455 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2024-01-23cmd/compile: use MapMaxKeyBytes,MapMaxElemBytes,MapBucketCount of internal/abiqiulaidongfeng
For #59670 Change-Id: I651e211650e69989c598ab16202105bc6e68d67e GitHub-Last-Rev: fba087a35fa563cba0dc5f70e8c9d9108dc1f1d4 GitHub-Pull-Request: golang/go#64776 Reviewed-on: https://go-review.googlesource.com/c/go/+/550615 Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-10-24cmd/compile: reorganize compiler type descriptor generationKeith Randall
Use the new rttype mechanism to share internal/abi types between the compiler and runtime. Change-Id: I2bbba4d8090c6f7ff20dca15b7b665f5d04e5bfd Reviewed-on: https://go-review.googlesource.com/c/go/+/534936 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Run-TryBot: David Chase <drchase@google.com>
2023-10-09cmd/compile: use internal/abi types in the compilerKeith Randall
It is tricky to use those types directly, because the layout of those types in the compiler may not be the same as the layout of those types in target binary (typically because of 32 vs 64 bit differences). Instead, translate an internal/abi type into a cmd/compile/internal/types type, which will then be laid out for the target machine. Along with the translation, keep track of where all the bits of the type are so we can reference their locations symbolically instead of hardcoding them. Change-Id: I2694c58968d4dc7ead63a2b1b29adfedd90ddd2e Reviewed-on: https://go-review.googlesource.com/c/go/+/532155 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@google.com>
2023-10-05cmd/compile/internal/ir: tweak a couple namesMatthew Dempsky
CallExpr.X -> CallExpr.Fun This consistent with go/ast and cmd/compile/internal/syntax. OPRINTN -> OPRINTLN This op represents the "println" builtin; might as well spell it the same way. Change-Id: Iead1b007776658c717879cf0997b3c48028428f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/532795 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2023-09-14cmd/compile/internal/ir: add Func.DeclareParamsMatthew Dempsky
There's several copies of this function. We only need one. While here, normalize so that we always declare parameters, and always use the names ~pNN for params and ~rNN for results. Change-Id: I49e90d3fd1820f3c07936227ed5cfefd75d49a1c Reviewed-on: https://go-review.googlesource.com/c/go/+/528415 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com>
2023-09-12cmd/compile: rename OEFACE to OMAKEFACE and remove OCONVIDATAMatthew Dempsky
The "eface" in OEFACE suggests it's only for empty interfaces, and the documentation suggests that too. But it's actually used for both empty and non-empty interfaces, so rename to OMAKEFACE and adjust docs accordingly. Also, remove OCONVIDATA. This was used by the 1.18 frontend for constructing interfaces containing derived types, but the unified frontend always uses OCONVIFACE instead, so this is unused now. Change-Id: I6ec5c62f909b26027f2804e5b3373b7a00029246 Reviewed-on: https://go-review.googlesource.com/c/go/+/527336 Auto-Submit: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>