summaryrefslogtreecommitdiff
path: root/libgo/go/runtime
Commit message (Collapse)AuthorAgeFilesLines
...
* runtime: copy memory hash code from Go 1.7ian2016-12-088-6/+305
| | | | | | | | | | | | | | | 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: 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-303-5/+14
| | | | | | | | | | | | | | | | | | | | 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
* runtime: rewrite panic/defer code from C to Goian2016-11-225-25/+787
| | | | | | | | | | | | | | | 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-182-12/+15
| | | | | | | | | | | | | | | | 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, reflect: rewrite Go to FFI type conversion in Goian2016-11-181-0/+315
| | | | | | | | | | | | | 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-165-32/+23
| | | | | | | | | | | | 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
* runtime: don't crash if signal handler info argument is nilian2016-11-142-2/+10
| | | | | | | | | | | | | | | | 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
* runtime: copy signal code from Go 1.7 runtimeian2016-11-1011-37/+991
| | | | | | | | | | | | | | | | | | | 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
* 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
* compiler, runtime: copy slice code from Go 1.7 runtimeian2016-10-282-5/+232
| | | | | | | | | | | | | | | | | | | 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/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
* runtime: copy lfstack code from Go 1.7 runtimeian2016-10-214-9/+82
| | | | | | | | | | 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-205-1/+567
| | | | | | | | | | | | | | | 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-191-1/+1
| | | | | | | | | | 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-189-5/+1100
| | | | | | | 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: copy rdebug code from Go 1.7 runtimeian2016-10-178-30/+111
| | | | | | | | | | | | 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-152-4/+311
| | | | | | | | | | | | | | 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-145-172/+875
| | | | | | | | | | | | | | 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
* runtime: just do file/line lookup in C, move Func to Goian2016-10-141-15/+23
| | | | | | | | | | | | 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
* runtime: copy cpuprof code from Go 1.7 runtimeian2016-10-142-0/+466
| | | | | | | | | | | | | | | | 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
* runtime: copy mstats code from Go 1.7 runtimeian2016-10-133-77/+466
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* compiler, runtime: copy string code from Go 1.7ian2016-10-125-85/+674
| | | | | | | | | | | | | 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
* runtime: copy Go 1.7 runtime semaphore codeian2016-10-121-0/+358
| | | | | | | | | | | 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
* Accidentally failed to commit these earlier, as part of:ian2016-10-112-0/+173
| | | | | | | | | | | | 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
* runtime: copy print/println support from Go 1.7ian2016-10-103-23/+30
| | | | | | | | | | | | 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
* runtime: copy channel code from Go 1.7 runtimeian2016-10-105-6/+2495
| | | | | | | | | | | | | | | | | | | 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
* runtime: copy internal locking code from Go 1.7 runtimeian2016-09-3012-25/+1297
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* runtime: copy runtime.go and runtime1.go from Go 1.7ian2016-09-2910-43/+835
| | | | | | | | | | | | 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
* compiler, runtime: replace hashmap code with Go 1.7 hashmapian2016-09-219-30/+1839
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* runtime/internal/sys: new package, API copied from Go 1.7ian2016-09-115-5/+164
| | | | | | | | | | | | | | | | Copy over the Go 1.7 runtime/internal/sys package, but instead of having separate files for each GOARCH and GOOS value, set the values in configure.ac and write them out in Makefile.am. Setting the values in configure.ac should make it easier to add new processors. Remove the automake GOARCH conditionals, which are no longer used. Leave the GOOS conditionals for now, as they are used for the C runtime package. Reviewed-on: https://go-review.googlesource.com/29018 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240083 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: update to Go 1.7.1 releaseian2016-09-101-1/+62
| | | | | | | Reviewed-on: https://go-review.googlesource.com/29012 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240071 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime/internal/atomic: new package, API copied from Go 1.7ian2016-09-104-0/+396
| | | | | | | | | | | Copy over the Go 1.7 runtime/internal/atomic package, but implement the functions in C using __atomic functions rather than using the processor-specific assembler code. Reviewed-on: https://go-review.googlesource.com/29010 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240070 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: align ucontext_t argument to 16 byte boundaryian2016-09-091-1/+5
| | | | | | | | | | | | | | | Some systems, such as ia64 and PPC, require that a ucontext_t pointer passed to getcontext and friends be aligned to a 16-byte boundary. Currently the ucontext_t fields in the g structure are defined in Go, and Go has no way to ensure a 16-byte alignment for a struct field. The fields are currently represented by an array of unsafe.Pointer. Enforce the alignment by making the array larger, and picking an offset into the array that is 16-byte aligned. Reviewed-on: https://go-review.googlesource.com/28910 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240044 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: use -fgo-c-header to build C header fileian2016-08-303-0/+1037
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239872 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: change build procedure to use build tagsian2016-08-0637-1881/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239189 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: update to go1.7rc3ian2016-07-22101-646/+3171
| | | | | | | Reviewed-on: https://go-review.googlesource.com/25150 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238662 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: update to Go 1.6.1 releaseian2016-04-131-0/+4
| | | | | | | Reviewed-on: https://go-review.googlesource.com/22007 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234958 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: Update to final Go 1.6 release.ian2016-02-1813-24/+412
| | | | | | | Reviewed-on: https://go-review.googlesource.com/19592 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233515 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: Update to go1.6rc1.ian2016-02-0378-984/+5117
| | | | | | | Reviewed-on: https://go-review.googlesource.com/19200 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233110 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: Update from Go 1.5 to Go 1.5.1.ian2015-10-312-0/+20
| | | | | | | Reviewed-on: https://go-review.googlesource.com/16527 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229624 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: Remove now unnecessary pad field from ParFor.ian2015-10-3190-11473/+2100
| | | | | | | | | It is not needed due to the removal of the ctx field. Reviewed-on: https://go-review.googlesource.com/16525 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229616 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/64683ian2015-04-171-0/+4
| | | | | | | | | | | | | | | | runtime/pprof: Assume function with no name is in runtime. GCC PR 65797 causes some of the runtime functions to be compiled with no name in the debug info. This in turn causes the runtime/pprof test to fail as reported in GCC PR 64683. There are no good choices when a function has no name in the debug info, but here we assume that if we see such a function while reading the runtime functions, we assume that it is also a runtime function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222200 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: Fix go/runtime test failure on S390.ian2015-03-262-1/+11
| | | | | | | | The tests run out of memory on 31-bit S390 systems because it does not have split stacks. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221681 138bc75d-0d04-0410-961f-82ee72b054a4
* libgo: Upgrade to Go 1.4.2 release.ian2015-03-067-33/+119
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221245 138bc75d-0d04-0410-961f-82ee72b054a4
* runtime: Add memprofilerate to GODEBUGian2015-02-061-0/+4
| | | | | | | | | | | Add memprofilerate as a value recognized in the GODEBUG env var. The value provided is used as the new setting for runtime.MemProfileRate, allowing the user to adjust memory profiling. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220470 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/64725ian2015-01-231-0/+9
| | | | | | | runtime: Disable tests that require that a finalizer run. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220067 138bc75d-0d04-0410-961f-82ee72b054a4
* PR go/64683ian2015-01-201-2/+4
| | | | | | | | | | runtime/pprof: Let memory profiler test pass if value not collected. Since gccgo's GC is not precise, the transient value may not be collected. Let the regexp match that case as well. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219900 138bc75d-0d04-0410-961f-82ee72b054a4