]> git.ipfire.org Git - thirdparty/gcc.git/commit
compiler,runtime: do more direct interfaces
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 May 2019 21:34:16 +0000 (21:34 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 May 2019 21:34:16 +0000 (21:34 +0000)
commit5b66522271b62bfa8a6e3f36bfc898d4420cdb72
treee3583babaa67131fcef04311cf265c9415582ca9
parent551b38615cc0a4030a7aff85260848c63e9cd417
compiler,runtime: do more direct interfaces

    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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@270779 138bc75d-0d04-0410-961f-82ee72b054a4
12 files changed:
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/types.cc
gcc/go/gofrontend/types.h
libgo/go/reflect/all_test.go
libgo/go/reflect/type.go
libgo/go/runtime/iface.go
libgo/go/runtime/pprof/proto.go
libgo/go/runtime/proc.go
libgo/runtime/go-callers.c