summaryrefslogtreecommitdiff
path: root/libgo
Commit message (Collapse)AuthorAgeFilesLines
* libgo: update to Go 1.8 release candidate 1ian2017-01-14973-17420/+69003
| | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244456 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy more scheduler code from Go 1.7 runtimeian2017-01-1012-393/+586
| | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244291 138bc75d-0d04-0410-961f-82ee72b054a4
* compiler, runtime: drop size arguments to hash/equal functionsian2017-01-1013-416/+212
| | | | | | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244256 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy more of scheduler from Go 1.7 runtimeian2017-01-0915-1541/+1996
| | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244236 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: actually remove go-alloc.hian2017-01-061-11/+0
| | | | | | | Accidentally omitted from the commit of CL 34797 (SVN revision 244036). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244166 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/78978ian2017-01-065-50/+36
| | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244165 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: remove __go_alloc and __go_freeian2017-01-0317-442/+351
| | | | | | | | | Move allocg and handling of allgs slice from C to Go. Reviewed-on: https://go-review.googlesource.com/34797 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244036 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/78789ian2017-01-039-4/+65
| | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244031 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy cgo support from Go 1.7 runtimeian2016-12-1917-633/+629
| | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243805 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: fixes for Solaris buildian2016-12-136-9/+74
| | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243619 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: mark non-x86 aeshashbody parameters as unusedian2016-12-081-1/+4
| | | | | | | | | Avoids warnings during the build. Reviewed-on: https://go-review.googlesource.com/34142 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243459 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy memory hash code from Go 1.7ian2016-12-0820-46/+935
| | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243445 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: allocate _panic struct on heapian2016-12-081-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243444 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: remove some unused variables/declarations from runtime.hian2016-12-081-4/+0
| | | | | | | | | Small patch from Eric Botcazou. Reviewed-on: https://go-review.googlesource.com/34029 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243424 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: set isarchive in initsigian2016-12-011-0/+5
| | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243094 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: print C functions in tracebackian2016-11-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243083 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: fixes for -buildmode=c-archiveian2016-11-304-5/+23
| | | | | | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242992 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/77910ian2016-11-221-1/+6
| | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242724 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: rewrite panic/defer code from C to Goian2016-11-2222-1022/+895
| | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242715 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: move schedt type and sched var from C to Goian2016-11-183-268/+242
| | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242600 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: don't call __go_alloc/__go_free in environment functionsian2016-11-182-33/+21
| | | | | | | Reviewed-on: https://go-review.googlesource.com/33363 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242594 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: remove old/regexp and old/templateian2016-11-1810-4505/+12
| | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242592 138bc75d-0d04-0410-961f-82ee72b054a4
* Correct gcc/go/gofrontend/lex.cc and libgo/aclocal.m4 to the versionsian2016-11-184-210/+5
| | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242583 138bc75d-0d04-0410-961f-82ee72b054a4
* Update libgo/configure to restore it to the master version.ian2016-11-185-5/+45
| | | | | | | | | | | Update a few binary files that were changed in the master gc repo, copied into the gofrontend repo, but not correctly copied into the GCC repo. The changes are all minor and do not affect any actual tests. Two instances of "http" changed to "https", and two timestamps were zeroed out. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242582 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime, reflect: rewrite Go to FFI type conversion in Goian2016-11-1813-338/+471
| | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242578 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: replace runtime1.goc with Go and C codeian2016-11-1610-133/+95
| | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242509 138bc75d-0d04-0410-961f-82ee72b054a4
* <toplevel>doko2016-11-152-52/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2016-11-15 Matthias Klose <doko@ubuntu.com> * config-ml.in: Remove references to GCJ. * configure.ac: Likewise. * configure: Regenerate. config/ 2016-11-15 Matthias Klose <doko@ubuntu.com> multi.m4: Don't set GCJ. gcc/ 2016-11-15 Matthias Klose <doko@ubuntu.com> * doc/install.texi: Remove references to gcj/libjava. * doc/invoke.texi: Likewise. */ (where necessary) 2016-11-15 Matthias Klose <doko@ubuntu.com> * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242433 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: don't crash if signal handler info argument is nilian2016-11-143-3/+15
| | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242403 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: fix GOARCH_INT64ALIGN for several targetsian2016-11-112-10/+2
| | | | | | | | | From Andreas Schwab. Reviewed-on: https://go-review.googlesource.com/33130 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242072 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy signal code from Go 1.7 runtimeian2016-11-1024-934/+1359
| | | | | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242060 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/78172.ian2016-11-051-2/+2
| | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241868 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: fix GOARCH_PHYSPAGESIZE for ia64ian2016-11-012-2/+2
| | | | | | | | | From Andreas Schwab. Reviewed-on: https://go-review.googlesource.com/32537 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241757 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: recreate function called by cgo -gccgoian2016-11-011-0/+17
| | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241743 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: only rebuild package if dependent .gox has changedian2016-11-012-4/+10
| | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241742 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: minor Makefile improvementsian2016-11-012-6/+6
| | | | | | | | | Suggested by Ralph Corderoy. Reviewed-on: https://go-review.googlesource.com/32414 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241741 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: eliminate a lot of duplication in Makefile.amian2016-10-303-4070/+577
| | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241687 138bc75d-0d04-0410-961f-82ee72b054a4
* compiler, runtime: copy slice code from Go 1.7 runtimeian2016-10-289-252/+254
| | | | | | | | | | | | | | | | | | | Change the compiler handle append as the gc compiler does: call a function to grow the slice, but otherwise assign the new elements directly to the final slice. For the current gccgo memory allocator the slice code has to call runtime_newarray, not mallocgc directly, so that the allocator sets the TypeInfo_Array bit in the type pointer. Rename the static function cnew to runtime_docnew, so that the stack trace ignores it when ignoring runtime functions. This was needed to fix the runtime/pprof tests on 386. Reviewed-on: https://go-review.googlesource.com/32218 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241667 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/78144ian2016-10-281-2/+5
| | | | | | | | | | | | | libgo: incorporate fix for timezone test This brings over the test-only fix for issue 17276 into gccgo/libgo (with tzdata-2016g there is a new zone abbreviation). This is a copy of https://golang.org/cl/29995. Reviewed-on: https://go-review.googlesource.com/32182 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241661 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/78143ian2016-10-281-1/+1
| | | | | | | | | | | runtime: build lfstack_32bit.go on ppc Missed a build tag. This is GCC PR 78143. Reviewed-on: https://go-review.googlesource.com/32295 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241659 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: redirect grep output in mkrsysinfo.sh to /dev/nullian2016-10-281-1/+1
| | | | | | | | | I noticed a stray useless output line when building libgo. Reviewed-on: https://go-review.googlesource.com/32294 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241655 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: keep c0 and c1 out of runtime.incian2016-10-212-2/+2
| | | | | | | | | | | | The constants named c0 and c1 turn up as macros in runtime.inc. This reportedly breaks building on Solaris 11, where there is a system struct that has a field named c1. The constants aren't needed by the runtime C code, so avoid the problem by grepping them out. Reviewed-on: https://go-review.googlesource.com/31730 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241432 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: leave Int64Align as 8 on 32-bit SPARCian2016-10-212-2/+0
| | | | | | | | | Verified by testing on SPARC Solaris. Reviewed-on: https://go-review.googlesource.com/31675 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241430 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy lfstack code from Go 1.7 runtimeian2016-10-218-118/+87
| | | | | | | | | | Note that lfstack_64bit.go was modified for Solaris support in a different, and better, way than the superseded lfstack.goc code. Reviewed-on: https://go-review.googlesource.com/31673 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241427 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: rewrite interface code into Goian2016-10-2036-1085/+651
| | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241384 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime, syscall: force EPOLLET to be positiveian2016-10-193-1/+15
| | | | | | | | | | The C definition is 1U << 31. Reportedly on some systems GCC's -fgo-dump-spec can print this as -2147483648. Reviewed-on: https://go-review.googlesource.com/31448 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241347 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy netpoll code from Go 1.7 runtimeian2016-10-1823-1145/+1158
| | | | | | | Reviewed-on: https://go-review.googlesource.com/31325 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241307 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: scan caller-saved registers for non-split-stackian2016-10-181-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While testing a patch on Solaris, which does not support split-stack, I ran across a bug in the handling of caller-saved registers for the garbage collector. For non-split-stack systems, runtime_mcall is responsible for saving all caller-saved registers on the stack so that the GC stack scan will see them. It does this by calling __builtin_unwind_init and setting the g's gcnextsp field to point to the current stack. The garbage collector then scans the stack from gcnextsp to the top of stack. Unfortunately, the code was setting gcnextsp to point to runtime_mcall's argument, which meant that even though runtime_mcall was careful to store all caller-saved registers on the stack, the GC never saw them. This is, of course, only a problem if a value lives only in a caller-saved register, and not anywhere else on the stack or heap. And it is only a problem if that caller-saved register manages to make it all the way down to runtime_mcall without being saved by any function on the way. This is moderately unlikely but it turns out that the recent changes to keep values on the stack when compiling the runtime package caused it to happen for the local variable `s` in `notifyListWait` in runtime/sema.go. That function calls goparkunlock which is simple enough to not require all registers, and itself calls runtime_mcall. So it was possible for `s` to be released by the GC before the goroutine returned from goparkunlock, which eventually caused a dangling pointer to be passed to releaseSudog. This is not a problem on split-stack systems, which use __splitstack_get_context, which saves a stack pointer low enough on the stack to scan the registers saved by runtime_mcall. Reviewed-on: https://go-review.googlesource.com/31323 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241304 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy rdebug code from Go 1.7 runtimeian2016-10-1719-83/+138
| | | | | | | | | | | | While we're at it, update the runtime/debug package, and start running its testsuite by default. I'm not sure why runtime/debug was not previously updated to 1.7. Doing that led me to fix some minor aspects of runtime.Stack and the C function runtime/debug.readGCStats. Reviewed-on: https://go-review.googlesource.com/31251 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241261 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy runtime package time code from Go 1.7ian2016-10-1510-422/+337
| | | | | | | | | | | | | | Fix handling of function values for -fgo-c-header to generate FuncVal*, not simply FuncVal. While we're here change runtime.nanotime to use clock_gettime with CLOCK_MONOTONIC, rather than gettimeofday. This is what the gc library does. It provides nanosecond precision and a monotonic clock. Reviewed-on: https://go-review.googlesource.com/31232 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241197 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: copy mprof code from Go 1.7 runtimeian2016-10-1414-887/+951
| | | | | | | | | | | | | | Also create a gccgo version of some of the traceback code in traceback_gccgo.go, replacing some code currently in C. This required modifying the compiler so that when compiling the runtime package a slice expression does not cause a local array variable to escape to the heap. Reviewed-on: https://go-review.googlesource.com/31230 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241189 138bc75d-0d04-0410-961f-82ee72b054a4