summaryrefslogtreecommitdiff
path: root/libgo
AgeCommit message (Collapse)Author
2016-11-18 runtime: don't call __go_alloc/__go_free in environment functionsian
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
2016-11-18 libgo: remove old/regexp and old/templateian
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
2016-11-18Correct gcc/go/gofrontend/lex.cc and libgo/aclocal.m4 to the versionsian
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
2016-11-18Update libgo/configure to restore it to the master version.ian
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
2016-11-18 runtime, reflect: rewrite Go to FFI type conversion in Goian
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
2016-11-16 runtime: replace runtime1.goc with Go and C codeian
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
2016-11-15<toplevel>doko
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
2016-11-14 runtime: don't crash if signal handler info argument is nilian
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
2016-11-11 libgo: fix GOARCH_INT64ALIGN for several targetsian
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
2016-11-10 runtime: copy signal code from Go 1.7 runtimeian
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
2016-11-05 PR go/78172.ian
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
2016-11-01 libgo: fix GOARCH_PHYSPAGESIZE for ia64ian
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
2016-11-01 runtime: recreate function called by cgo -gccgoian
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
2016-11-01 libgo: only rebuild package if dependent .gox has changedian
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
2016-11-01 libgo: minor Makefile improvementsian
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
2016-10-30 libgo: eliminate a lot of duplication in Makefile.amian
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
2016-10-28 compiler, runtime: copy slice code from Go 1.7 runtimeian
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
2016-10-28 PR go/78144ian
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
2016-10-28 PR go/78143ian
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
2016-10-28 libgo: redirect grep output in mkrsysinfo.sh to /dev/nullian
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
2016-10-21 libgo: keep c0 and c1 out of runtime.incian
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
2016-10-21 libgo: leave Int64Align as 8 on 32-bit SPARCian
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
2016-10-21 runtime: copy lfstack code from Go 1.7 runtimeian
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
2016-10-20 runtime: rewrite interface code into Goian
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
2016-10-19 runtime, syscall: force EPOLLET to be positiveian
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
2016-10-18 runtime: copy netpoll code from Go 1.7 runtimeian
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
2016-10-18 runtime: scan caller-saved registers for non-split-stackian
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
2016-10-17 runtime: copy rdebug code from Go 1.7 runtimeian
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
2016-10-15 runtime: copy runtime package time code from Go 1.7ian
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
2016-10-14 runtime: copy mprof code from Go 1.7 runtimeian
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
2016-10-14 runtime: just do file/line lookup in C, move Func to Goian
In order to port stack backtraces to Go, we need the ability to look up file/line information for PC values without allocating memory. This patch moves the handling of Func from C code to Go code, and simplifies the C code to just look up function/file/line/entry information for a PC. Reviewed-on: https://go-review.googlesource.com/31150 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241172 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-14 debug/elf: add sparc64 relocationsian
This is a backport of https://go-review.googlesource.com/30870. Reviewed-on: https://go-review.googlesource.com/30916 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241171 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-14 runtime: copy cpuprof code from Go 1.7 runtimeian
This replaces runtime/cpuprof.goc with go/runtime/cpuprof.go and adjusts the supporting code in runtime/proc.c. This adds another case where the compiler needs to avoid heap allocation in the runtime package: when evaluating a method expression into a closure. Implementing this required moving the relevant code from do_get_backend to do_flatten, so that I could easily add a temporary variable. Doing that let me get rid of Bound_method_expression::do_lower. Reviewed-on: https://go-review.googlesource.com/31050 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241163 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-13 runtime: copy mstats code from Go 1.7 runtimeian
This replaces mem.go and the C runtime_ReadMemStats function with the Go 1.7 mstats.go. The GCStats code is commented out for now. The corresponding gccgo code is in runtime/mgc0.c. The variables memstats and worldsema are shared between the Go code and the C code, but are not exported. To make this work, add temporary accessor functions acquireWorldsema, releaseWorldsema, getMstats (the latter known as mstats in the C code). Check the preemptoff field of m when allocating and when considering whether to start a GC. This works with the new stopTheWorld and startTheWorld functions in Go, which are essentially the Go 1.7 versions. Change the compiler to stack allocate closures when compiling the runtime package. Within the runtime packages closures do not escape. This is similar to what the gc compiler does, except that the gc compiler, when compiling the runtime package, gives an error if escape analysis shows that a closure does escape. I added this here because the Go version of ReadMemStats calls systemstack with a closure, and having that allocate memory was causing some tests that measure memory allocations to fail. Reviewed-on: https://go-review.googlesource.com/30972 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241124 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-13 syscall: don't use pt_regs in clone_linux.cian
It's unnecessary and it reportedly breaks the build on arm64 GNU/Linux. Reviewed-on: https://go-review.googlesource.com/30978 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241084 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-12 compiler, runtime: copy string code from Go 1.7ian
Add compiler support for turning concatenating strings into a call to a runtime function that takes the appropriate number of arguments. Rename some local variables in mgc0.c to avoid macros that the new rune.go causes to appear in runtime.inc. Reviewed-on: https://go-review.googlesource.com/30827 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241074 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-12 syscall: mark rawClone as no_split_stackian
Reviewed-on: https://go-review.googlesource.com/30955 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241072 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-12 runtime: copy Go 1.7 runtime semaphore codeian
This triggered a check in releaseSudog that g.param not nil, because libgo uses the param field when starting a goroutine. Fixed by clearing g->param in kickoff in proc.c. Reviewed-on: https://go-review.googlesource.com/30951 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241067 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-12 syscall, internal/syscall/unix: Fix getrandom, clone on sparc64ian
Since sparc is a valid architecture, the name of getrandom_linux_sparc.go means that it will be ignored on sparc64, even though it's whitelisted with a +build line. On SPARC, clone has a unique return value convention which requires some inline assembly to convert it to the normal convention. Reviewed-on: https://go-review.googlesource.com/30873 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241051 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-11 configure: redirect -fsplit-stack compilation to dev/nullian
Avoid an error message in the middle of the configure output. Patch by Eric Botcazou. Reviewed-on: https://go-review.googlesource.com/30813 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240993 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-11Accidentally failed to commit these earlier, as part of:ian
Update the compiler to use the new names. Add calls to printlock and printunlock around print statements. Move expression evaluation before the call to printlock. Update g's writebuf field to a slice, and adjust C code accordingly. Reviewed-on: https://go-review.googlesource.com/30717 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240958 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-10 runtime: copy print/println support from Go 1.7ian
Update the compiler to use the new names. Add calls to printlock and printunlock around print statements. Move expression evaluation before the call to printlock. Update g's writebuf field to a slice, and adjust C code accordingly. Reviewed-on: https://go-review.googlesource.com/30717 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240956 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-10 runtime: copy channel code from Go 1.7 runtimeian
Change the compiler to use the new routines. Drop the separation of small and large values when sending on a channel. Allocate the select struct on the stack. Remove the old C implementation of channels. Adjust the garbage collector for the new data structure. Bring in part of the tracing code, enough for the channel code to call. Bump the permitted number of allocations in one of the tests in context_test.go. The difference is that now receiving from a channel allocates a sudog, which the C code used to simply put on the stack. This will be somewhat better when we port proc.go. Reviewed-on: https://go-review.googlesource.com/30714 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240941 138bc75d-0d04-0410-961f-82ee72b054a4
2016-10-03 PR go/77809ian
libgo: strip most C macros from runtime.inc The Go runtime package is picking up C macros from runtime_sysinfo.go and then re-exporting them to runtime.inc. This can cause name conflicts. Change the Makefile so that we only put the macros we need into runtime.inc. These are the constants that are actually defined by Go code, not runtime_sysinfo.go. There are only a few, so we can pattern match. This is an additional hack on runtime.inc. The long term goal is to convert the runtime package to Go and eliminate runtime.inc entirely, so a few hacks seem acceptable. Fixes GCC PR 77809. Reviewed-on: https://go-review.googlesource.com/30167 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240724 138bc75d-0d04-0410-961f-82ee72b054a4
2016-09-30 runtime: copy internal locking code from Go 1.7 runtimeian
Remove the old locking code written in C. Add a shell script mkrsysinfo.sh to generate the runtime_sysinfo.go file, so that we can get Go copies of the system time structures and other types. Tweak the compiler so that when compiling the runtime package the address operator does not cause local variables to escape. When the gc compiler compiles the runtime, an escaping local variable is treated as an error. We should implement that, instead of this change, when escape analysis is turned on. Tweak the compiler so that the generated C header does not include names that start with an underscore followed by a non-upper-case letter, except for the special cases of _defer and _panic. Otherwise we translate C types to Go in runtime_sysinfo.go and then generate those Go types back as C types in runtime.inc, which is useless and painful for the C code. Change entersyscall and friends to take a dummy argument, as the gc versions do, to simplify calls from the shared code. Reviewed-on: https://go-review.googlesource.com/30079 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240657 138bc75d-0d04-0410-961f-82ee72b054a4
2016-09-29 runtime: copy runtime.go and runtime1.go from Go 1.7ian
Also copy over cputicks.go, env_posix.go, vdso_none.go, stubs2.go, and a part of os_linux.go. Remove the corresponding functions from the C code in libgo/go/runtime. Add some transitional support functions to stubs.go. This converts several minor functions from C to Go. Reviewed-on: https://go-review.googlesource.com/29962 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240609 138bc75d-0d04-0410-961f-82ee72b054a4
2016-09-28 libgo: fix for runtime/check failure with "-O0 -g"ian
Tweak the makefile rules for the runtime/check test to insure that the runtime package is compiled with "-fgo-compiling-runtime". This resolves a test failure (unsat on runtime.getcallerpc) when in a build directory where the compiler flags have been configured to disable optimization. Reviewed-on: https://go-review.googlesource.com/30010 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240588 138bc75d-0d04-0410-961f-82ee72b054a4
2016-09-27 libgo: separate mksysinfo inputs into separate Makefile targetsian
This is a step toward a version of mksysinfo that generates information for the runtime package. This will be used to generate the runtime_sysinfo.go file, which is currently directly generated by a Makefile target. Reviewed-on: https://go-review.googlesource.com/29683 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240560 138bc75d-0d04-0410-961f-82ee72b054a4
2016-09-23 internal/syscall/unix: add getrandom syscall for MIPS and SPARCian
Reviewed-on: https://go-review.googlesource.com/29678 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240457 138bc75d-0d04-0410-961f-82ee72b054a4
2016-09-21 compiler, runtime: replace hashmap code with Go 1.7 hashmapian
This change removes the gccgo-specific hashmap code and replaces it with the hashmap code from the Go 1.7 runtime. The Go 1.7 hashmap code is more efficient, does a better job on details like when to update a key, and provides some support against denial-of-service attacks. The compiler is changed to call the new hashmap functions instead of the old ones. The compiler now tracks which types are reflexive and which require updating when used as a map key, and records the information in map type descriptors. Map_index_expression is simplified. The special case for a map index on the right hand side of a tuple expression has been unnecessary for some time, and is removed. The support for specially marking a map index as an lvalue is removed, in favor of lowering an assignment to a map index into a function call. The long-obsolete support for a map index of a pointer to a map is removed. The __go_new_map_big function (known to the compiler as Runtime::MAKEMAPBIG) is no longer needed, as the new runtime.makemap function takes an int64 hint argument. The old map descriptor type and supporting expression is removed. The compiler was still supporting the long-obsolete syntax `m[k] = 0, false` to delete a value from a map. That is now removed, requiring a change to one of the gccgo-specific tests. The builtin len function applied to a map or channel p is now compiled as `p == nil ? 0 : *(*int)(p)`. The __go_chan_len function (known to the compiler as Runtime::CHAN_LEN) is removed. Support for a shared zero value for maps to large value types is introduced, along the lines of the gc compiler. The zero value is handled as a common variable. The hash function is changed to take a seed argument, changing the runtime hash functions and the compiler-generated hash functions. Unlike the gc compiler, both the hash and equal functions continue to take the type length. Types that can not be compared now store nil for the hash and equal functions, rather than pointing to functions that throw. Interface hash and comparison functions now check explicitly for nil. This matches the gc compiler and permits a simple implementation for ismapkey. The compiler is changed to permit marking struct and array types as incomparable, meaning that they have no hash or equal function. We use this for thunk types, removing the existing special code to avoid generating hash/equal functions for them. The C runtime code adds memclr, memequal, and memmove functions. The hashmap code uses go:linkname comments to make the functions visible, as otherwise the compiler would discard them. The hashmap code comments out the unused reference to the address of the first parameter in the race code, as otherwise the compiler thinks that the parameter escapes and copies it onto the heap. This is probably not needed when we enable escape analysis. Several runtime map tests that ere previously skipped for gccgo are now run. The Go runtime picks up type kind information and stubs. The type kind information causes the generated runtime header file to define some constants, including `empty`, and the C code is adjusted accordingly. A Go-callable version of runtime.throw, that takes a Go string, is added to be called from the hashmap code. Reviewed-on: https://go-review.googlesource.com/29447 * go.go-torture/execute/map-1.go: Replace old map deletion syntax with call to builtin delete function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240334 138bc75d-0d04-0410-961f-82ee72b054a4