aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2016-08-31runtime: make gsignal stack at least SIGSTKSZ bytesIan Lance Taylor1-1/+1
The default stack size for the gsignal goroutine, 32K, is not enough on ia64. Make sure that the stack size is at least SIGSTKSZ. Reviewed-on: https://go-review.googlesource.com/28224 From-SVN: r239894
2016-08-30runtime: use -fgo-c-header to build C header fileIan Lance Taylor1-1/+1
Use the new -fgo-c-header option to build a header file for the Go runtime code in libgo/go/runtime, and use the new header file in the C runtime code in libgo/runtime. This will ensure that the Go code and C code share the same data structures as we convert the runtime from C to Go. The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7 release, and then edited to remove unnecessary data structures and modify others for use with libgo. The new file libgo/go/runtime/mcache.go is an initial version of the same files in the Go 1.7 release, and will be replaced by the Go 1.7 file when we convert to the new memory allocator. The new file libgo/go/runtime/type.go describes the gccgo version of the reflection data structures, and replaces the Go 1.7 runtime file which describes the gc version of those structures. Using the new header file means changing a number of struct fields to use Go naming conventions (that is, no underscores) and to rename constants to have a leading underscore so that they are not exported from the Go package. These names were updated in the C code. The C code was also changed to drop the thread-local variable m, as was done some time ago in the gc sources. Now the m field is always accessed using g->m, where g is the single remaining thread-local variable. This in turn required some adjustments to set g->m correctly in all cases. Also pass the new -fgo-compiling-runtime option when compiling the runtime package, although that option doesn't do anything yet. Reviewed-on: https://go-review.googlesource.com/28051 From-SVN: r239872
2016-08-30compiler: add -fgo-c-header=FILE to create a C headerIan Lance Taylor11-27/+525
The new -fgo-c-header=FILE option will write a C header file defining all the struct types and numeric const values in package scope. This will be used when building the Go runtime package (libgo/go/runtime) to generate a C header file that may be included by the C code in the C runtime package (libgo/runtime). This will ensure that the Go code and C code are working with the same data structures as we convert the runtime from C to Go to upgrade to the current GC runtime, notably the concurrent garbage collector. Reviewed-on: https://go-review.googlesource.com/28000 * lang.opt (fgo-c-header, fgo-compiling-runtime): New options. * go-c.h (struct go_create_gogo_args): Define. (go_create_gogo): Change declaration to take struct pointer. * go-lang.c (go_c_header): New static variable. (go_langhook_init): Update call to go_create_gogo. * gccgo.texi (Invoking gccgo): Document -fgo-c-header and -fgo-compiling-runtime. From-SVN: r239852
2016-08-23compiler: revamp scheme for ordering calls to import init fcns.Ian Lance Taylor7-160/+538
Switch to a new method for determining the order in which import init functions are invoked: build an init fcn dependence DAG and walk the DAG to rewrite/adjust priorities to account for discrepancies introduced by "go test". This patch includes a change to the export data format generated by gccgo. Older versions of gccgo will not be able to read object files produced by a newer gccgo, but the new gcc will still be able to read old object files. Fixes golang/go#15738. Reviewed-on: https://go-review.googlesource.com/25301 From-SVN: r239708
2016-08-22compiler: don't permit P.M if P is a pointer typeIan Lance Taylor2-3/+5
When lowering method expressions of the form "P.M" where P is a pointer type (e.g. "type P *T") make sure we examine the method set of P and not T during method lookup. Fixes golang/go#15722. Reviewed-on: https://go-review.googlesource.com/24843 From-SVN: r239675
2016-08-15cmd/go: ignore errors from go/build for standard packagesIan Lance Taylor1-1/+1
The go/build package does not know that gccgo's standard packages don't have source, and will report an error saying that it can not find them. Work around that in the cmd/go sources, since the go/build sources don't currently have a list of standard packages. This should get a real fix in the master sources, somehow. Fixes golang/go#16701. Reviewed-on: https://go-review.googlesource.com/27052 From-SVN: r239486
2016-08-13libgo: don't unset in shell scriptIan Lance Taylor1-1/+1
Reportedly ksh fails to unset a variable that was not previously set. Change match.sh and gotest to not unset LANG, but instead set LANG=C. Also don't combine exporting and setting variable in a single statement. Reviewed-on: https://go-review.googlesource.com/26999 From-SVN: r239443
2016-08-13crypto/aes, hash/crc32: ignore s390x specific files for nowIan Lance Taylor1-1/+1
These files are used to select s390x assembler support in the gc toolchain. We don't currently have that support, as it is written in the cmd/asm syntax rather than gas syntax. Mark the files to be ignored for now, falling back to the default implementations. Patch by Andreas Krebbel. Reviewed-on: https://go-review.googlesource.com/26994 From-SVN: r239442
2016-08-13syscall: remove exec_solaris_test.goIan Lance Taylor1-1/+1
It is testing functionality that gccgo does not need and does not support. Reviewed-on: https://go-review.googlesource.com/26992 From-SVN: r239438
2016-08-11os: fix build tags for dir_regfile.goIan Lance Taylor1-1/+1
We want to build dir_regfile.go if not GNU/linux, and not solaris/386, and not solaris/sparc. The latter two conditions were incorrect. To write ! solaris/386 we have to write !solaris !386. I forgot De Morgan's Law. Reviewed-on: https://go-review.googlesource.com/26870 From-SVN: r239393
2016-08-10compiler: annotate or fix fall through cases in switch statementsIan Lance Taylor3-1/+4
A new GCC warning, -Wimplicit-fallthrough, detected these three cases where a switch case falls through to another. One of them looks like a bug, so I fixed it; the two other look like intended fall throughs so I just added a "fall through" comment to suppress the GCC warning. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Reviewed-on: https://go-review.googlesource.com/26695 From-SVN: r239332
2016-08-10gccgo.texi (Invoking gccgo): Document -fgo-optimize-allocs and -fgo-debug-escae.Ian Lance Taylor2-13/+87
* gccgo.texi (Invoking gccgo): Document -fgo-optimize-allocs and -fgo-debug-escae. (Compiler Directives): New chapter. (Function Names): Describe using //go:linkname. Suggest using -fgo-pkgpath rather than -fgo-prefix. From-SVN: r239316
2016-08-10compiler: implement go:noinline and go:nosplit directivesIan Lance Taylor3-3/+9
Reviewed-on: https://go-review.googlesource.com/26652 From-SVN: r239315
2016-08-09compiler: implement go:linkname compiler directiveIan Lance Taylor6-10/+126
Implement the go:linkname compiler directive for functions (both function definitions and function declarations). At least for now, give an error for code that tries to use go:linkname with a non-function. Reviewed-on: https://go-review.googlesource.com/26651 From-SVN: r239311
2016-08-09mksysinfo.sh: always define CLONE_NEWNETIan Lance Taylor1-1/+1
CLONE_NEWNET is needed to compile the syscall tests on GNU/Linux. The symbol is not defined in the CentOS 5.11 header files. Patch from Uros Bizjak. Reviewed-on: https://go-review.googlesource.com/26630 From-SVN: r239296
2016-08-09compiler: rewrite compiler directive supportIan Lance Taylor7-87/+298
Rewrite the compiler directive support to recognize all the compiler directives implemented by the current gc compiler. The directives other than go:linkname are now turned into GOPRAGMA flags attached to a function or function declaration. The go:linkname directive is turned into a map attached to the Lex object. No new directives are actually implemented yet, they are just recognized. Reviewed-on: https://go-review.googlesource.com/26610 From-SVN: r239282
2016-08-08text/template: reduce maxExecDepth for gccgo furtherIan Lance Taylor1-1/+1
We already lowered the limit of recursive template invocations from 100,000 to 10,000, but the tests still fail occasionally on x86_64-pc-linux-gnu when using GNU ld (so that split stacks are not fully functional). Reduce the limit further, to 1000, enough so that the test passes consistently. Permitting 1000 recursive template invocations still seems capacious enough for real world use. Reviewed-on: https://go-review.googlesource.com/25590 From-SVN: r239261
2016-08-08libgo: don't have .lo depend on .lo.depIan Lance Taylor1-1/+1
Having each .lo depend on the corresponding .lo.dep caused too many rebuilds, because the .lo.dep files are rebuilt when Makefile changes. Instead, if the .lo.dep file changes, remove the .lo file. Reviewed-on: https://go-review.googlesource.com/25588 From-SVN: r239258
2016-08-08testsuite: fix gotest for absolute srcdirIan Lance Taylor1-1/+1
The recent changes to Makefile.am mean that if you configure with an absolute path as srcdir then gotest will be invoked with absolute paths for the files. That case never worked. This patch fixes it. Reviewed-on: https://go-review.googlesource.com/25587 From-SVN: r239256
2016-08-08re PR go/72814 (reflect FAILs on 32-bit Solaris/SPARC: SIGILL)Ian Lance Taylor3-1/+38
PR go/72814 runtime: treat zero-sized result value as void Change the FFI interface to treat a call to a function that returns a zero-sized result as a call to a function that returns void. This is part of the fix for https://gcc.gnu.org/PR72814. On 32-bit SPARC systems, a call to a function that returns a non-zero-sized struct is followed by an unimp instruction that describes the size of the struct. The function returns to the address after the unimp instruction. The libffi library can not represent a zero-sized struct, so we wind up treating it as a 1-byte struct. Thus in that case libffi calls the function with an unimp instruction, but the function does not adjust the return address. The result is that the program attempts to execute the unimp instruction, causing a crash. This is part of a change that fixes the crash by treating all functions that return zero bytes as functions that return void. Reviewed-on: https://go-review.googlesource.com/25585 * go-gcc.cc (Gcc_backend::function_type): If the return type is zero bytes, treat the function as returning void. (return_statement): If the return type is zero bytes, don't actually return any values. From-SVN: r239252
2016-08-07internal/syscall/unix: fix syscalls for alpha, ia64, s390Ian Lance Taylor1-1/+1
Also change the configure script to set GOARCH correctly for ia64, and add ia64 as a processor to match.sh and gotest. Reviewed-on: https://go-review.googlesource.com/25549 From-SVN: r239225
2016-08-06libgo: fix getrandom build for 32-bit ppcIan Lance Taylor1-1/+1
Add a ppc build constraint for internal/syscall/unix. Reviewed-on: https://go-review.googlesource.com/25547 From-SVN: r239210
2016-08-06libgo: change build procedure to use build tagsIan Lance Taylor1-1/+1
Previously the libgo Makefile explicitly listed the set of files to compile for each package. For packages that use build tags, this required a lot of awkward automake conditionals in the Makefile. This CL changes the build to look at the build tags in the files. The new shell script libgo/match.sh does the matching. This required adjusting a lot of build tags, and removing some files that are never used. I verified that the exact same sets of files are compiled on amd64 GNU/Linux. I also tested the build on i386 Solaris. Writing match.sh revealed some bugs in the build tag handling that already exists, in a slightly different form, in the gotest shell script. This CL fixes those problems as well. The old code used automake conditionals to handle systems that were missing strerror_r and wait4. Rather than deal with those in Go, those functions are now implemented in runtime/go-nosys.c when necessary, so the Go code can simply assume that they exist. The os testsuite looked for dir_unix.go, which was never built for gccgo and has now been removed. I changed the testsuite to look for dir.go instead. Reviewed-on: https://go-review.googlesource.com/25546 From-SVN: r239189
2016-08-05re PR go/72812 (reflect FAILs with Solaris as)Ian Lance Taylor2-1/+127
PR go/72812 * go-gcc.cc (char_needs_encoding): New static function. (needs_encoding, fetch_utf8_char): New static functions. (encode_id): New static function. (Gcc_backend::global_variable): Set asm name if the name is not simple ASCII. (Gcc_backend::implicit_variable): Likewise. (Gcc_backend::implicit_variable_reference): Likewise. (Gcc_backend::immutable_struct): Likewise. (Gcc_backend::immutable_struct_reference): Likewise. (Gcc_backend::function): Likewise. From-SVN: r239179
2016-08-04runtime: fix incorrectly commented out code in heapdump.cIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/25490 From-SVN: r239144
2016-08-04text/template: reduce maxExecDepth for gccgoIan Lance Taylor1-1/+1
When using gccgo on systems without full support for split stacks a recursive template can overrun the available stack space. Reduce the limit from 100000 to 10000 to make this less likely. It's still high enough that real uses will work. Reviewed-on: https://go-review.googlesource.com/25467 From-SVN: r239141
2016-08-04compiler: include "go-system.h" in escape.ccIan Lance Taylor2-1/+3
Patch from Rainer Orth. Reviewed-on: https://go-review.googlesource.com/25466 From-SVN: r239140
2016-08-04escape: Enable escape analysis in gccgo.Ian Lance Taylor3-1/+12
Off by default, enabled through -fgo-optimize-allocs. Reviewed-on: https://go-review.googlesource.com/22378 From-SVN: r239109
2016-08-03gotest: multiple +build lines must all be trueIan Lance Taylor1-1/+1
The code that handled +build lines did not correctly require them to all be true. While looking into this I discovered that multiple +build lines were mishandled in a different way, because the shell does not preseve line breaks in backquoted data. Look for the +build token to tell us when we are switching from one +build line to another. Reviewed-on: https://go-review.googlesource.com/25460 From-SVN: r239100
2016-08-03compiler: improve type caching for interface typesIan Lance Taylor2-5/+18
Add a cached to Interface_info_expression::do_type() so as to reuse previously created interface types. This change reduces gccgo peak heap usage when compiling the "fmt" package from around 16mb to around 10mb. Fixes golang/go#16334 Reviewed-on: https://go-review.googlesource.com/24890 From-SVN: r239095
2016-08-03escape: Stack allocate non-escaping expressions.Ian Lance Taylor2-8/+44
Stack allocate expressions that the analysis tracked and determined did not escape. Reviewed-on: https://go-review.googlesource.com/22377 From-SVN: r239083
2016-08-02escape: Add basic debugging.Chris Manghane10-7/+577
Emit basic debug information when compiling with the flag -fgo-debug-escape#. Reviewed-on: https://go-review.googlesource.com/22376 2016-08-02 Chris Manghane <cmang@google.com> * lang.opt: Add -fgo-debug-escape option. * go-c.h (go_create_gogo): Add debug_escape_level parameter. * go-lang.c (go_langhook_init): Pass go_debug_escape_level to go_create_gogo. From-SVN: r239002
2016-07-26libgo: bump library version number for 1.7Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/25211 From-SVN: r238743
2016-07-26os/user: fix Solaris declaration.Ian Lance Taylor1-1/+1
Patch from Rainer Orth. Reviewed-on: https://go-review.googlesource.com/25210 From-SVN: r238742
2016-07-22libgo: update to go1.7rc3Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/25150 From-SVN: r238662
2016-07-22compiler: fix check for duplicate declarationIan Lance Taylor2-3/+10
The compiler check that issued a duplicate declaration error for a, a, a := 1, 2, 3 was incorrectly issuing an error for a, a, a = 1, 2, 3 While this is not particularly useful, it is valid Go. Test is https://golang.org/cl/25143. Reviewed-on: https://go-review.googlesource.com/25144 From-SVN: r238618
2016-07-12escape: Add escape notes to export data.Ian Lance Taylor6-5/+75
Reviewed-on: https://go-review.googlesource.com/22375 From-SVN: r238266
2016-07-06escape: Implement tag phase.Ian Lance Taylor2-6/+94
Adds notes to function parameters which summarize the escape of that parameter with respect to the function's scope. Reviewed-on: https://go-review.googlesource.com/18443 From-SVN: r238057
2016-06-14escape: Implement flood phase.Ian Lance Taylor2-5/+363
Walks the connection graphs built in the assign phase from the function context's sink, propagating the escape level to each visited node and uncovering nodes that leak out of their scope which implies they must be heap allocated. Reviewed-on: https://go-review.googlesource.com/18413 From-SVN: r237453
2016-06-14escape: Implement assign phase.Ian Lance Taylor7-122/+1566
Implementation of the assign/connect phase. Statements containing expressions which alias local, parameter, and global objects are analyzed and the alias relationship between objects containing pointers are captured in a connection graph to summarize the assignments within a function. Reviewed-on: https://go-review.googlesource.com/18302 From-SVN: r237424
2016-06-10compiler: fix quoting in error messageIan Lance Taylor2-2/+2
Reviewed-on: https://go-review.googlesource.com/23966 From-SVN: r237286
2016-05-13escape: Implement the discovery phase.Ian Lance Taylor2-4/+183
Implements the discovery phase according the SCC algorithm used in gc/esc.go. Traverse all functions to find components that are either trivial or recursive. The discovered function groups will be analyzed from the bottom-up to allow for an inter-procedural analysis. Reviewed-on: https://go-review.googlesource.com/18221 From-SVN: r236224
2016-05-06escape: Add escape graph nodes.Ian Lance Taylor5-17/+709
Introduces the nodes used to model connectivity in the escape graph and related state: a node's escape level and an encoding that will be added to import and export data. Reviewed-on: https://go-review.googlesource.com/18268 From-SVN: r235988
2016-05-06escape: Add skeleton for gc analysis.Chris Manghane6-1/+182
Introduces a skeleton replacement escape analysis which contains four different phases extracted from the escape analysis implementation in gc/esc.go. Also introduces the Escape_context each phase uses to make decisions. Reviewed-on: https://go-review.googlesource.com/18220 From-SVN: r235982
2016-04-29escape: Remove previously existing analysis.Chris Manghane17-2742/+11
* Make-lang.in (GO_OBJS): Remove go/dataflow.o, go/escape.o. Reviewed-on: https://go-review.googlesource.com/18261 From-SVN: r235649
2016-04-28compiler: Mark concurrent calls.Ian Lance Taylor3-4/+20
If a call expression is executed in an independent goroutine via use of a Go statement, mark it as concurrent. Reviewed-on: https://go-review.googlesource.com/18700 From-SVN: r235608
2016-04-28compiler: Export String_index_expression.Ian Lance Taylor3-61/+76
Exports String_index_expression and adds the getter `string` that returns the underlying string. This will be used to handle string indexing different from array indexing in escape analysis. Reviewed-on: https://go-review.googlesource.com/18545 From-SVN: r235602
2016-04-26compiler: Add Enclosed_var_expression.Ian Lance Taylor4-65/+164
Introduces an abstraction for a variable referenced in a closure. This maintains the underlying expression which accesses a field within a closure variable and gives easy access to the underlying Named_object. Reviewed-on: https://go-review.googlesource.com/22374 From-SVN: r235452
2016-04-23compiler: Expose runtime code through Func_expression.Ian Lance Taylor5-3/+70
Enables us to easily check if a Call_expression is a call to a runtime function and, if so, which runtime function is corresponds to. This will be used during escape analysis. Reviewed-on: https://go-review.googlesource.com/18544 From-SVN: r235383
2016-04-23cmd/go: bring in final version of gccgo pkg-config supportIan Lance Taylor1-1/+1
This updates gccgo to the final version of https://golang.org/cl/18790, by Michael Hudson-Doyle. Update golang/go#11739. Reviewed-on: https://go-review.googlesource.com/22400 From-SVN: r235380