aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/iface.go
AgeCommit message (Collapse)AuthorFilesLines
2019-09-06libgo: update to Go 1.13beta1 releaseIan Lance Taylor1-0/+10
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497 From-SVN: r275473
2019-08-31compiler, runtime: support and use single argument go:linknameIan Lance Taylor1-15/+14
The gc compiler has started permitting go:linkname comments with a single argument to mean that a function should be externally visible outside the package. Implement this in the Go frontend. Change the libgo runtime package to use it, rather than repeating the name just to export a function. Remove a couple of unnecessary go:linkname comments on declarations. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192197 From-SVN: r275239
2019-06-21runtime: inline and remove eqtypeIan Lance Taylor1-6/+6
Now that type equality is just a pointer equality, write it inlined and remove the eqtype function. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182978 From-SVN: r272578
2019-06-21compiler: open code some type assertionsIan Lance Taylor1-33/+4
Now that type equality is just simple pointer equality, we can open code some type assertions instead of making runtime calls. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182977 From-SVN: r272577
2019-05-01compiler,runtime: do more direct interfacesIan Lance Taylor1-6/+13
A direct interface is an interface whose data word contains the actual data value, instead of a pointer to it. The gc toolchain creates a direct interface if the value is pointer shaped, that includes pointers (including unsafe.Pointer), functions, channels, maps, and structs and arrays containing a single pointer-shaped field. In gccgo, we only do this for pointers. This CL unifies direct interface types with gc. This reduces allocations when converting such types to interfaces. Our method functions used to always take pointer receivers, to make interface calls easy. Now for direct interface types, their value methods will take value receivers. For a pointer to those types, when converted to interface, the interface data contains the pointer. For that interface to call a value method, it will need a wrapper method that dereference the pointer and invokes the value method. The wrapper method, instead of the actual one, is put into the itable of the pointer type. In the runtime, adjust funcPC for the new layout of interfaces of functions. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/168409 From-SVN: r270779
2019-05-01runtime: persistentalloc and cache itabsIan Lance Taylor1-31/+225
Previously, each time we do an interface conversion for which the method table is not known at compile time, we allocate a new method table. This CL ports the mechanism of itab caching from the gc runtime, adapted to our itab representation and method finding mechanism. With the cache, we reuse the same itab for the same (interface, concrete) type pair. This reduces allocations in interface conversions. Unlike the gc runtime, we don't prepopulate the cache with statically allocated itabs, as currently we don't have a way to find them. This means we don't deduplicate run-time allocated itabs with compile-time allocated ones. But that is not too bad -- it is just a cache anyway. As now itabs are never freed, it is also possible to drop the write barrier for writing the first word of an interface header. I'll leave this optimization for the future. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/171617 From-SVN: r270778
2018-09-24libgo: update to Go 1.11Ian Lance Taylor1-7/+43
Reviewed-on: https://go-review.googlesource.com/136435 gotools/: * Makefile.am (mostlyclean-local): Run chmod on check-go-dir to make sure it is writable. (check-go-tools): Likewise. (check-vet): Copy internal/objabi to check-vet-dir. * Makefile.in: Rebuild. From-SVN: r264546
2017-01-14libgo: update to Go 1.8 release candidate 1Ian Lance Taylor1-2/+2
Compiler changes: * Change map assignment to use mapassign and assign value directly. * Change string iteration to use decoderune, faster for ASCII strings. * Change makeslice to take int, and use makeslice64 for larger values. * Add new noverflow field to hmap struct used for maps. Unresolved problems, to be fixed later: * Commented out test in go/types/sizes_test.go that doesn't compile. * Commented out reflect.TestStructOf test for padding after zero-sized field. Reviewed-on: https://go-review.googlesource.com/35231 gotools/: Updates for Go 1.8rc1. * Makefile.am (go_cmd_go_files): Add bug.go. (s-zdefaultcc): Write defaultPkgConfig. * Makefile.in: Rebuild. From-SVN: r244456
2016-10-20runtime: rewrite interface code into GoIan Lance Taylor1-0/+334
I started to copy the Go 1.7 interface code, but the gc and gccgo representations of interfaces are too different. So instead I rewrote the gccgo interface code from C to Go. The code is largely the same as it was, but the names are more like those used in the gc runtime. I also copied over the string comparison functions, and tweaked the compiler to use eqstring when comparing strings for equality. Reviewed-on: https://go-review.googlesource.com/31591 From-SVN: r241384