aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2017-01-10runtime: copy more scheduler code from Go 1.7 runtimeIan Lance Taylor1-1/+1
I looked at a diff of proc.go between Go 1.7 and gccgo, and copied over all the easy stuff. Reviewed-on: https://go-review.googlesource.com/35090 From-SVN: r244291
2017-01-10compiler, runtime: drop size arguments to hash/equal functionsIan Lance Taylor6-72/+298
Drop the size arguments for the hash/equal functions stored in type descriptors. Types know what size they are. To make this work, generate hash/equal functions for types that can use an identity comparison but are not a standard size and alignment. Drop the multiplications by 33 in the generated hash code and the reflect package hash code. They are not necessary since we started passing a seed value around, as the seed includes the hash of the earlier values. Copy the algorithms for standard types from the Go 1.7 runtime, replacing the C functions. Reviewed-on: https://go-review.googlesource.com/34983 From-SVN: r244256
2017-01-09runtime: copy more of scheduler from Go 1.7 runtimeIan Lance Taylor1-1/+1
This started by moving procresize from C to Go so that we can pass the right type to the memory allocator when allocating a p, which forced the gomaxprocs variable to move from C to Go, and everything else followed from that. Reviewed-on: https://go-review.googlesource.com/34916 From-SVN: r244236
2017-01-06re PR go/78978 (runtime/pprof FAILs on Solaris 2/x86)Ian Lance Taylor1-1/+1
PR go/78978 libgo: build with -Wa,-nH if possible on Solaris By default the Solaris assembler records the required hardware capability in the object file. This means that the AES hashing code breaks on systems that do not support AES, even though the code uses a runtime check to only actually invoke the AES instructions on systems that support it. An earlier fix for the problem only fixed the shared library, not the static libgo.a. Fix the problem for real by using an assembler option to not record the hardware capability. For GCC PR 78978. Patch by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/34910 From-SVN: r244165
2017-01-03runtime: remove __go_alloc and __go_freeIan Lance Taylor1-1/+1
Move allocg and handling of allgs slice from C to Go. Reviewed-on: https://go-review.googlesource.com/34797 From-SVN: r244036
2017-01-03re PR go/78789 (Error: no such instruction: `aesenc %xmm0,%xmm2' when ↵Ian Lance Taylor1-1/+1
compiling libgo/runtime/aeshash.c) PR go/78789 runtime: don't build aeshash.c if the assembler doesn't support it This is for CentOS 5, whose assembler does not know the aesinc instruction. Fixes GCC PR 78789. Patch by Uros Bizjak. Reviewed-on: https://go-review.googlesource.com/34796 From-SVN: r244031
2017-01-01Update copyright years.Jakub Jelinek14-13/+15
From-SVN: r243994
2017-01-01gcc.c (process_command): Update copyright notice dates.Jakub Jelinek2-2/+6
gcc/ * gcc.c (process_command): Update copyright notice dates. * gcov-dump.c (print_version): Ditto. * gcov.c (print_version): Ditto. * gcov-tool.c (print_version): Ditto. * gengtype.c (create_file): Ditto. * doc/cpp.texi: Bump @copying's copyright year. * doc/cppinternals.texi: Ditto. * doc/gcc.texi: Ditto. * doc/gccint.texi: Ditto. * doc/gcov.texi: Ditto. * doc/install.texi: Ditto. * doc/invoke.texi: Ditto. gcc/fortran/ * gfortranspec.c (lang_specific_driver): Update copyright notice dates. * gfc-internals.texi: Bump @copying's copyright year. * gfortran.texi: Ditto. * intrinsic.texi: Ditto. * invoke.texi: Ditto. gcc/ada/ * gnat_ugn.texi: Bump @copying's copyright year. * gnat_rm.texi: Likewise. gcc/go/ * gccgo.texi: Bump @copyrights-go year. libitm/ * libitm.texi: Bump @copying's copyright year. libgomp/ * libgomp.texi: Bump @copying's copyright year. libquadmath/ * libquadmath.texi: Bump @copying's copyright year. From-SVN: r243992
2016-12-30compile: add type conversion in Type::gc_symbol_pointerIan Lance Taylor2-2/+5
Wrap the return from Type::gc_symbol_pointer with a type conversion to uintptr, since the values returned are stored into structure fields with that type. Reviewed-on: https://go-review.googlesource.com/34625 From-SVN: r243978
2016-12-30compiler: use more accurate array type in Gogo::register_gc_varsIan Lance Taylor2-4/+4
The length of the roots array in Gogo::register_gc_vars was being computed incorrectly, potentially leading to type clashes in the back end. Compute an accurate length for this array ahead of time. Reviewed-on: https://go-review.googlesource.com/34624 From-SVN: r243974
2016-12-22compiler: fix spurious redefinition error for anon structIan Lance Taylor3-26/+28
Change Struct_type::do_mangled_name to incorporate the field names even for hidden symbols. This is needed in cases where a package imports a type "S" that has an anonymous struct, e.g. // imported from some other package type S struct { X struct{ _ struct{} } } and then defines a local type that uses a structurally identical anonymous struct, e.g. // defined locally type T struct { U struct{ _ struct{} } } In the case above both types triggered the creation of hash/equal methods, but the method names were clashing (since both structs had the same mangled name). Fixes golang/go#18414 Reviewed-on: https://go-review.googlesource.com/34621 From-SVN: r243899
2016-12-19runtime: copy cgo support from Go 1.7 runtimeIan Lance Taylor1-1/+1
Remove support for _cgo_allocate. It was removed from the gc toolchain in Go 1.5, so it is unlikely that anybody is trying to use it. Reviewed-on: https://go-review.googlesource.com/34557 From-SVN: r243805
2016-12-16compiler: add containing Bfunction to some backend interfaces.Than McIntosh8-68/+135
Change the interfaces for backend methods that create statements to always pass in the enclosing Bfunction for the statement. Having the function available simplifies things if a temporary variable has to be created during the construction of a statement. This also includes a change to the Mark_lvalue_varexprs helper class to handle indirections on the left hand side of assignments (e.g. "*x.y = ..."). Reviewed-on: https://go-review.googlesource.com/34471 * go-gcc.cc (Gcc_backend::expression_statement): Add Bfunction* parameter. (Gcc_backend::init_statement): Likewise. (Gcc_backend::assignment_statement): Likewise. (Gcc_backend::if_statement): Likewise. From-SVN: r243766
2016-12-16compiler: fix comments + fieldnames to match libgo sourceIan Lance Taylor2-13/+13
A couple of the comments in the type descriptor code were out of date with respect to the names in libgo/go/runtime/type.go. Fix up the comments and field names to bring them into sync. Reviewed-on: https://go-review.googlesource.com/34472 From-SVN: r243735
2016-12-15compiler: fix off-by-1 array type len in Type::gc_symbol_constructorIan Lance Taylor2-2/+2
Array type being built to hold GC var initializer was being created with an extra/unneeded slot. Fix up the code to insure that the array length matches the length of the initializer list. Reviewed-on: https://go-review.googlesource.com/34413 From-SVN: r243731
2016-12-15re PR go/78763 (go1: internal compiler error: in do_get_backend, at ↵Ian Lance Taylor3-20/+50
go/gofrontend/expressions.cc:8352) PR go/78763 compiler: call determine_types even for constant expressions We need to call determine_types even for constant expressions, since a constant expression may include code like unsafe.Sizeof(0). Something needs to determine the type of the untyped 0, and that should be the determine_types pass. Implementing that triggered a compiler crash on test/const1.go because it permitted some erroneous constants to make it all the way to the backend. Catch that case by checking whether we get a constant overflow error, and marking the expression invalid if we do. This is a good change in any case, as previously we reported the same constant overflow error multiple times, and now we only report it once. Fixes GCC PR 78763. Reviewed-on: https://go-review.googlesource.com/34496 From-SVN: r243729
2016-12-15compiler: remove unneeded zero-length slice value initIan Lance Taylor2-7/+1
Prune away a bit of unnecessary code from the helper routine Slice_construction_expression::create_array_val() that was adding an extra NULL value to empty slices (no longer needed). Reviewed-on: https://go-review.googlesource.com/34410 From-SVN: r243682
2016-12-13libgo: fixes for Solaris buildIan Lance Taylor1-1/+1
Don't put m[0-4] in runtime.inc. Pass -mclear-hwcap to the linker if supported. From Rainer Orth. Reviewed-on: https://go-review.googlesource.com/34331 From-SVN: r243619
2016-12-08runtime: mark non-x86 aeshashbody parameters as unusedIan Lance Taylor1-1/+1
Avoids warnings during the build. Reviewed-on: https://go-review.googlesource.com/34142 From-SVN: r243459
2016-12-08runtime: copy memory hash code from Go 1.7Ian Lance Taylor2-2/+2
Rewrite the AES hashing code from gc assembler to C code using intrinsics. The resulting code generates the same hash code for the same input as the gc code--that doesn't matter as such, but testing it ensures that the C code does something useful. Also change mips64pe32le to mips64p32le in configure script--noticed during CL review. Reviewed-on: https://go-review.googlesource.com/34022 From-SVN: r243445
2016-12-08runtime: allocate _panic struct on heapIan Lance Taylor1-1/+1
The gc library allocates a _panic struct on the stack. This does not work for gccgo, because when a deferred function recovers the panic we unwind the stack up to that point so that returning from the function will work correctly. Allocating on the stack fine if the panic is not recovered, and it works fine if the panic is recovered by a function that returns. However, it fails if the panic is recovered by a function that itself panics, and if that second panic is then recovered by a function higher up on the stack. When we unwind the stack to that second panic, the g will wind up pointing at a panic farther down on the stack. Even then everything will often work fine, except when the deferred function catching the second panic makes a bunch of calls that use stack space before returning. In that case the code can overwrite the panic struct, which will then cause disaster when we remove the struct from the linked list, as the link field will be garbage. This case is rare enough that all the x86 tests were passing, but there was a failure on ppc64le. Before https://golang.org/cl/33414 we allocated the panic struct on the heap, so go back to doing that again. Fixes golang/go#18228. Reviewed-on: https://go-review.googlesource.com/34027 From-SVN: r243444
2016-12-08compiler: make Slice_construction_expression::do_flatten idempotentIan Lance Taylor2-3/+3
Because of the way we handle call expressions with multiple results, it's possible for expressions to be flattened more than once. In the case of Slice_construction_expression, allocating the slice storage multiple times caused a compiler crash as one of the Temporary_statement's wound up not getting a backend expression. Test case is https://golang.org/cl/34020. Reviewed-on: https://go-review.googlesource.com/34026 From-SVN: r243442
2016-12-08runtime: remove some unused variables/declarations from runtime.hIan Lance Taylor1-1/+1
Small patch from Eric Botcazou. Reviewed-on: https://go-review.googlesource.com/34029 From-SVN: r243424
2016-12-06compiler: pass lvalue/rvalue context to back end for var exprsThan McIntosh10-28/+139
Add a new flag on the Var_expression class that indicates whether the var reference appears in an "lvalue" context (for example, on the LHS of an assignment stmt) or an "rvalue" context (for example, as an argument of a call). Add a traversal pass that visits assignment stmt LHS subtrees so as to mark things prior to backend gen. Select the right context value in other places where Backend::var_expression is called. Reviewed-on: https://go-review.googlesource.com/33990 * go-gcc.cc (Gcc_backend::var_expression): Add Varexpr_context parameter. From-SVN: r243321
2016-12-01compiler: add slice initializers to the GC root listIan Lance Taylor5-5/+128
As of https://golang.org/cl/32917 we can put slice initializers in the .data section. The program can still change the values in those slices. That means that if the slice elements can contain pointers, we need to register the entire initializer as a GC root. This would be straightforward except that we only have a Bexpression for the slice initializer, not an Expression. So introduce a Backend_expression type that wraps a Bexpression as an Expression. The test case for this is https://golang.org/cl/33790. Reviewed-on: https://go-review.googlesource.com/33792 From-SVN: r243129
2016-12-01runtime: set isarchive in initsigIan Lance Taylor1-1/+1
The library initialization code in go-libmain.c sets the C variable runtime_isarchive but failed to set the Go variable runtime.isarchive. We don't currently have a way to let C code access an unexported Go variable, but fortunately the only time the Go function initsig is called with an argument of true is exactly where we want to set isarchive. So let initsig do it. Reviewed-on: https://go-review.googlesource.com/33753 From-SVN: r243094
2016-11-30runtime: print C functions in tracebackIan Lance Taylor1-1/+1
Since gccgo can trace back through C code as easily as Go code, we should print C functions in the traceback. This worked before https://golang.org/cl/31230 for a dumb reason. The default value for runtime.traceback_cache was, and is, 2 << 2, meaning to print all functions. The old C code for runtime_parsedebugvars would return immediately and do nothing if the environment variable GODEBUG was not set (if GODEBUG was set it would later call setTraceback. The new Go code for runtime.parsedebugvars does not return immediately if GODEBUG is not set, and always calls setTraceback. Either way, if GOTRACEBACK is not set, setTraceback would set traceback_cache to 1 << 2, meaning to only print non-runtime functions and having the effect of not printing plain C functions. Keep the current handling of GODEBUG/GOTRACEBACK, which matches the gc library, but add an extra check to print C functions by default. Reviewed-on: https://go-review.googlesource.com/33717 From-SVN: r243083
2016-11-30runtime: fixes for -buildmode=c-archiveIan Lance Taylor1-1/+1
With -buildmode=c-archive, initsig is called before the memory allocator has been initialized. The code was doing a memory allocation because of the call to funcPC(sigtramp). When escape analysis is fully implemented, that call should not allocate. For now, finesse the issue by calling a C function to get the C function pointer value of sigtramp. When returning from a call from C to a Go function, a deferred function is run to go back to syscall mode. When the call occurs on a non-Go thread, that call sets g to nil, making it impossible to add the _defer struct back to the pool. Just drop it and let the garbage collector clean it up. Reviewed-on: https://go-review.googlesource.com/33675 From-SVN: r242992
2016-11-22compiler: relocate ID encoding utilities to gofrontendThan McIntosh10-192/+303
Relocate the code that encodes/sanitizes identifiers to make them assembler-friendly, moving it from the back end to the front end; the decisions about when to encode an identifier and the calls to the encoding helpers now take place entirely in gofrontend. Reviewed-on: https://go-review.googlesource.com/33424 * go-gcc.cc (char_needs_encoding): Remove. (needs_encoding, fetch_utf8_char, encode_id): Remove. (Gcc_backend::global_variable): Add asm_name parameter. Don't compute asm_name here. (Gcc_backend::implicit_variable): Likewise. (Gcc_backend::implicit_variable_reference): Likewise. (Gcc_backend::immutable_struct): Likewise. (Gcc_backend::immutable_struct_reference): Likewise. * Make-lang.in (GO_OBJS): Add go/go-encode-id.o. From-SVN: r242726
2016-11-22re PR go/77910 (go: open zversion.go: no such file or directory)Ian Lance Taylor1-1/+1
PR go/77910 cmd/go: don't check standard packages when using gccgo This copies https://golang.org/cl/33295 to libgo. This fixes GCC PR 77910. Reviewed-on: https://go-review.googlesource.com/33471 From-SVN: r242724
2016-11-22runtime: rewrite panic/defer code from C to GoIan Lance Taylor9-35/+46
The actual stack unwind code is still in C, but the rest of the code, notably all the memory allocation, is now in Go. The names are changed to the names used in the Go 1.7 runtime, but the code is necessarily somewhat different. The __go_makefunc_can_recover function is dropped, as the uses of it were removed in https://golang.org/cl/198770044. Reviewed-on: https://go-review.googlesource.com/33414 From-SVN: r242715
2016-11-18runtime: move schedt type and sched var from C to GoIan Lance Taylor1-1/+1
This doesn't change any actual code, it just starts using the Go definition of the schedt type and the sched variable rather than the C definitions. The schedt type is tweaked slightly for gccgo. We aren't going to release goroutine stacks, so we don't need separate gfreeStack and gfreeNostack lists. We only have one size of defer function, so we don't need a list of 5 different pools. Reviewed-on: https://go-review.googlesource.com/33364 From-SVN: r242600
2016-11-18runtime: don't call __go_alloc/__go_free in environment functionsIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/33363 From-SVN: r242594
2016-11-18libgo: remove old/regexp and old/templateIan Lance Taylor1-1/+1
They were removed from the master Go library in 2012 (https://golang.org/cl/5979046) but somehow that was not reflected here. Reviewed-on: https://go-review.googlesource.com/33391 From-SVN: r242592
2016-11-18Correct gcc/go/gofrontend/lex.cc and libgo/aclocal.m4 to the versions in the ↵Ian Lance Taylor1-2/+2
gofrontend repo... Correct gcc/go/gofrontend/lex.cc and libgo/aclocal.m4 to the versions in the gofrontend repo, which is supposed to be the master copy. Remove a few files in libgo that somehow were not deleted in the past. From-SVN: r242583
2016-11-18runtime, reflect: rewrite Go to FFI type conversion in GoIan Lance Taylor1-1/+1
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
2016-11-16runtime: replace runtime1.goc with Go and C codeIan Lance Taylor1-1/+1
A step toward eliminating goc2c. Drop the exported parfor code; it was needed for tests in the past, but no longer is. The Go 1.7 runtime no longer uses parfor. Reviewed-on: https://go-review.googlesource.com/33324 From-SVN: r242509
2016-11-16compiler: separate incomparable types from comparable onesIan Lance Taylor2-3/+21
Otherwise we can accidentally and incorrectly mark an actual user type as incomparable. This fixes the gccgo version of https://golang.org/issue/17752. The test case for gccgo is https://golang.org/cl/33249. Reviewed-on: https://go-review.googlesource.com/33292 From-SVN: r242494
2016-11-14runtime: don't crash if signal handler info argument is nilIan Lance Taylor1-1/+1
Apparently on Solaris 10 a SA_SIGINFO signal handler can be invoked with a nil info argument. I would not have believed it but I've now seen it happen, and the sigaction man page actually says "If the second argument is not equal to NULL, it points to a siginfo_t structure...." So, if that happens, don't crash. Also fix another case where we want to make sure that &T{} does not allocate. Reviewed-on: https://go-review.googlesource.com/33150 From-SVN: r242403
2016-11-11libgo: fix GOARCH_INT64ALIGN for several targetsIan Lance Taylor1-1/+1
From Andreas Schwab. Reviewed-on: https://go-review.googlesource.com/33130 From-SVN: r242072
2016-11-10runtime: copy signal code from Go 1.7 runtimeIan Lance Taylor5-5/+15
Add a little shell script to auto-generate runtime.sigtable from the known signal names. Force the main package to always import the runtime package. Otherwise some runtime package global variables may never be initialized. Set the syscallsp and syscallpc fields of g when entering a syscall, so that the runtime package knows when a g is executing a syscall. Fix runtime.funcPC to avoid dead store elimination of the interface value when the function is inlined. Reviewed-on: https://go-review.googlesource.com/33025 From-SVN: r242060
2016-11-09compiler: rework static initializer codeIan Lance Taylor4-73/+140
Rename is_immutable to is_static_initializer to try to capture what it really means. Be more precise about when an address expression, or a binary expression, can be a static initializer. Don't check whether a type has pointers when deciding whether an initializer must be read-write, just check whether it is being used to initialize a global variable. To make that work set the Translate_context function to NULL for a global variable with a static initializer. The effect of this is to let more global variables be initialized directly, rather than being initialized in the generated init function. Reviewed-on: https://go-review.googlesource.com/32917 From-SVN: r242024
2016-11-05re PR go/78172 (gen-sysinfo.go vs AIX cred.h)Ian Lance Taylor1-1/+1
PR go/78172. libgo: avoid confusion in upcase_fields in mksysinfo.sh The mksysinfo.sh script could get confused when there were multiple types starting with the same name. I believe this is the underlying cause of GCC PR 78172. Also redirect a grep to /dev/null to avoid extraneous messages during the build. Reviewed-on: https://go-review.googlesource.com/32821 From-SVN: r241868
2016-11-01libgo: fix GOARCH_PHYSPAGESIZE for ia64Ian Lance Taylor1-1/+1
From Andreas Schwab. Reviewed-on: https://go-review.googlesource.com/32537 From-SVN: r241757
2016-11-01runtime: recreate function called by cgo -gccgoIan Lance Taylor1-1/+1
When using cgo -gccgo calls to C.GoString, C.GoStringN, and C.GoBytes are turned into calls to __go_byte_array_to_string and __go_string_to_byte_array. Those functions were removed when the string code was copied from Go 1.7, but we still need them for cgo. While cgo should be updated, old versions will exist for some time. Reviewed-on: https://go-review.googlesource.com/32474 From-SVN: r241743
2016-11-01libgo: only rebuild package if dependent .gox has changedIan Lance Taylor1-1/+1
Use mvifdiff and stamp files to track whether a .gox file has changed. When package A depends on package B, and we rebuild package B, only rebuild package A if package B's .gox file changes. This is safe because when package A imports package B it only reads package B's .gox file. This means that changes that do not affect export information will not cause dependent packages to be recompiled. Reviewed-on: https://go-review.googlesource.com/32476 From-SVN: r241742
2016-11-01libgo: minor Makefile improvementsIan Lance Taylor1-1/+1
Suggested by Ralph Corderoy. Reviewed-on: https://go-review.googlesource.com/32414 From-SVN: r241741
2016-11-01re PR go/78145 (Several go.test tests fail with error: integer constant ↵Ian Lance Taylor2-2/+2
overflow on 32bit targets) PR go/78145 compiler: don't put print/println constants into temporaries It's not necessary, and it breaks setting their type to int64/uint64 when appropriate. This fixes GCC PR 78145. Reviewed-on: https://go-review.googlesource.com/32475 From-SVN: r241740
2016-10-30compiler: fix slice/array evaluation order bugIan Lance Taylor3-105/+147
There was a phase ordering issue in the handling of "keyed" array literal expressions: the lowering phase was canonicalizing the indices/vals before the phase that fixed evaluation order, meaning that the evaluation order was incorrect. The fix is to capture the orginal ordering and use that ordering when doing traversals (there is already something similar being done for struct literal expressions). Fixes golang/go#17640 Reviewed-on: https://go-review.googlesource.com/32296 From-SVN: r241688
2016-10-30libgo: eliminate a lot of duplication in Makefile.amIan Lance Taylor1-1/+1
I read through the GNU make manual. I knew there had to be a way to do it. Remove the special netgo library. The essential feature--using the Go DNS resolver--is now available by setting GODEBUG=netdns=go. Reviewed-on: https://go-review.googlesource.com/32333 From-SVN: r241687