aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-reflect-call.c
AgeCommit message (Collapse)AuthorFilesLines
2019-09-17re PR go/91781 (r275691 breaks go test "reflect")Ian Lance Taylor1-8/+4
PR go/91781 reflect: promote integer closure return to full word The libffi library expects an integer return type to be promoted to a full word. Implement that when returning from a closure written in Go. This only matters on big-endian systems when returning an integer smaller than the pointer size, which is why we didn't notice it until now. Fixes https://gcc.gnu.org/PR91781. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195858 From-SVN: r275813
2019-08-30compile, runtime: permit anonymous and empty fields in C headerIan Lance Taylor1-41/+39
Permit putting structs with anonymous and empty fields in the C header file runtime.inc that is used to build the C runtime code. This is required for upcoming 1.13 support, as the m struct has picked up an anonymous field. Doing this lets the C header contain all the type descriptor structs, so start using those in the C code. This cuts the number of copies of type descriptor definitions from 3 to 2. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192343 From-SVN: r275227
2019-02-15compiler, runtime: harmonize types referenced by both C and GoIan Lance Taylor1-1/+2
Compiling with LTO revealed a number of cases in the runtime and standard library where C and Go disagreed about the type of an object or function (or where Go and code generated by the compiler disagreed). In all cases the underlying representation was the same (e.g., uintptr vs. void*), so this wasn't causing actual problems, but it did result in a number of annoying warnings when compiling with LTO. Reviewed-on: https://go-review.googlesource.com/c/160700 From-SVN: r268923
2017-01-03runtime: remove __go_alloc and __go_freeIan Lance Taylor1-1/+0
Move allocg and handling of allgs slice from C to Go. Reviewed-on: https://go-review.googlesource.com/34797 From-SVN: r244036
2016-11-18runtime, reflect: rewrite Go to FFI type conversion in GoIan Lance Taylor1-2/+10
As we move toward the Go 1.7 garbage collector, it's essential that all allocation of values that can contain Go pointers be done using the correct type descriptor. That is simplest if we do all such allocation in Go code. This rewrites the code that converts from a Go type to a libffi CIF into Go. Reviewed-on: https://go-review.googlesource.com/33353 From-SVN: r242578
2015-11-23re PR go/68496 ([libgo] reflect test fails on Linux x86-64)Ian Lance Taylor1-0/+6
PR go/68496 reflect: Allocate space for FFI functions returning a zero-sized type. The libffi library does not understand zero-sized types. We represent them as a struct with a single field of type void. If such a type is returned from a function, libffi will copy 1 byte of data. Allocate space for that byte, although we won't use it. Fixes https://gcc.gnu.org/PR68496. Reviewed-on: https://go-review.googlesource.com/17175 From-SVN: r230776
2015-01-16compiler, reflect, runtime: Use static chain for closures.Richard Henderson1-11/+4
Change from using __go_set_closure to passing the closure value in the static chain field. Uses new backend support for setting the closure chain in a call from C via __builtin_call_with_static_chain. Uses new support in libffi for Go closures. The old architecture specific support for reflect.MakeFunc is removed, replaced by the libffi support. All work done by Richard Henderson. * go-gcc.cc (Gcc_backend::call_expression): Add chain_expr argument. (Gcc_backend::static_chain_variable): New method. From-SVN: r219776
2014-07-19reflect, runtime: Use libffi closures to implement reflect.MakeFunc.Ian Lance Taylor1-317/+2
Keep using the existing 386 and amd64 code on those archs, since it is more efficient. From-SVN: r212853
2013-11-19reflect: Handle calls to functions that take or return empty structsIan Lance Taylor1-1/+4
Fixes issue 6761 This simple change seems to work fine, slightly to my surprise. This includes the tests I submitted to the main Go repository at https://codereview.appspot.com/26570046 From-SVN: r205001
2013-11-06libgo: Update to October 24 version of master library.Ian Lance Taylor1-1/+15
From-SVN: r204466
2013-09-03compiler, runtime: Use runtime functions to pass closure value.Ian Lance Taylor1-12/+5
This changes the compiler and runtime to not pass a closure value as the last argument, but to instead pass it via __go_set_closure and retrieve it via __go_get_closure. This eliminates the need for function descriptor wrapper functions. It will make it possible to retrieve the closure value in a reflect.MakeFunc function. From-SVN: r202233
2013-06-18compiler, runtime: Use function descriptors.Ian Lance Taylor1-6/+27
This changes the representation of a Go value of function type from being a pointer to function code (like a C function pointer) to being a pointer to a struct. The first field of the struct points to the function code. The remaining fields, if any, are the addresses of variables referenced in enclosing functions. For each call to a function, the address of the function descriptor is passed as the last argument. This lets us avoid generating trampolines, and removes the use of writable/executable sections of the heap. From-SVN: r200181
2013-03-01runtime, testing/quick: libffi doesn't handle complex on Alpha.Ian Lance Taylor1-1/+11
From Uros Bizjak. From-SVN: r196389
2012-11-02runtime: Fix reflect.Call support for 64-bit ints.Ian Lance Taylor1-7/+7
From-SVN: r193110
2012-11-01compiler, runtime: More steps toward separating int and intgo.Ian Lance Taylor1-10/+12
From-SVN: r193059
2012-02-14re PR go/48407 (libgo/configure --without-libffi doesn't work)Ian Lance Taylor1-1/+22
PR go/48407 runtime: Permit building libgo without libffi. From-SVN: r184234
2012-02-11runtime: Handle FFI promoting result types.Ian Lance Taylor1-1/+99
From-SVN: r184123
2011-06-14Change builtin make to runtime call at lowering time.Ian Lance Taylor1-1/+1
Use kindNoPointers as 6g does. * Make-lang.in (go/expressions.o): Depend on $(GO_RUNTIME_H). From-SVN: r175008
2011-05-20Update to current version of Go library.Ian Lance Taylor1-13/+42
From-SVN: r173931
2011-01-21Remove the types float and complex.Ian Lance Taylor1-4/+21
Update to current version of Go library. Update testsuite for removed types. * go-lang.c (go_langhook_init): Omit float_type_size when calling go_create_gogo. * go-c.h: Update declaration of go_create_gogo. From-SVN: r169098
2010-12-03Add Go frontend, libgo library, and Go testsuite.Ian Lance Taylor1-0/+358
gcc/: * gcc.c (default_compilers): Add entry for ".go". * common.opt: Add -static-libgo as a driver option. * doc/install.texi (Configuration): Mention libgo as an option for --enable-shared. Mention go as an option for --enable-languages. * doc/invoke.texi (Overall Options): Mention .go as a file name suffix. Mention go as a -x option. * doc/frontends.texi (G++ and GCC): Mention Go as a supported language. * doc/sourcebuild.texi (Top Level): Mention libgo. * doc/standards.texi (Standards): Add section on Go language. Move references for other languages into their own section. * doc/contrib.texi (Contributors): Mention that I contributed the Go frontend. gcc/testsuite/: * lib/go.exp: New file. * lib/go-dg.exp: New file. * lib/go-torture.exp: New file. * lib/target-supports.exp (check_compile): Match // Go. From-SVN: r167407